Skip to content

Commit 3f018be

Browse files
authored
Linked Time: Fix issue with prospective fob when axis is not step (#6022)
* Motivation for features / changes There is a bug (that cannot currently be replicated) when the `enableProspectiveFob` feature is enabled where a prospective fob will appear even when the axis is not in `STEP` * Screenshots of UI changes NONE * Detailed steps to verify changes work correctly (as executed by you) 1) Go to the future ![image](https://user-images.githubusercontent.com/78179109/199848607-1c1cf9fa-83da-45b4-b928-8fa4b5355204.png) 2) Start tensorboard 3) Go to http://localhost:6006?allowRangeSelection=true 4) Change the horizontal axis to anything other than STEP 5) Hover your cursor on the X Axis of a scalar card chart 6) Assert nothing happens?
1 parent 20898b1 commit 3f018be

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

tensorboard/webapp/metrics/views/card_renderer/scalar_card_component.ng.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
</table>
169169
</ng-template>
170170
</div>
171-
<ng-container *ngIf="inTimeSelectionMode()">
171+
<ng-container *ngIf="showDataTable()">
172172
<div class="data-table-container">
173173
<scalar-card-data-table
174174
[chartMetadataMap]="chartMetadataMap"
@@ -187,7 +187,7 @@
187187
let-domDim="domDimension"
188188
let-xScale="xScale"
189189
>
190-
<ng-container *ngIf="inTimeSelectionMode() || isProspectiveFobFeatureEnabled">
190+
<ng-container *ngIf="showFobController()">
191191
<scalar-card-fob-controller
192192
[timeSelection]="stepOrLinkedTimeSelection"
193193
[scale]="xScale"

tensorboard/webapp/metrics/views/card_renderer/scalar_card_component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,18 @@ export class ScalarCardComponent<Downloader> {
221221
this.onStepSelectorToggled.emit(TimeSelectionToggleAffordance.FOB_DESELECT);
222222
}
223223

224-
inTimeSelectionMode(): boolean {
224+
showDataTable() {
225225
return (
226226
this.xAxisType === XAxisType.STEP &&
227227
this.stepOrLinkedTimeSelection !== null
228228
);
229229
}
230+
231+
showFobController() {
232+
return (
233+
this.xAxisType === XAxisType.STEP &&
234+
(this.stepOrLinkedTimeSelection !== null ||
235+
this.isProspectiveFobFeatureEnabled)
236+
);
237+
}
230238
}

tensorboard/webapp/metrics/views/card_renderer/scalar_card_test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,20 +2378,18 @@ describe('scalar card', () => {
23782378
}));
23792379

23802380
it('does not render fobs when no timeSelection is provided', fakeAsync(() => {
2381-
store.overrideSelector(getMetricsLinkedTimeSelection, {
2382-
start: {step: 20},
2383-
end: null,
2384-
});
2381+
store.overrideSelector(getMetricsLinkedTimeSelection, null);
23852382
store.overrideSelector(
23862383
selectors.getIsLinkedTimeProspectiveFobEnabled,
23872384
true
23882385
);
23892386
const fixture = createComponent('card1');
23902387
fixture.detectChanges();
23912388
const fobController = fixture.debugElement.query(
2392-
By.directive(CardFobComponent)
2389+
By.directive(CardFobControllerComponent)
23932390
).componentInstance;
23942391

2392+
expect(fobController).toBeDefined();
23952393
expect(fobController.startFobWrapper).toBeUndefined();
23962394
expect(fobController.endFobWrapper).toBeUndefined();
23972395
}));
@@ -3192,10 +3190,6 @@ describe('scalar card', () => {
31923190
aliasText: 'a',
31933191
aliasNumber: 1,
31943192
};
3195-
console.log(
3196-
'ChartMetadatMap: ',
3197-
scalarCardDataTable.componentInstance.chartMetadataMap
3198-
);
31993193
fixture.detectChanges();
32003194

32013195
const data =
@@ -3245,6 +3239,10 @@ describe('scalar card', () => {
32453239
}));
32463240

32473241
it('Does not render fobs when axis type is RELATIVE', fakeAsync(() => {
3242+
store.overrideSelector(
3243+
selectors.getIsLinkedTimeProspectiveFobEnabled,
3244+
true
3245+
);
32483246
store.overrideSelector(
32493247
selectors.getMetricsXAxisType,
32503248
XAxisType.RELATIVE
@@ -3258,6 +3256,10 @@ describe('scalar card', () => {
32583256
}));
32593257

32603258
it('Does not render fobs when axis type is WALL_TIME', fakeAsync(() => {
3259+
store.overrideSelector(
3260+
selectors.getIsLinkedTimeProspectiveFobEnabled,
3261+
true
3262+
);
32613263
store.overrideSelector(
32623264
selectors.getMetricsXAxisType,
32633265
XAxisType.WALL_TIME

0 commit comments

Comments
 (0)