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

step selector: add control to settings panel behind feature flag #5734

Merged
merged 3 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 18 additions & 0 deletions tensorboard/webapp/metrics/views/right_pane/right_pane_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('metrics right_pane', () => {
store.overrideSelector(selectors.getIsFeatureFlagsLoaded, true);
store.overrideSelector(selectors.getIsMetricsImageSupportEnabled, true);
store.overrideSelector(selectors.getIsLinkedTimeEnabled, false);
store.overrideSelector(selectors.getIsDataTableEnabled, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see a test that shows it does not render when this is false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Added.

store.overrideSelector(selectors.getEnabledCardWidthSetting, false);
store.overrideSelector(selectors.getMetricsCardMinWidth, null);
store.overrideSelector(selectors.getMetricsSelectTimeEnabled, false);
Expand Down Expand Up @@ -524,5 +525,22 @@ describe('metrics right_pane', () => {
});
});
});

describe('step selector feature enabled', () => {
beforeEach(() => {
store.overrideSelector(selectors.getIsDataTableEnabled, true);
});

it('renders', () => {
const fixture = TestBed.createComponent(SettingsViewContainer);
fixture.detectChanges();

expect(
select(fixture, '.scalars-step-selector input').attributes[
'aria-checked'
]
).toBe('false');
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ <h3 class="section-title">Scalars</h3>
>
</div>

<div
class="control-row scalars-step-selector"
*ngIf="isScalarStepSelectorEnabled"
>
<mat-checkbox
[checked]="stepSelectorEnabled"
(change)="stepSelectorEnableToggled.emit()"
>Step Selector</mat-checkbox
>
</div>

<div class="control-row scalars-partition-x">
<mat-checkbox
[checked]="scalarPartitionX"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class SettingsViewComponent {

@Input() isCardWidthSettingEnabled!: boolean;
@Input() isLinkedTimeFeatureEnabled!: boolean;
@Input() isScalarStepSelectorEnabled!: boolean;
@Input() selectTimeEnabled!: boolean;
@Input() useRangeSelectTime!: boolean;
@Input() selectedTime!: LinkedTime | null;
Expand All @@ -73,6 +74,8 @@ export class SettingsViewComponent {
@Output() selectTimeEnableToggled = new EventEmitter<void>();
@Output() selectTimeChanged = new EventEmitter<LinkedTime>();

@Output() stepSelectorEnableToggled = new EventEmitter<void>();

@Input() isImageSupportEnabled!: boolean;

readonly TooltipSortDropdownOptions: DropdownOption[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ import {HistogramMode, LinkedTime, TooltipSort, XAxisType} from '../../types';
[imageShowActualSize]="imageShowActualSize$ | async"
(imageShowActualSizeChanged)="onImageShowActualSizeChanged()"
[isLinkedTimeFeatureEnabled]="isLinkedTimeFeatureEnabled$ | async"
[isScalarStepSelectorEnabled]="isScalarStepSelectorEnabled$ | async"
[selectTimeEnabled]="selectTimeEnabled$ | async"
[selectedTime]="selectedTime$ | async"
[useRangeSelectTime]="useRangeSelectTime$ | async"
[stepMinMax]="stepMinMax$ | async"
(selectTimeEnableToggled)="onSelectTimeEnableToggled()"
(selectTimeChanged)="onSelectTimeChanged($event)"
(stepSelectorEnableToggled)="onStepSelectorEnableToggled()"
>
</metrics-dashboard-settings-component>
`,
Expand All @@ -87,6 +89,8 @@ export class SettingsViewContainer {
readonly isLinkedTimeFeatureEnabled$: Observable<boolean> = this.store.select(
selectors.getIsLinkedTimeEnabled
);
readonly isScalarStepSelectorEnabled$: Observable<boolean> =
this.store.select(selectors.getIsDataTableEnabled);
readonly selectTimeEnabled$: Observable<boolean> = this.store.select(
selectors.getMetricsSelectTimeEnabled
);
Expand Down Expand Up @@ -192,6 +196,10 @@ export class SettingsViewContainer {
this.store.dispatch(selectTimeEnableToggled());
}

onStepSelectorEnableToggled() {
// TODO(japie1235813): Dispatch toggled event to update ngrx state.
}

onSelectTimeChanged(newValue: LinkedTime) {
this.store.dispatch(
timeSelectionChanged({
Expand Down