Skip to content

Commit 6bbcf4c

Browse files
authored
HParams: Allow an input to force use of legacy table (#6477)
## Motivation for features / changes We will soon be flipping the flag to enable the RunsDataTable. However, this new table does not work on the hosted experiments list page. This allows that page(which is internal only) to force the runs table to use the old table so we do not break that feature. ## Detailed steps to verify changes work correctly (as executed by you) I ran this code internally first and used it to fix the problem. Then copied it out to OSS.
1 parent 3c2e7f1 commit 6bbcf4c

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

tensorboard/webapp/runs/views/runs_table/runs_table_container.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ function matchFilter(
239239
selector: 'runs-table',
240240
template: `
241241
<runs-table-component
242-
*ngIf="!HParamsEnabled.value"
242+
*ngIf="!useDataTable()"
243243
[experimentIds]="experimentIds"
244244
[useFlexibleLayout]="useFlexibleLayout"
245245
[numSelectedItems]="numSelectedItems$ | async"
@@ -267,7 +267,7 @@ function matchFilter(
267267
(onMetricFilterChanged)="onMetricFilterChanged($event)"
268268
></runs-table-component>
269269
<runs-data-table
270-
*ngIf="HParamsEnabled.value"
270+
*ngIf="useDataTable()"
271271
[headers]="runsColumns$ | async"
272272
[data]="sortedRunsTableData$ | async"
273273
[selectableColumns]="selectableColumns$ | async"
@@ -347,11 +347,12 @@ export class RunsTableContainer implements OnInit, OnDestroy {
347347

348348
@Input() experimentIds!: string[];
349349
@Input() showHparamsAndMetrics = false;
350+
@Input() forceLegacyTable = false;
350351

351352
sortOption$ = this.store.select(getRunSelectorSort);
352353
paginationOption$ = this.store.select(getRunSelectorPaginationOption);
353354
regexFilter$ = this.store.select(getRunSelectorRegexFilter);
354-
HParamsEnabled = new BehaviorSubject<boolean>(false);
355+
hparamsEnabled = new BehaviorSubject<boolean>(false);
355356
runsColumns$ = this.store.select(getRunsTableHeaders);
356357
runsTableFullScreen$ = this.store.select(getRunsTableFullScreen);
357358

@@ -395,7 +396,7 @@ export class RunsTableContainer implements OnInit, OnDestroy {
395396

396397
ngOnInit() {
397398
this.store.select(getEnableHparamsInTimeSeries).subscribe((enabled) => {
398-
this.HParamsEnabled.next(enabled);
399+
this.hparamsEnabled.next(enabled);
399400
});
400401
const getRunTableItemsPerExperiment = this.experimentIds.map((id) =>
401402
this.getRunTableItemsForExperiment(id)
@@ -816,6 +817,10 @@ export class RunsTableContainer implements OnInit, OnDestroy {
816817
orderColumns(newHeaderOrder: ColumnHeader[]) {
817818
this.store.dispatch(runsTableHeaderOrderChanged({newHeaderOrder}));
818819
}
820+
821+
useDataTable() {
822+
return this.hparamsEnabled.value && !this.forceLegacyTable;
823+
}
819824
}
820825

821826
export const TEST_ONLY = {

tensorboard/webapp/runs/views/runs_table/runs_table_test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ describe('runs_table', () => {
174174
function createComponent(
175175
experimentIds: string[],
176176
columns?: RunsTableColumn[],
177-
usePagination?: boolean
177+
usePagination?: boolean,
178+
forceLegacyTable?: boolean
178179
) {
179180
const fixture = TestBed.createComponent(RunsTableContainer);
180181
fixture.componentInstance.experimentIds = experimentIds;
@@ -184,6 +185,7 @@ describe('runs_table', () => {
184185
if (usePagination !== undefined) {
185186
fixture.componentInstance.usePagination = usePagination;
186187
}
188+
fixture.componentInstance.forceLegacyTable = forceLegacyTable ?? false;
187189
fixture.detectChanges();
188190

189191
return fixture;
@@ -3198,6 +3200,16 @@ describe('runs_table', () => {
31983200
).toBeFalsy();
31993201
});
32003202

3203+
it('renders legacy table when forceLegacyTable is true', () => {
3204+
const fixture = createComponent(['book'], [], false, true);
3205+
expect(
3206+
fixture.debugElement.query(By.directive(RunsDataTable))
3207+
).toBeFalsy();
3208+
expect(
3209+
fixture.nativeElement.querySelector('runs-table-component')
3210+
).toBeTruthy();
3211+
});
3212+
32013213
it('passes run name, selected value, and color to data table', () => {
32023214
// To make sure we only return the runs when called with the right props.
32033215
const selectSpy = spyOn(store, 'select').and.callThrough();

0 commit comments

Comments
 (0)