Skip to content

Commit d578440

Browse files
authored
Cleanup: remove globalSettingsLoaded action (#6395)
Remove globalSettingsLoaded action export since all internal actions have been renamed.
1 parent 7fc7f28 commit d578440

File tree

8 files changed

+40
-43
lines changed

8 files changed

+40
-43
lines changed

tensorboard/webapp/core/store/core_reducers_test.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
import {globalSettingsLoaded} from '../../persistent_settings';
15+
import {persistentSettingsLoaded} from '../../persistent_settings';
1616
import {DataLoadState} from '../../types/data';
1717
import * as actions from '../actions';
1818
import {
@@ -591,14 +591,14 @@ describe('core reducer', () => {
591591
});
592592
});
593593

594-
describe('#globalSettingsLoaded', () => {
594+
describe('#persistentSettingsLoaded', () => {
595595
it('loads sideBarWidthInPercent from settings when present', () => {
596596
const state = createCoreState({
597597
sideBarWidthInPercent: 0,
598598
});
599599
const nextState = reducers(
600600
state,
601-
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: 40}})
601+
persistentSettingsLoaded({partialSettings: {sideBarWidthInPercent: 40}})
602602
);
603603

604604
expect(nextState.sideBarWidthInPercent).toBe(40);
@@ -610,7 +610,7 @@ describe('core reducer', () => {
610610
});
611611
const nextState = reducers(
612612
state,
613-
globalSettingsLoaded({partialSettings: {}})
613+
persistentSettingsLoaded({partialSettings: {}})
614614
);
615615

616616
expect(nextState.sideBarWidthInPercent).toBe(0);
@@ -622,19 +622,23 @@ describe('core reducer', () => {
622622
});
623623
const state2 = reducers(
624624
state1,
625-
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: 101}})
625+
persistentSettingsLoaded({
626+
partialSettings: {sideBarWidthInPercent: 101},
627+
})
626628
);
627629
expect(state2.sideBarWidthInPercent).toBe(0);
628630

629631
const state3 = reducers(
630632
state2,
631-
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: -1}})
633+
persistentSettingsLoaded({partialSettings: {sideBarWidthInPercent: -1}})
632634
);
633635
expect(state3.sideBarWidthInPercent).toBe(0);
634636

635637
const state4 = reducers(
636638
state3,
637-
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: NaN}})
639+
persistentSettingsLoaded({
640+
partialSettings: {sideBarWidthInPercent: NaN},
641+
})
638642
);
639643
expect(state4.sideBarWidthInPercent).toBe(0);
640644
});

tensorboard/webapp/feature_flag/store/feature_flag_reducers_test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
import {globalSettingsLoaded, ThemeValue} from '../../persistent_settings';
15+
import {persistentSettingsLoaded, ThemeValue} from '../../persistent_settings';
1616
import * as actions from '../actions/feature_flag_actions';
1717
import {buildFeatureFlag} from '../testing';
1818
import {reducers} from './feature_flag_reducers';
@@ -221,7 +221,7 @@ describe('feature_flag_reducers', () => {
221221
});
222222
});
223223

