diff --git a/tensorboard/webapp/metrics/store/metrics_reducers.ts b/tensorboard/webapp/metrics/store/metrics_reducers.ts
index f68df520a1..0fbee6deb9 100644
--- a/tensorboard/webapp/metrics/store/metrics_reducers.ts
+++ b/tensorboard/webapp/metrics/store/metrics_reducers.ts
@@ -1051,11 +1051,11 @@ const reducer = createReducer(
// Updates cardStepIndex only when toggle to enable linked time.
if (nextLinkedTimeEnabled) {
- const {min} = state.stepMinMax;
- const startStep = min === Infinity ? 0 : min;
+ const {max} = state.stepMinMax;
+ const endStep = max === -Infinity ? 0 : max;
nextLinkedTimeSelection = state.linkedTimeSelection ?? {
- start: {step: startStep},
- end: null,
+ start: null,
+ end: {step: endStep},
};
nextCardStepIndexMap = generateNextCardStepIndexFromLinkedTimeSelection(
@@ -1066,7 +1066,7 @@ const reducer = createReducer(
);
nextStepSelectorEnabled = nextLinkedTimeEnabled;
- nextRangeSelectionEnabled = Boolean(nextLinkedTimeSelection.end);
+ nextRangeSelectionEnabled = nextLinkedTimeSelection.start !== null;
}
return {
@@ -1111,17 +1111,17 @@ const reducer = createReducer(
end: {step: state.stepMinMax.max},
};
}
- if (!linkedTimeSelection.end) {
+ if (linkedTimeSelection.start === null) {
linkedTimeSelection = {
...linkedTimeSelection,
- end: {step: state.stepMinMax.max},
+ start: {step: state.stepMinMax.min},
};
}
} else {
if (linkedTimeSelection) {
linkedTimeSelection = {
...linkedTimeSelection,
- end: null,
+ start: null,
};
}
}
@@ -1135,25 +1135,25 @@ const reducer = createReducer(
}),
on(actions.timeSelectionChanged, (state, change) => {
const {cardId, timeSelection} = change;
- const nextStartStep = timeSelection.start.step;
- const nextEndStep = timeSelection.end?.step;
- const end =
- nextEndStep === undefined
+ const nextStartStep = timeSelection.start?.step;
+ const nextEndStep = timeSelection.end.step;
+ const start =
+ nextStartStep === undefined
? null
- : {step: nextStartStep > nextEndStep ? nextStartStep : nextEndStep};
+ : {step: nextStartStep < nextEndStep ? nextStartStep : nextEndStep};
let nextRangeSelectionEnabled = state.rangeSelectionEnabled;
if (state.linkedTimeEnabled) {
- // If there is no endStep then current selection state is single.
+ // If there is no startStep then current selection state is single.
// Otherwise selection state is range.
- nextRangeSelectionEnabled = nextEndStep !== undefined;
+ nextRangeSelectionEnabled = nextStartStep !== undefined;
}
const nextTimeSelection = {
- start: {
- step: nextStartStep,
+ start,
+ end: {
+ step: nextEndStep,
},
- end,
};
const nextCardStepIndexMap =
generateNextCardStepIndexFromLinkedTimeSelection(
@@ -1169,7 +1169,7 @@ const reducer = createReducer(
timeSelection: nextTimeSelection,
stepSelectionOverride: CardFeatureOverride.OVERRIDE_AS_ENABLED,
rangeSelectionOverride:
- nextTimeSelection.end?.step === undefined
+ nextTimeSelection.start?.step === undefined
? CardFeatureOverride.OVERRIDE_AS_DISABLED
: CardFeatureOverride.OVERRIDE_AS_ENABLED,
};
diff --git a/tensorboard/webapp/metrics/store/metrics_reducers_test.ts b/tensorboard/webapp/metrics/store/metrics_reducers_test.ts
index d4547f0bb6..477ca3bf6f 100644
--- a/tensorboard/webapp/metrics/store/metrics_reducers_test.ts
+++ b/tensorboard/webapp/metrics/store/metrics_reducers_test.ts
@@ -2310,8 +2310,8 @@ describe('metrics reducers', () => {
cardStateMap: {
card1: {
timeSelection: {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
},
tableExpanded: true,
},
@@ -2327,8 +2327,8 @@ describe('metrics reducers', () => {
expect(nextState.cardStateMap).toEqual({
card1: {
timeSelection: {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
},
tableExpanded: false,
},
@@ -2963,7 +2963,7 @@ describe('metrics reducers', () => {
});
});
- it('sets `end` to null from data when `endStep` is not present', () => {
+ it('sets `start` to null from data when `startStep` is not present', () => {
const before = buildMetricsState({
linkedTimeSelection: null,
stepMinMax: {min: 0, max: 100},
@@ -2972,17 +2972,17 @@ describe('metrics reducers', () => {
const after = reducers(
before,
actions.timeSelectionChanged({
- timeSelection: {start: {step: 2}, end: null},
+ timeSelection: {start: null, end: {step: 2}},
})
);
expect(after.linkedTimeSelection).toEqual({
- start: {step: 2},
- end: null,
+ start: null,
+ end: {step: 2},
});
});
- it('sets `end` when `endStep` is present', () => {
+ it('sets `start` when `startStep` is present', () => {
const before = buildMetricsState({
linkedTimeSelection: null,
stepMinMax: {min: 0, max: 100},
@@ -3004,7 +3004,7 @@ describe('metrics reducers', () => {
});
});
- it('flips `end` to `start` if new start is greater than new end', () => {
+ it('flips `start` to `end` if new end is less than new start', () => {
const beforeState = buildMetricsState({
linkedTimeSelection: null,
stepMinMax: {min: 0, max: 100},
@@ -3021,12 +3021,12 @@ describe('metrics reducers', () => {
);
expect(nextState.linkedTimeSelection).toEqual({
- start: {step: 150},
- end: {step: 150},
+ start: {step: 0},
+ end: {step: 0},
});
});
- it('sets `rangeSelectionEnabled` to true when `endStep` is present', () => {
+ it('sets `rangeSelectionEnabled` to true when `startStep` is present', () => {
const beforeState = buildMetricsState({
rangeSelectionEnabled: false,
linkedTimeEnabled: true,
@@ -3045,7 +3045,7 @@ describe('metrics reducers', () => {
expect(nextState.rangeSelectionEnabled).toEqual(true);
});
- it('sets `rangeSelectionEnabled` to true when `endStep` is 0', () => {
+ it('sets `rangeSelectionEnabled` to true when `startStep` is 0', () => {
const beforeState = buildMetricsState({
rangeSelectionEnabled: false,
linkedTimeEnabled: true,
@@ -3055,8 +3055,8 @@ describe('metrics reducers', () => {
beforeState,
actions.timeSelectionChanged({
timeSelection: {
- start: {step: 2},
- end: {step: 0},
+ start: {step: 0},
+ end: {step: 2},
},
})
);
@@ -3064,7 +3064,7 @@ describe('metrics reducers', () => {
expect(nextState.rangeSelectionEnabled).toEqual(true);
});
- it('sets `rangeSelectionEnabled` to false when only sets `startStep`', () => {
+ it('sets `rangeSelectionEnabled` to false when only sets `endStep`', () => {
const beforeState1 = buildMetricsState({
rangeSelectionEnabled: true,
linkedTimeEnabled: true,
@@ -3074,8 +3074,8 @@ describe('metrics reducers', () => {
beforeState1,
actions.timeSelectionChanged({
timeSelection: {
- start: {step: 2},
- end: null,
+ start: null,
+ end: {step: 2},
},
})
);
@@ -3130,8 +3130,8 @@ describe('metrics reducers', () => {
beforeState,
actions.timeSelectionChanged({
timeSelection: {
- start: {step: 10},
- end: null,
+ start: null,
+ end: {step: 10},
},
})
);
@@ -3170,8 +3170,8 @@ describe('metrics reducers', () => {
beforeState,
actions.timeSelectionChanged({
timeSelection: {
- start: {step: 15},
- end: null,
+ start: null,
+ end: {step: 15},
},
})
);
@@ -3192,8 +3192,8 @@ describe('metrics reducers', () => {
actions.timeSelectionChanged({
cardId: 'card2',
timeSelection: {
- start: {step: 1},
- end: null,
+ start: null,
+ end: {step: 1},
},
})
);
@@ -3202,8 +3202,8 @@ describe('metrics reducers', () => {
card1: {},
card2: {
timeSelection: {
- start: {step: 1},
- end: null,
+ start: null,
+ end: {step: 1},
},
stepSelectionOverride: CardFeatureOverride.OVERRIDE_AS_ENABLED,
rangeSelectionOverride: CardFeatureOverride.OVERRIDE_AS_DISABLED,
@@ -3254,7 +3254,7 @@ describe('metrics reducers', () => {
});
});
- it('enables card specific range selection if an end value is provided', () => {
+ it('enables card specific range selection if an start value is provided', () => {
const state1 = buildMetricsState({
cardStateMap: {
card1: {},
@@ -3361,23 +3361,23 @@ describe('metrics reducers', () => {
});
});
- it('adds linkedTimeSelection.end when toggled on, if needed', () => {
+ it('adds linkedTimeSelection.start when toggled on, if needed', () => {
const state1 = buildMetricsState({
linkedTimeSelection: {
- start: {step: 100},
- end: null,
+ start: null,
+ end: {step: 100},
},
rangeSelectionEnabled: false,
});
const state2 = reducers(state1, actions.rangeSelectionToggled({}));
expect(state2.linkedTimeSelection).toEqual({
- start: {step: 100},
- end: {step: -Infinity},
+ start: {step: Infinity},
+ end: {step: 100},
});
});
- it('removes linkedTimeSelection.end when toggled off, if needed', () => {
+ it('removes linkedTimeSelection.start when toggled off, if needed', () => {
const state1 = buildMetricsState({
linkedTimeSelection: {
start: {step: 100},
@@ -3388,8 +3388,8 @@ describe('metrics reducers', () => {
const state2 = reducers(state1, actions.rangeSelectionToggled({}));
expect(state2.linkedTimeSelection).toEqual({
- start: {step: 100},
- end: null,
+ start: null,
+ end: {step: 1000},
});
});
@@ -3612,7 +3612,7 @@ describe('metrics reducers', () => {
},
},
},
- linkedTimeSelection: {start: {step: 20}, end: null},
+ linkedTimeSelection: {start: null, end: {step: 20}},
cardStepIndex: {[imageCardId]: buildStepIndexMetadata({index: 2})},
});
@@ -3650,7 +3650,7 @@ describe('metrics reducers', () => {
},
},
},
- linkedTimeSelection: {start: {step: 20}, end: null},
+ linkedTimeSelection: {start: null, end: {step: 20}},
cardStepIndex: {[imageCardId]: buildStepIndexMetadata({index: 2})},
});
@@ -3668,8 +3668,8 @@ describe('metrics reducers', () => {
const state2 = reducers(state1, actions.linkedTimeToggled({}));
expect(state2.linkedTimeSelection).toEqual({
- start: {step: 0},
- end: null,
+ start: null,
+ end: {step: 0},
});
});
@@ -3681,24 +3681,24 @@ describe('metrics reducers', () => {
const state2 = reducers(state1, actions.linkedTimeToggled({}));
expect(state2.linkedTimeSelection).toEqual({
- start: {step: 10},
- end: null,
+ start: null,
+ end: {step: 100},
});
});
it('dose not update linkedTimeSelection on toggling when it is pre-existed', () => {
const state1 = buildMetricsState({
- linkedTimeSelection: {start: {step: 20}, end: null},
+ linkedTimeSelection: {start: null, end: {step: 20}},
});
const state2 = reducers(state1, actions.linkedTimeToggled({}));
expect(state2.linkedTimeSelection).toEqual({
- start: {step: 20},
- end: null,
+ start: null,
+ end: {step: 20},
});
});
- it('enables rangeSelection if linkedTimeSelection has an end step', () => {
+ it('enables rangeSelection if linkedTimeSelection has a start step', () => {
const state1 = buildMetricsState({
stepSelectorEnabled: true,
rangeSelectionEnabled: false,
@@ -3714,14 +3714,14 @@ describe('metrics reducers', () => {
expect(state2.linkedTimeEnabled).toBeTrue();
});
- it('does not enable rangeSelection if linkedTimeSelection does not have an end step', () => {
+ it('does not enable rangeSelection if linkedTimeSelection does not have a start step', () => {
const state1 = buildMetricsState({
stepSelectorEnabled: true,
rangeSelectionEnabled: false,
linkedTimeEnabled: false,
linkedTimeSelection: {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
},
});
diff --git a/tensorboard/webapp/metrics/store/metrics_selectors.ts b/tensorboard/webapp/metrics/store/metrics_selectors.ts
index 35dc62a2bb..c9637bcc2c 100644
--- a/tensorboard/webapp/metrics/store/metrics_selectors.ts
+++ b/tensorboard/webapp/metrics/store/metrics_selectors.ts
@@ -438,10 +438,10 @@ export const getMetricsLinkedTimeSelectionSetting = createSelector(
(state, stepMinMax): TimeSelection => {
if (!state.linkedTimeSelection) {
return {
- start: {
- step: stepMinMax.min,
+ start: null,
+ end: {
+ step: stepMinMax.max,
},
- end: null,
};
}
@@ -451,7 +451,7 @@ export const getMetricsLinkedTimeSelectionSetting = createSelector(
/**
* Returns linked time selection set by user. If linkedTime is disabled, it returns
- * `null`. Also, when range selection mode is disabled, it returns `end=null`
+ * `null`. Also, when range selection mode is disabled, it returns `start=null`
* even if it has value set.
*
* Virtually all views should use this selector.
@@ -588,8 +588,9 @@ export const getMetricsCardTimeSelection = createSelector(
globalRangeSelectionEnabled
);
- const startStep = cardState.timeSelection?.start.step ?? minMaxStep.minStep;
- const endStep = cardState.timeSelection?.end?.step ?? minMaxStep.maxStep;
+ const startStep =
+ cardState.timeSelection?.start?.step ?? minMaxStep.minStep;
+ const endStep = cardState.timeSelection?.end.step ?? minMaxStep.maxStep;
// The default time selection
return formatTimeSelection(
diff --git a/tensorboard/webapp/metrics/store/metrics_selectors_test.ts b/tensorboard/webapp/metrics/store/metrics_selectors_test.ts
index a6cba2e60c..f5fef66198 100644
--- a/tensorboard/webapp/metrics/store/metrics_selectors_test.ts
+++ b/tensorboard/webapp/metrics/store/metrics_selectors_test.ts
@@ -549,7 +549,7 @@ describe('metrics selectors', () => {
).toBeUndefined();
});
- it('uses max step as end value if none exists', () => {
+ it('uses min step as start value if none exists', () => {
const state = appStateFromMetricsState(
buildMetricsState({
...partialState,
@@ -558,12 +558,12 @@ describe('metrics selectors', () => {
card1: {
stepSelectionOverride: CardFeatureOverride.OVERRIDE_AS_ENABLED,
dataMinMax: {
- minStep: 0,
+ minStep: 5,
maxStep: 10,
},
timeSelection: {
- start: {step: 0},
- end: null,
+ start: null,
+ end: {step: 10},
},
},
},
@@ -571,7 +571,7 @@ describe('metrics selectors', () => {
);
expect(selectors.getMetricsCardTimeSelection(state, 'card1')).toEqual({
- start: {step: 0},
+ start: {step: 5},
end: {step: 10},
});
});
@@ -599,7 +599,7 @@ describe('metrics selectors', () => {
});
});
- it('removes end value if range selection is overridden as disabled', () => {
+ it('removes start value if range selection is overridden as disabled', () => {
const state = appStateFromMetricsState(
buildMetricsState({
...partialState,
@@ -610,8 +610,8 @@ describe('metrics selectors', () => {
rangeSelectionOverride:
CardFeatureOverride.OVERRIDE_AS_DISABLED,
dataMinMax: {
- minStep: 0,
- maxStep: 5,
+ minStep: 5,
+ maxStep: 10,
},
},
},
@@ -619,12 +619,12 @@ describe('metrics selectors', () => {
);
expect(selectors.getMetricsCardTimeSelection(state, 'card1')).toEqual({
- start: {step: 0},
- end: null,
+ start: null,
+ end: {step: 10},
});
});
- it('removes end value if range selection is globally disabled', () => {
+ it('removes start value if range selection is globally disabled', () => {
const state = appStateFromMetricsState(
buildMetricsState({
...partialState,
@@ -633,8 +633,8 @@ describe('metrics selectors', () => {
card1: {
stepSelectionOverride: CardFeatureOverride.OVERRIDE_AS_ENABLED,
dataMinMax: {
- minStep: 0,
- maxStep: 5,
+ minStep: 5,
+ maxStep: 10,
},
},
},
@@ -642,12 +642,12 @@ describe('metrics selectors', () => {
);
expect(selectors.getMetricsCardTimeSelection(state, 'card1')).toEqual({
- start: {step: 0},
- end: null,
+ start: null,
+ end: {step: 10},
});
});
- it('does not remove end value if range selection is overridden as enabled', () => {
+ it('does not remove start value if range selection is overridden as enabled', () => {
const state = appStateFromMetricsState(
buildMetricsState({
...partialState,
@@ -733,7 +733,7 @@ describe('metrics selectors', () => {
});
});
- it('removes end value if global range selection is disabled', () => {
+ it('removes start value if global range selection is disabled', () => {
const state = appStateFromMetricsState(
buildMetricsState({
...partialState,
@@ -750,12 +750,12 @@ describe('metrics selectors', () => {
);
expect(selectors.getMetricsCardTimeSelection(state, 'card1')).toEqual({
- start: {step: 0},
- end: null,
+ start: null,
+ end: {step: 5},
});
});
- it('maintains end value if local range selection is overridden as disabled', () => {
+ it('maintains start value if local range selection is overridden as disabled', () => {
const state = appStateFromMetricsState(
buildMetricsState({
...partialState,
@@ -1381,7 +1381,7 @@ describe('metrics selectors', () => {
selectors.getMetricsLinkedTimeSelectionSetting.release();
});
- it('returns value with start step from the dataset when linked time selection is null', () => {
+ it('returns value with end step from the dataset when linked time selection is null', () => {
const state = appStateFromMetricsState(
buildMetricsState({
linkedTimeSelection: null,
@@ -1392,8 +1392,8 @@ describe('metrics selectors', () => {
})
);
expect(selectors.getMetricsLinkedTimeSelectionSetting(state)).toEqual({
- start: {step: 0},
- end: null,
+ start: null,
+ end: {step: 1000},
});
});
diff --git a/tensorboard/webapp/metrics/store/metrics_store_internal_utils.ts b/tensorboard/webapp/metrics/store/metrics_store_internal_utils.ts
index efd57e56bc..1e2513429f 100644
--- a/tensorboard/webapp/metrics/store/metrics_store_internal_utils.ts
+++ b/tensorboard/webapp/metrics/store/metrics_store_internal_utils.ts
@@ -431,10 +431,10 @@ export function generateNextCardStepIndexFromLinkedTimeSelection(
const steps = getImageCardSteps(cardId, cardMetadataMap, timeSeriesData);
let nextStepIndexMetaData: CardStepIndexMetaData | null = null;
- if (timeSelection.end === null) {
+ if (timeSelection.start === null) {
// Single Selection
nextStepIndexMetaData = getNextImageCardStepIndexFromSingleSelection(
- timeSelection.start.step,
+ timeSelection.end.step,
steps
);
} else {
@@ -492,10 +492,10 @@ function getSelectedSteps(
) {
if (!timeSelection) return [];
- // Single selection: returns start step if matching any step in the list, otherwise returns nothing.
- if (timeSelection.end === null) {
- if (steps.indexOf(timeSelection.start.step) !== -1)
- return [timeSelection.start.step];
+ // Single selection: returns end step if matching any step in the list, otherwise returns nothing.
+ if (timeSelection.start === null) {
+ if (steps.indexOf(timeSelection.end.step) !== -1)
+ return [timeSelection.end.step];
return [];
}
@@ -511,8 +511,8 @@ function getSelectedSteps(
/**
* Gets next stepIndex for an image card based on single selection. Returns null if nothing should change.
- * @param selectedStep The selected step from linked time selection. It is equivalent to start step here
- * since there is no `end` in linked time selection when it is single seleciton.
+ * @param selectedStep The selected step from linked time selection. It is equivalent to end step here
+ * since there is no `start` in linked time selection when it is single seleciton.
*/
function getNextImageCardStepIndexFromSingleSelection(
selectedStep: number,
@@ -524,7 +524,7 @@ function getNextImageCardStepIndexFromSingleSelection(
return {index: maybeMatchedStepIndex, isClosest: false};
}
- // Checks if start step is "close" enough to a step value and move it
+ // Checks if end step is "close" enough to a step value and move it
for (let i = 0; i < steps.length - 1; i++) {
const currentStep = steps[i];
const nextStep = steps[i + 1];
diff --git a/tensorboard/webapp/metrics/store/metrics_store_internal_utils_test.ts b/tensorboard/webapp/metrics/store/metrics_store_internal_utils_test.ts
index 382e02f02c..d5bb8aaf2f 100644
--- a/tensorboard/webapp/metrics/store/metrics_store_internal_utils_test.ts
+++ b/tensorboard/webapp/metrics/store/metrics_store_internal_utils_test.ts
@@ -814,7 +814,7 @@ describe('metrics store utils', () => {
{[imageCardId]: buildStepIndexMetadata({index: 3})},
cardMetadataMap,
timeSeriesData,
- {start: {step: 20}, end: null}
+ {start: null, end: {step: 20}}
);
expect(nextCardStepIndex).toEqual({
@@ -851,7 +851,7 @@ describe('metrics store utils', () => {
},
images: {},
};
- const linkedTimeSelection = {start: {step: 20}, end: null};
+ const linkedTimeSelection = {start: null, end: {step: 20}};
const nextCardStepIndex =
generateNextCardStepIndexFromLinkedTimeSelection(
@@ -871,7 +871,7 @@ describe('metrics store utils', () => {
{[imageCardId]: buildStepIndexMetadata({index: 3})},
cardMetadataMap,
timeSeriesData,
- {start: {step: 15}, end: null}
+ {start: null, end: {step: 15}}
);
expect(nextCardStepIndex).toEqual({
@@ -1013,7 +1013,7 @@ describe('metrics store utils', () => {
describe('getSelectedSteps', () => {
it(`gets one selected step on single selection`, () => {
- const linkedTimeSelection = {start: {step: 10}, end: null};
+ const linkedTimeSelection = {start: null, end: {step: 10}};
const steps = [10];
expect(getSelectedSteps(linkedTimeSelection, steps)).toEqual([10]);
@@ -1043,7 +1043,7 @@ describe('metrics store utils', () => {
});
it(`gets empty selected steps when single linked time selection does not contain any steps`, () => {
- const linkedTimeSelection = {start: {step: 10}, end: null};
+ const linkedTimeSelection = {start: null, end: {step: 10}};
const steps = [5, 20, 30];
expect(getSelectedSteps(linkedTimeSelection, steps)).toEqual([]);
diff --git a/tensorboard/webapp/metrics/views/card_renderer/histogram_card_component.ts b/tensorboard/webapp/metrics/views/card_renderer/histogram_card_component.ts
index 1cf04ffb06..17e655e699 100644
--- a/tensorboard/webapp/metrics/views/card_renderer/histogram_card_component.ts
+++ b/tensorboard/webapp/metrics/views/card_renderer/histogram_card_component.ts
@@ -78,8 +78,8 @@ export class HistogramCardComponent {
return null;
}
return {
- start: {step: timeSelection.startStep},
- end: timeSelection.endStep ? {step: timeSelection.endStep} : null,
+ start: timeSelection.startStep ? {step: timeSelection.startStep} : null,
+ end: {step: timeSelection.endStep},
};
}
}
diff --git a/tensorboard/webapp/metrics/views/card_renderer/histogram_card_container.ts b/tensorboard/webapp/metrics/views/card_renderer/histogram_card_container.ts
index 5eb35a2e28..eb94028d07 100644
--- a/tensorboard/webapp/metrics/views/card_renderer/histogram_card_container.ts
+++ b/tensorboard/webapp/metrics/views/card_renderer/histogram_card_container.ts
@@ -54,8 +54,8 @@ import {CardRenderer} from '../metrics_view_types';
import {getTagDisplayName} from '../utils';
import {
maybeClipTimeSelectionView,
- maybeOmitTimeSelectionEnd,
- maybeSetClosestStartStep,
+ maybeOmitTimeSelectionStart,
+ maybeSetClosestEndStep,
TimeSelectionView,
} from './utils';
@@ -186,7 +186,7 @@ export class HistogramCardContainer implements CardRenderer, OnInit {
minStep = Math.min(step, minStep);
maxStep = Math.max(step, maxStep);
}
- const formattedTimeSelection = maybeOmitTimeSelectionEnd(
+ const formattedTimeSelection = maybeOmitTimeSelectionStart(
linkedTimeSelection,
rangeSelectionEnabled
);
@@ -196,7 +196,7 @@ export class HistogramCardContainer implements CardRenderer, OnInit {
maxStep
);
- return maybeSetClosestStartStep(linkedTimeSelectionView, steps);
+ return maybeSetClosestEndStep(linkedTimeSelectionView, steps);
})
);
@@ -209,8 +209,8 @@ export class HistogramCardContainer implements CardRenderer, OnInit {
linkedTimeSelection &&
linkedTimeSelectionView &&
!linkedTimeSelectionView.clipped &&
- linkedTimeSelection.end === null &&
- linkedTimeSelection.start.step !== linkedTimeSelectionView.startStep
+ linkedTimeSelection.start === null &&
+ linkedTimeSelection.end.step !== linkedTimeSelectionView.endStep
);
})
);
diff --git a/tensorboard/webapp/metrics/views/card_renderer/histogram_card_test.ts b/tensorboard/webapp/metrics/views/card_renderer/histogram_card_test.ts
index 22ac970d64..877793c4de 100644
--- a/tensorboard/webapp/metrics/views/card_renderer/histogram_card_test.ts
+++ b/tensorboard/webapp/metrics/views/card_renderer/histogram_card_test.ts
@@ -68,8 +68,8 @@ class TestableHistogramWidget {
@Input() name!: string;
@Input() data!: HistogramData;
@Input() timeSelection!: {
- start: {step: number};
- end: {step: number} | null;
+ start: {step: number} | null;
+ end: {step: number};
} | null;
@Output() onLinkedTimeToggled = new EventEmitter();
@@ -294,8 +294,8 @@ describe('histogram card', () => {
it('dispatches timeSelectionChanged when HistogramComponent emits onLinkedTimeSelectionChanged event', () => {
provideMockCardSeriesData(selectSpy, PluginType.HISTOGRAMS, 'card1');
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
});
const fixture = createHistogramCardContainer();
fixture.detectChanges();
@@ -308,15 +308,15 @@ describe('histogram card', () => {
By.directive(TestableHistogramWidget)
).componentInstance;
histogramWidget.onLinkedTimeSelectionChanged.emit({
- timeSelection: {start: {step: 5}, end: null},
+ timeSelection: {start: null, end: {step: 5}},
affordance: TimeSelectionAffordance.FOB,
});
expect(dispatchedActions).toEqual([
timeSelectionChanged({
timeSelection: {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
},
affordance: TimeSelectionAffordance.FOB,
}),
@@ -338,8 +338,8 @@ describe('histogram card', () => {
it('passes closest step linked time parameter to histogram viz', () => {
provideMockCardSeriesData(selectSpy, PluginType.HISTOGRAMS, 'card1');
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
});
const fixture = createHistogramCardContainer();
fixture.detectChanges();
@@ -349,8 +349,8 @@ describe('histogram card', () => {
);
expect(viz.componentInstance.timeSelection).toEqual({
// Steps are [0, 1, 99] in mock data
- start: {step: 1},
- end: null,
+ start: null,
+ end: {step: 1},
});
});
@@ -372,13 +372,13 @@ describe('histogram card', () => {
});
});
- it('removes end step when range selection is disabled', () => {
+ it('removes start step when range selection is disabled', () => {
provideMockCardSeriesData(
selectSpy,
PluginType.HISTOGRAMS,
'card1',
undefined,
- [buildHistogramStepData({step: 5}), buildHistogramStepData({step: 15})]
+ [buildHistogramStepData({step: 5}), buildHistogramStepData({step: 10})]
);
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
start: {step: 5},
@@ -392,8 +392,8 @@ describe('histogram card', () => {
By.directive(TestableHistogramWidget)
);
expect(viz.componentInstance.timeSelection).toEqual({
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 10},
});
});
@@ -512,8 +512,8 @@ describe('histogram card', () => {
it('renders warning when no data on the selected step', () => {
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
- start: {step: 99},
- end: null,
+ start: null,
+ end: {step: 99},
});
const fixture = createHistogramCardContainer();
fixture.detectChanges();
@@ -528,8 +528,8 @@ describe('histogram card', () => {
it('does not render warning when data exist on selected step', () => {
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
- start: {step: 100},
- end: null,
+ start: null,
+ end: {step: 100},
});
const fixture = createHistogramCardContainer();
fixture.detectChanges();
@@ -544,8 +544,8 @@ describe('histogram card', () => {
it('does not render warning when time selection is clipped', () => {
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
- start: {step: 49},
- end: null,
+ start: null,
+ end: {step: 49},
});
const fixture = createHistogramCardContainer();
fixture.detectChanges();
@@ -577,8 +577,8 @@ describe('histogram card', () => {
it('dispatches stepSelectorToggled when HistogramComponent emits the onLinkedTimeToggled event', () => {
provideMockCardSeriesData(selectSpy, PluginType.HISTOGRAMS, 'card1');
store.overrideSelector(selectors.getMetricsLinkedTimeSelection, {
- start: {step: 5},
- end: null,
+ start: null,
+ end: {step: 5},
});
const fixture = createHistogramCardContainer();
fixture.detectChanges();
diff --git a/tensorboard/webapp/metrics/views/card_renderer/image_card_component.ng.html b/tensorboard/webapp/metrics/views/card_renderer/image_card_component.ng.html
index 5badae716b..ec9c4e51fa 100644
--- a/tensorboard/webapp/metrics/views/card_renderer/image_card_component.ng.html
+++ b/tensorboard/webapp/metrics/views/card_renderer/image_card_component.ng.html
@@ -82,7 +82,7 @@