Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initializer of instance members that reference identifiers declar… #6882

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 15 additions & 13 deletions tensorboard/webapp/metrics/views/main_view/card_groups_container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,20 @@ import {getSortedRenderableCardIdsWithMetadata} from './common_selectors';
export class CardGroupsContainer {
@Input() cardObserver!: CardObserver;

constructor(private readonly store: Store<State>) {}
constructor(private readonly store: Store<State>) {
this.cardGroups$ = this.store
.select(getSortedRenderableCardIdsWithMetadata)
.pipe(
combineLatestWith(this.store.select(getMetricsFilteredPluginTypes)),
map(([cardList, filteredPlugins]) => {
if (!filteredPlugins.size) return cardList;
return cardList.filter((card) => {
return filteredPlugins.has(card.plugin);
});
}),
map((cardList) => groupCardIdWithMetdata(cardList))
);
}

readonly cardGroups$: Observable<CardGroup[]> = this.store
.select(getSortedRenderableCardIdsWithMetadata)
.pipe(
combineLatestWith(this.store.select(getMetricsFilteredPluginTypes)),
map(([cardList, filteredPlugins]) => {
if (!filteredPlugins.size) return cardList;
return cardList.filter((card) => {
return filteredPlugins.has(card.plugin);
});
}),
map((cardList) => groupCardIdWithMetdata(cardList))
);
readonly cardGroups$: Observable<CardGroup[]>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ import {getSortedRenderableCardIdsWithMetadata} from './common_selectors';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class EmptyTagMatchMessageContainer {
constructor(private readonly store: Store<State>) {}
constructor(private readonly store: Store<State>) {
this.pluginTypes$ = this.store.select(getMetricsFilteredPluginTypes);
this.tagFilterRegex$ = this.store.select(getMetricsTagFilter);
this.tagCounts$ = this.store
.select(getSortedRenderableCardIdsWithMetadata)
.pipe(
map((cardList) => {
return new Set(cardList.map(({tag}) => tag)).size;
}),
);
}

readonly pluginTypes$: Observable<Set<PluginType>> = this.store.select(
getMetricsFilteredPluginTypes
);
readonly tagFilterRegex$: Observable<string> =
this.store.select(getMetricsTagFilter);
readonly tagCounts$: Observable<number> = this.store
.select(getSortedRenderableCardIdsWithMetadata)
.pipe(
map((cardList) => {
return new Set(cardList.map(({tag}) => tag)).size;
})
);
readonly pluginTypes$: Observable<Set<PluginType>>;
readonly tagFilterRegex$: Observable<string>;
readonly tagCounts$: Observable<number>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ export class MainViewComponent {
@Optional()
@Inject(SHARE_BUTTON_COMPONENT)
readonly customShareButton: Type<Component>
) {}
) {
this.cardObserver = new CardObserver(
this.host.nativeElement,
'600px 0px 600px 0px'
);
}

readonly PluginType = PluginType;

/**
* Load cards that are not yet visible, if they are roughly 1 card row away in
* scroll distance.
*/
readonly cardObserver = new CardObserver(
this.host.nativeElement,
'600px 0px 600px 0px'
);
readonly cardObserver;
}
62 changes: 31 additions & 31 deletions tensorboard/webapp/metrics/views/main_view/main_view_container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,42 +51,42 @@ import {PluginType} from '../../types';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MainViewContainer {
constructor(private readonly store: Store<State>) {}

readonly isSidepaneOpen$: Observable<boolean> = this.store.select(
isMetricsSettingsPaneOpen
);

readonly initialTagsLoading$: Observable<boolean> = this.store
.select(getMetricsTagMetadataLoadState)
.pipe(
// disconnect and don't listen to store if tags are loaded at least once.
takeWhile((loadState) => {
return loadState.lastLoadedTimeInMs === null;
}, true /** inclusive */),
map((loadState) => {
return (
loadState.state === DataLoadState.LOADING &&
loadState.lastLoadedTimeInMs === null
);
})
);

readonly showFilteredView$: Observable<boolean> = this.store
.select(getMetricsTagFilter)
.pipe(
constructor(private readonly store: Store<State>) {
this.isSidepaneOpen$ = this.store.select(isMetricsSettingsPaneOpen);
this.initialTagsLoading$ = this.store
.select(getMetricsTagMetadataLoadState)
.pipe(
// disconnect and don't listen to store if tags are loaded at least once.
takeWhile((loadState) => {
return loadState.lastLoadedTimeInMs === null;
}, true /** inclusive */),
map((loadState) => {
return (
loadState.state === DataLoadState.LOADING &&
loadState.lastLoadedTimeInMs === null
);
}),
);
this.showFilteredView$ = this.store.select(getMetricsTagFilter).pipe(
map((filter) => {
return filter.length > 0;
})
}),
);
this.filteredPluginTypes$ = this.store.select(
getMetricsFilteredPluginTypes,
);
this.isSlideoutMenuOpen$ = this.store.select(isMetricsSlideoutMenuOpen);
}

readonly isSidepaneOpen$: Observable<boolean>;

readonly initialTagsLoading$: Observable<boolean>;

readonly showFilteredView$: Observable<boolean>;

readonly filteredPluginTypes$ = this.store.select(
getMetricsFilteredPluginTypes
);
readonly filteredPluginTypes$;

readonly isSlideoutMenuOpen$: Observable<boolean> = this.store.select(
isMetricsSlideoutMenuOpen
);
readonly isSlideoutMenuOpen$: Observable<boolean>;

onSettingsButtonClicked() {
this.store.dispatch(metricsSettingsPaneToggled());
Expand Down
Loading