Skip to content

Commit 5767947

Browse files
committed
rename cardInteractiosn to newCardInteractions
1 parent 4597dc5 commit 5767947

7 files changed

+39
-39
lines changed

tensorboard/webapp/metrics/effects/card_interaction_effects.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {Injectable} from '@angular/core';
1616
import {Action, Store, createAction} from '@ngrx/store';
1717
import {
1818
State,
19-
getCardInteractions,
19+
getNewCardInteractions,
2020
getCardMetadataMap,
2121
getPreviousCardInteractions,
2222
} from '../store';
@@ -42,7 +42,7 @@ export class CardInteractionEffects implements OnInitEffects {
4242
return initAction();
4343
}
4444

45-
private getCardInteractions$ = this.store.select(getCardInteractions).pipe(
45+
private getCardInteractions$ = this.store.select(getNewCardInteractions).pipe(
4646
// Don't get the initial state
4747
skip(1)
4848
);

tensorboard/webapp/metrics/effects/card_interactions_effects_test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {provideMockActions} from '@ngrx/effects/testing';
2424
import * as actions from '../actions';
2525
import {CardIdWithMetadata, PluginType} from '../internal_types';
2626
import {
27-
getCardInteractions,
27+
getNewCardInteractions,
2828
getCardMetadataMap,
2929
getPreviousCardInteractions,
3030
} from '../store';
@@ -117,7 +117,7 @@ describe('CardInteractions Effects', () => {
117117
effects.cardInteractionsEffect$.subscribe();
118118
expect(saveSpy).not.toHaveBeenCalled();
119119

120-
store.overrideSelector(getCardInteractions, {
120+
store.overrideSelector(getNewCardInteractions, {
121121
tagFilters: ['foo', 'bar'],
122122
pins: [
123123
{
@@ -185,7 +185,7 @@ describe('CardInteractions Effects', () => {
185185
});
186186

187187
it('merges current and previous card interactions', () => {
188-
store.overrideSelector(getCardInteractions, {
188+
store.overrideSelector(getNewCardInteractions, {
189189
pins: [card1a],
190190
clicks: [card1b],
191191
tagFilters: ['foo'],
@@ -210,7 +210,7 @@ describe('CardInteractions Effects', () => {
210210
});
211211

212212
it('does not emit duplicate cardIds', () => {
213-
store.overrideSelector(getCardInteractions, {
213+
store.overrideSelector(getNewCardInteractions, {
214214
pins: [card1a],
215215
clicks: [card1b],
216216
tagFilters: ['foo'],

tensorboard/webapp/metrics/store/metrics_reducers.ts

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ const {initialState, reducers: namespaceContextedReducer} =
404404
pins: [],
405405
clicks: [],
406406
},
407-
cardInteractions: {
407+
newCardInteractions: {
408408
tagFilters: [],
409409
pins: [],
410410
clicks: [],
@@ -741,39 +741,41 @@ const reducer = createReducer(
741741
};
742742
}),
743743
on(actions.metricsTagFilterChanged, (state, {tagFilter}) => {
744-
const nextCardInteractions = {
745-
...state.cardInteractions,
744+
const nextNewCardInteractions = {
745+
...state.newCardInteractions,
746746
};
747747
const previousTagFilter = state.tagFilter;
748748
// Ensuring we do not create redundant tag filter as the user types
749749
if (tagFilter === '') {
750-
nextCardInteractions.tagFilters = nextCardInteractions.tagFilters.slice(
751-
0,
752-
nextCardInteractions.tagFilters.length - 1
753-
);
750+
nextNewCardInteractions.tagFilters =
751+
nextNewCardInteractions.tagFilters.slice(
752+
0,
753+
nextNewCardInteractions.tagFilters.length - 1
754+
);
754755
} else if (
755756
previousTagFilter === '' ||
756-
!nextCardInteractions.tagFilters.length
757+
!nextNewCardInteractions.tagFilters.length
757758
) {
758-
nextCardInteractions.tagFilters = [
759-
...nextCardInteractions.tagFilters,
759+
nextNewCardInteractions.tagFilters = [
760+
...nextNewCardInteractions.tagFilters,
760761
tagFilter,
761762
];
762763
} else if (
763764
tagFilter.includes(previousTagFilter) ||
764765
previousTagFilter.includes(tagFilter)
765766
) {
766-
nextCardInteractions.tagFilters = nextCardInteractions.tagFilters.slice(
767-
0,
768-
nextCardInteractions.tagFilters.length - 1
769-
);
770-
nextCardInteractions.tagFilters.push(tagFilter);
767+
nextNewCardInteractions.tagFilters =
768+
nextNewCardInteractions.tagFilters.slice(
769+
0,
770+
nextNewCardInteractions.tagFilters.length - 1
771+
);
772+
nextNewCardInteractions.tagFilters.push(tagFilter);
771773
}
772774

773775
return {
774776
...state,
775777
tagFilter,
776-
cardInteractions: nextCardInteractions,
778+
cardInteractions: nextNewCardInteractions,
777779
};
778780
}),
779781
on(actions.metricsChangeTooltipSort, (state, {sort}) => {
@@ -1127,7 +1129,7 @@ const reducer = createReducer(
11271129
let nextCardMetadataMap = {...state.cardMetadataMap};
11281130
let nextCardStepIndexMap = {...state.cardStepIndex};
11291131
let nextCardStateMap = {...state.cardStateMap};
1130-
const nextCardInteractions = {...state.cardInteractions};
1132+
const nextNewCardInteractions = {...state.newCardInteractions};
11311133
const nextPreviousCardInteractions = {...state.previousCardInteractions};
11321134

11331135
if (isPinnedCopy) {
@@ -1138,7 +1140,7 @@ const reducer = createReducer(
11381140
delete nextCardMetadataMap[cardId];
11391141
delete nextCardStepIndexMap[cardId];
11401142
delete nextCardStateMap[cardId];
1141-
nextCardInteractions.pins = nextCardInteractions.pins.filter(
1143+
nextNewCardInteractions.pins = nextNewCardInteractions.pins.filter(
11421144
(cardMetadata) => originalCardId !== cardMetadata.cardId
11431145
);
11441146
nextPreviousCardInteractions.pins =
@@ -1163,12 +1165,12 @@ const reducer = createReducer(
11631165
nextCardStepIndexMap = resolvedResult.cardStepIndex;
11641166
nextCardStateMap = resolvedResult.cardStateMap;
11651167
if (
1166-
!nextCardInteractions.pins.find(
1168+
!nextNewCardInteractions.pins.find(
11671169
(metadata) => cardId === metadata.cardId
11681170
)
11691171
) {
1170-
nextCardInteractions.pins = [
1171-
...nextCardInteractions.pins,
1172+
nextNewCardInteractions.pins = [
1173+
...nextNewCardInteractions.pins,
11721174
{...nextCardMetadataMap[cardId], cardId},
11731175
];
11741176
}
@@ -1190,7 +1192,7 @@ const reducer = createReducer(
11901192
cardToPinnedCopy: nextCardToPinnedCopy,
11911193
cardToPinnedCopyCache: nextCardToPinnedCopyCache,
11921194
pinnedCardToOriginal: nextPinnedCardToOriginal,
1193-
cardInteractions: nextCardInteractions,
1195+
cardInteractions: nextNewCardInteractions,
11941196
previousCardInteractions: nextPreviousCardInteractions,
11951197
};
11961198
}),
@@ -1538,12 +1540,12 @@ const reducer = createReducer(
15381540
),
15391541
on(actions.metricsCardClicked, (state, {cardId}) => {
15401542
const nextClicksIds = new Set(
1541-
state.cardInteractions.clicks.map(({cardId}) => cardId)
1543+
state.newCardInteractions.clicks.map(({cardId}) => cardId)
15421544
);
15431545
nextClicksIds.add(cardId);
15441546

1545-
const nextCardInteractions = {
1546-
...state.cardInteractions,
1547+
const nextNewCardInteractions = {
1548+
...state.newCardInteractions,
15471549
clicks: Array.from(nextClicksIds).map((cardId) => ({
15481550
...state.cardMetadataMap[cardId],
15491551
cardId,
@@ -1552,7 +1554,7 @@ const reducer = createReducer(
15521554

15531555
return {
15541556
...state,
1555-
cardInteractions: nextCardInteractions,
1557+
newCardInteractions: nextNewCardInteractions,
15561558
};
15571559
})
15581560
);

tensorboard/webapp/metrics/store/metrics_reducers_test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ import {
4444
CardId,
4545
CardMetadata,
4646
HistogramMode,
47-
MinMaxStep,
48-
NonPinnedCardId,
4947
TooltipSort,
5048
XAxisType,
5149
} from '../types';
@@ -2884,7 +2882,7 @@ describe('metrics reducers', () => {
28842882
cardToPinnedCopyCache: new Map([['card1', expectedPinnedCopyId]]),
28852883
pinnedCardToOriginal: new Map([[expectedPinnedCopyId, 'card1']]),
28862884
timeSeriesData,
2887-
cardInteractions: {
2885+
newCardInteractions: {
28882886
pins: [
28892887
{
28902888
cardId: 'card1',

tensorboard/webapp/metrics/store/metrics_selectors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ export const getPinnedCardsWithMetadata = createSelector(
255255
}
256256
);
257257

258-
export const getCardInteractions = createSelector(
258+
export const getNewCardInteractions = createSelector(
259259
selectMetricsState,
260260
(state): CardInteractions => {
261-
return state.cardInteractions;
261+
return state.newCardInteractions;
262262
}
263263
);
264264

tensorboard/webapp/metrics/store/metrics_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export interface MetricsNonNamespacedState {
262262
*/
263263
visibleCardMap: Map<ElementId, CardId>;
264264
previousCardInteractions: CardInteractions;
265-
cardInteractions: CardInteractions;
265+
newCardInteractions: CardInteractions;
266266
}
267267

268268
export type MetricsState = NamespaceContextedState<

tensorboard/webapp/metrics/testing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function buildBlankState(): MetricsState {
112112
isSettingsPaneOpen: false,
113113
isSlideoutMenuOpen: false,
114114
tableEditorSelectedTab: DataTableMode.SINGLE,
115-
cardInteractions: {
115+
newCardInteractions: {
116116
pins: [],
117117
clicks: [],
118118
tagFilters: [],

0 commit comments

Comments
 (0)