224-
describe('#globalSettingsLoaded', () => {
224+
describe('#persistentSettingsLoaded', () => {
225225
it('sets dark mode overrides when global settings include it', () => {
226226
const prevState = buildFeatureFlagState({
227227
isFeatureFlagsLoaded: true,
@@ -232,31 +232,31 @@ describe('feature_flag_reducers', () => {
232232

233233
const state1 = reducers(
234234
prevState,
235-
globalSettingsLoaded({
235+
persistentSettingsLoaded({
236236
partialSettings: {},
237237
})
238238
);
239239
expect(state1.flagOverrides!.enableDarkModeOverride).toBe(false);
240240

241241
const state2 = reducers(
242242
prevState,
243-
globalSettingsLoaded({
243+
persistentSettingsLoaded({
244244
partialSettings: {themeOverride: ThemeValue.LIGHT},
245245
})
246246
);
247247
expect(state2.flagOverrides!.enableDarkModeOverride).toBe(false);
248248

249249
const state3 = reducers(
250250
prevState,
251-
globalSettingsLoaded({
251+
persistentSettingsLoaded({
252252
partialSettings: {themeOverride: ThemeValue.DARK},
253253
})
254254
);
255255
expect(state3.flagOverrides!.enableDarkModeOverride).toBe(true);
256256

257257
const state4 = reducers(
258258
prevState,
259-
globalSettingsLoaded({
259+
persistentSettingsLoaded({
260260
partialSettings: {themeOverride: ThemeValue.BROWSER_DEFAULT},
261261
})
262262
);

tensorboard/webapp/metrics/store/metrics_reducers_test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as routingActions from '../../app_routing/actions';
1616
import {buildNavigatedAction, buildRoute} from '../../app_routing/testing';
1717
import {RouteKind} from '../../app_routing/types';
1818
import * as coreActions from '../../core/actions';
19-
import {globalSettingsLoaded} from '../../persistent_settings';
19+
import {persistentSettingsLoaded} from '../../persistent_settings';
2020
import {buildDeserializedState} from '../../routes/testing';
2121
import {DataLoadState} from '../../types/data';
2222
import {nextElementId} from '../../util/dom';
@@ -3309,7 +3309,7 @@ describe('metrics reducers', () => {
33093309
});
33103310
});
33113311

3312-
describe('#globalSettingsLoaded', () => {
3312+
describe('#persistentSettingsLoaded', () => {
33133313
it('adds partial state from loading the settings to the (alphabetical) settings', () => {
33143314
const beforeState = buildMetricsState({
33153315
settings: buildMetricsSettingsState({
@@ -3325,7 +3325,7 @@ describe('metrics reducers', () => {
33253325

33263326
const nextState = reducers(
33273327
beforeState,
3328-
globalSettingsLoaded({
3328+
persistentSettingsLoaded({
33293329
partialSettings: {
33303330
ignoreOutliers: true,
33313331
tooltipSort: TooltipSort.DESCENDING,
@@ -3354,7 +3354,7 @@ describe('metrics reducers', () => {
33543354

33553355
const nextState = reducers(
33563356
beforeState,
3357-
globalSettingsLoaded({
3357+
persistentSettingsLoaded({
33583358
partialSettings: {
33593359
tooltipSort: 'yo' as TooltipSort,
33603360
},
@@ -3372,7 +3372,7 @@ describe('metrics reducers', () => {
33723372

33733373
const nextState = reducers(
33743374
beforeState,
3375-
globalSettingsLoaded({
3375+
persistentSettingsLoaded({
33763376
partialSettings: {
33773377
timeSeriesSettingsPaneOpened: false,
33783378
},
@@ -3408,7 +3408,7 @@ describe('metrics reducers', () => {
34083408

34093409
const nextState = reducers(
34103410
beforeState,
3411-
globalSettingsLoaded({
3411+
persistentSettingsLoaded({
34123412
partialSettings: {
34133413
singleSelectionHeaders: [
34143414
{
@@ -3488,7 +3488,7 @@ describe('metrics reducers', () => {
34883488

34893489
const nextState = reducers(
34903490
beforeState,
3491-
globalSettingsLoaded({
3491+
persistentSettingsLoaded({
34923492
partialSettings: {
34933493
rangeSelectionHeaders: [
34943494
{
@@ -3558,7 +3558,7 @@ describe('metrics reducers', () => {
35583558

35593559
const nextState = reducers(
35603560
beforeState,
3561-
globalSettingsLoaded({
3561+
persistentSettingsLoaded({
35623562
partialSettings: {
35633563
stepSelectorEnabled: true,
35643564
},
@@ -3579,7 +3579,7 @@ describe('metrics reducers', () => {
35793579

35803580
const nextState = reducers(
35813581
beforeState,
3582-
globalSettingsLoaded({
3582+
persistentSettingsLoaded({
35833583
partialSettings: {
35843584
rangeSelectionEnabled: true,
35853585
},
@@ -3600,7 +3600,7 @@ describe('metrics reducers', () => {
36003600

36013601
const nextState = reducers(
36023602
beforeState,
3603-
globalSettingsLoaded({
3603+
persistentSettingsLoaded({
36043604
partialSettings: {
36053605
linkedTimeEnabled: true,
36063606
},

tensorboard/webapp/notification_center/_redux/notification_center_reducers_test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
import {globalSettingsLoaded} from '../../persistent_settings';
15+
import {persistentSettingsLoaded} from '../../persistent_settings';
1616
import * as notificationActions from './notification_center_actions';
1717
import * as notificationReducers from './notification_center_reducers';
1818
import {buildNotification, buildNotificationState} from './testing';
@@ -53,15 +53,15 @@ describe('notification reducers', () => {
5353
});
5454
});
5555

56-
describe('#globalSettingsLoaded', () => {
56+
describe('#persistentSettingsLoaded', () => {
5757
it('sets lastReadTimestampInMs if its related state is present', () => {
5858
const state1 = buildNotificationState({
5959
lastReadTimestampInMs: 0,
6060
});
6161

6262
const state2 = notificationReducers.reducers(
6363
state1,
64-
globalSettingsLoaded({
64+
persistentSettingsLoaded({
6565
partialSettings: {
6666
notificationLastReadTimeInMs: 500,
6767
},
@@ -77,7 +77,7 @@ describe('notification reducers', () => {
7777

7878
const state2 = notificationReducers.reducers(
7979
state1,
80-
globalSettingsLoaded({
80+
persistentSettingsLoaded({
8181
partialSettings: {
8282
notificationLastReadTimeInMs: NaN,
8383
},
@@ -87,7 +87,7 @@ describe('notification reducers', () => {
8787

8888
const state3 = notificationReducers.reducers(
8989
state2,
90-
globalSettingsLoaded({
90+
persistentSettingsLoaded({
9191
partialSettings: {},
9292
})
9393
);

tensorboard/webapp/persistent_settings/_redux/persistent_settings_actions.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,3 @@ export const persistentSettingsLoaded = createAction(
2525
partialSettings: Partial<PersistableSettings>;
2626
}>()
2727
);
28-
29-
// TODO(b/279035032): Removes this function once internal import are renamed.
30-
export const globalSettingsLoaded = persistentSettingsLoaded;

tensorboard/webapp/persistent_settings/_redux/persistent_settings_effects_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
PersistentSettingsTestingDataSource,
2929
PersistentSettingsTestingDataSourceModule,
3030
} from '../_data_source/testing';
31-
import {globalSettingsLoaded} from './persistent_settings_actions';
31+
import {persistentSettingsLoaded} from './persistent_settings_actions';
3232
import {
3333
PersistentSettingsEffects,
3434
TEST_ONLY,
@@ -107,7 +107,7 @@ describe('persistent_settings effects test', () => {
107107
action.next(appRoutingActions.navigating({after: buildRoute()}));
108108

109109
expect(actualActions).toEqual([
110-
globalSettingsLoaded({
110+
persistentSettingsLoaded({
111111
partialSettings: {
112112
ignoreOutliers: false,
113113
},
@@ -138,7 +138,7 @@ describe('persistent_settings effects test', () => {
138138

139139
action.next(appRoutingActions.navigating({after: buildRoute()}));
140140
expect(actualActions).toEqual([
141-
globalSettingsLoaded({
141+
persistentSettingsLoaded({
142142
partialSettings: {
143143
ignoreOutliers: false,
144144
},

tensorboard/webapp/persistent_settings/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ limitations under the License.
1414
==============================================================================*/
1515

1616
export {PersistableSettings, ThemeValue} from './_data_source/types';
17-
// TODO(b/279035032): Removes globalSettingsLoaded export after internal import are renamed.
18-
export {
19-
persistentSettingsLoaded,
20-
globalSettingsLoaded,
21-
} from './_redux/persistent_settings_actions';
17+
export {persistentSettingsLoaded} from './_redux/persistent_settings_actions';
2218
export {PersistentSettingsConfigModule} from './persistent_settings_config_module';
2319
export {PersistentSettingsModule} from './persistent_settings_module';

tensorboard/webapp/settings/_redux/settings_reducers_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
import {globalSettingsLoaded} from '../../persistent_settings';
15+
import {persistentSettingsLoaded} from '../../persistent_settings';
1616
import {DataLoadState} from '../../types/data';
1717
import {createSettings, createSettingsState} from '../testing';
1818
import * as actions from './settings_actions';
@@ -158,7 +158,7 @@ describe('settings reducer', () => {
158158
});
159159
});
160160

161-
describe('#globalSettingsLoaded', () => {
161+
describe('#persistentSettingsLoaded', () => {
162162
it('loads settings from the persistent settings storage', () => {
163163
const state = createSettingsState({
164164
state: DataLoadState.LOADING,
@@ -171,7 +171,7 @@ describe('settings reducer', () => {
171171

172172
const nextState = reducers(
173173
state,
174-
globalSettingsLoaded({
174+
persistentSettingsLoaded({
175175
partialSettings: {
176176
autoReloadPeriodInMs: 50000,
177177
pageSize: 10,
@@ -195,7 +195,7 @@ describe('settings reducer', () => {
195195

196196
const nextState = reducers(
197197
state,
198-
globalSettingsLoaded({
198+
persistentSettingsLoaded({
199199
partialSettings: {
200200
autoReloadPeriodInMs: 10,
201201
pageSize: NaN,

0 commit comments

Comments
 (0)