Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions tensorboard/webapp/core/store/core_reducers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
import {globalSettingsLoaded} from '../../persistent_settings';
import {persistentSettingsLoaded} from '../../persistent_settings';
import {DataLoadState} from '../../types/data';
import * as actions from '../actions';
import {
Expand Down Expand Up @@ -591,14 +591,14 @@ describe('core reducer', () => {
});
});

describe('#globalSettingsLoaded', () => {
describe('#persistentSettingsLoaded', () => {
it('loads sideBarWidthInPercent from settings when present', () => {
const state = createCoreState({
sideBarWidthInPercent: 0,
});
const nextState = reducers(
state,
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: 40}})
persistentSettingsLoaded({partialSettings: {sideBarWidthInPercent: 40}})
);

expect(nextState.sideBarWidthInPercent).toBe(40);
Expand All @@ -610,7 +610,7 @@ describe('core reducer', () => {
});
const nextState = reducers(
state,
globalSettingsLoaded({partialSettings: {}})
persistentSettingsLoaded({partialSettings: {}})
);

expect(nextState.sideBarWidthInPercent).toBe(0);
Expand All @@ -622,19 +622,23 @@ describe('core reducer', () => {
});
const state2 = reducers(
state1,
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: 101}})
persistentSettingsLoaded({
partialSettings: {sideBarWidthInPercent: 101},
})
);
expect(state2.sideBarWidthInPercent).toBe(0);

const state3 = reducers(
state2,
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: -1}})
persistentSettingsLoaded({partialSettings: {sideBarWidthInPercent: -1}})
);
expect(state3.sideBarWidthInPercent).toBe(0);

const state4 = reducers(
state3,
globalSettingsLoaded({partialSettings: {sideBarWidthInPercent: NaN}})
persistentSettingsLoaded({
partialSettings: {sideBarWidthInPercent: NaN},
})
);
expect(state4.sideBarWidthInPercent).toBe(0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
import {globalSettingsLoaded, ThemeValue} from '../../persistent_settings';
import {persistentSettingsLoaded, ThemeValue} from '../../persistent_settings';
import * as actions from '../actions/feature_flag_actions';
import {buildFeatureFlag} from '../testing';
import {reducers} from './feature_flag_reducers';
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('feature_flag_reducers', () => {
});
});

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

const state1 = reducers(
prevState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {},
})
);
expect(state1.flagOverrides!.enableDarkModeOverride).toBe(false);

const state2 = reducers(
prevState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {themeOverride: ThemeValue.LIGHT},
})
);
expect(state2.flagOverrides!.enableDarkModeOverride).toBe(false);

const state3 = reducers(
prevState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {themeOverride: ThemeValue.DARK},
})
);
expect(state3.flagOverrides!.enableDarkModeOverride).toBe(true);

const state4 = reducers(
prevState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {themeOverride: ThemeValue.BROWSER_DEFAULT},
})
);
Expand Down
20 changes: 10 additions & 10 deletions tensorboard/webapp/metrics/store/metrics_reducers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import * as routingActions from '../../app_routing/actions';
import {buildNavigatedAction, buildRoute} from '../../app_routing/testing';
import {RouteKind} from '../../app_routing/types';
import * as coreActions from '../../core/actions';
import {globalSettingsLoaded} from '../../persistent_settings';
import {persistentSettingsLoaded} from '../../persistent_settings';
import {buildDeserializedState} from '../../routes/testing';
import {DataLoadState} from '../../types/data';
import {nextElementId} from '../../util/dom';
Expand Down Expand Up @@ -3309,7 +3309,7 @@ describe('metrics reducers', () => {
});
});

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

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
ignoreOutliers: true,
tooltipSort: TooltipSort.DESCENDING,
Expand Down Expand Up @@ -3354,7 +3354,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
tooltipSort: 'yo' as TooltipSort,
},
Expand All @@ -3372,7 +3372,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
timeSeriesSettingsPaneOpened: false,
},
Expand Down Expand Up @@ -3408,7 +3408,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
singleSelectionHeaders: [
{
Expand Down Expand Up @@ -3488,7 +3488,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
rangeSelectionHeaders: [
{
Expand Down Expand Up @@ -3558,7 +3558,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
stepSelectorEnabled: true,
},
Expand All @@ -3579,7 +3579,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
rangeSelectionEnabled: true,
},
Expand All @@ -3600,7 +3600,7 @@ describe('metrics reducers', () => {

const nextState = reducers(
beforeState,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
linkedTimeEnabled: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
import {globalSettingsLoaded} from '../../persistent_settings';
import {persistentSettingsLoaded} from '../../persistent_settings';
import * as notificationActions from './notification_center_actions';
import * as notificationReducers from './notification_center_reducers';
import {buildNotification, buildNotificationState} from './testing';
Expand Down Expand Up @@ -53,15 +53,15 @@ describe('notification reducers', () => {
});
});

describe('#globalSettingsLoaded', () => {
describe('#persistentSettingsLoaded', () => {
it('sets lastReadTimestampInMs if its related state is present', () => {
const state1 = buildNotificationState({
lastReadTimestampInMs: 0,
});

const state2 = notificationReducers.reducers(
state1,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
notificationLastReadTimeInMs: 500,
},
Expand All @@ -77,7 +77,7 @@ describe('notification reducers', () => {

const state2 = notificationReducers.reducers(
state1,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
notificationLastReadTimeInMs: NaN,
},
Expand All @@ -87,7 +87,7 @@ describe('notification reducers', () => {

const state3 = notificationReducers.reducers(
state2,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {},
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ export const persistentSettingsLoaded = createAction(
partialSettings: Partial<PersistableSettings>;
}>()
);

// TODO(b/279035032): Removes this function once internal import are renamed.
export const globalSettingsLoaded = persistentSettingsLoaded;
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
PersistentSettingsTestingDataSource,
PersistentSettingsTestingDataSourceModule,
} from '../_data_source/testing';
import {globalSettingsLoaded} from './persistent_settings_actions';
import {persistentSettingsLoaded} from './persistent_settings_actions';
import {
PersistentSettingsEffects,
TEST_ONLY,
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('persistent_settings effects test', () => {
action.next(appRoutingActions.navigating({after: buildRoute()}));

expect(actualActions).toEqual([
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
ignoreOutliers: false,
},
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('persistent_settings effects test', () => {

action.next(appRoutingActions.navigating({after: buildRoute()}));
expect(actualActions).toEqual([
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
ignoreOutliers: false,
},
Expand Down
6 changes: 1 addition & 5 deletions tensorboard/webapp/persistent_settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ limitations under the License.
==============================================================================*/

export {PersistableSettings, ThemeValue} from './_data_source/types';
// TODO(b/279035032): Removes globalSettingsLoaded export after internal import are renamed.
export {
persistentSettingsLoaded,
globalSettingsLoaded,
} from './_redux/persistent_settings_actions';
export {persistentSettingsLoaded} from './_redux/persistent_settings_actions';
export {PersistentSettingsConfigModule} from './persistent_settings_config_module';
export {PersistentSettingsModule} from './persistent_settings_module';
8 changes: 4 additions & 4 deletions tensorboard/webapp/settings/_redux/settings_reducers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
import {globalSettingsLoaded} from '../../persistent_settings';
import {persistentSettingsLoaded} from '../../persistent_settings';
import {DataLoadState} from '../../types/data';
import {createSettings, createSettingsState} from '../testing';
import * as actions from './settings_actions';
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('settings reducer', () => {
});
});

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

const nextState = reducers(
state,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
autoReloadPeriodInMs: 50000,
pageSize: 10,
Expand All @@ -195,7 +195,7 @@ describe('settings reducer', () => {

const nextState = reducers(
state,
globalSettingsLoaded({
persistentSettingsLoaded({
partialSettings: {
autoReloadPeriodInMs: 10,
pageSize: NaN,
Expand Down