Skip to content

Commit 0848088

Browse files
authored
HParams: Add redux logic for making the runs table full screen (#6432)
## Motivation for features / changes Once we have added a bunch of more columns to the runs table we foresee users wanting to make the table full screen. ## Technical description of changes * I am not adding a test for the selector given it has no logic. This is as per a previous offline discussion * It will not be possible to drag the runs table to full screen with this implementation, but if we decide to add support for that, it should be fairly simple.
1 parent 89ea358 commit 0848088

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

tensorboard/webapp/core/actions/core_actions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ export const sideBarWidthChanged = createAction(
9393
'[Core] Side Bar Width Changed',
9494
props<{widthInPercent: number}>()
9595
);
96+
97+
export const runsTableFullScreenToggled = createAction(
98+
'[Core] Runs Table Full Screen Toggled'
99+
);

tensorboard/webapp/core/store/core_reducers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ const reducer = createReducer(
167167
}
168168

169169
return nextState;
170+
}),
171+
on(actions.runsTableFullScreenToggled, (state) => {
172+
return {
173+
...state,
174+
runsTableFullScreen: !state.runsTableFullScreen,
175+
};
170176
})
171177
);
172178

tensorboard/webapp/core/store/core_reducers_test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
import {persistentSettingsLoaded} from '../../persistent_settings';
1616
import {DataLoadState} from '../../types/data';
1717
import * as actions from '../actions';
18+
import {runsTableFullScreenToggled} from '../actions';
1819
import {
1920
buildPluginMetadata,
2021
createCoreState,
@@ -643,4 +644,17 @@ describe('core reducer', () => {
643644
expect(state4.sideBarWidthInPercent).toBe(0);
644645
});
645646
});
647+
648+
describe('#runsTableFullScreenToggled', () => {
649+
it('toggles runsTableFullScreen attribute', () => {
650+
const state = createCoreState({
651+
runsTableFullScreen: false,
652+
});
653+
const state2 = reducers(state, runsTableFullScreenToggled());
654+
const state3 = reducers(state2, runsTableFullScreenToggled());
655+
656+
expect(state2.runsTableFullScreen).toBeTrue();
657+
expect(state3.runsTableFullScreen).toBeFalse();
658+
});
659+
});
646660
});

tensorboard/webapp/core/store/core_selectors.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,10 @@ export const getSideBarWidthInPercent = createSelector(
7474
return state.sideBarWidthInPercent;
7575
}
7676
);
77+
78+
export const getRunsTableFullScreen = createSelector(
79+
selectCoreState,
80+
(state: CoreState): boolean => {
81+
return state.runsTableFullScreen;
82+
}
83+
);

tensorboard/webapp/core/store/core_types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export interface CoreState {
3838
polymerInteropRunSelection: Set<RunId>;
3939
// Number between 0 and 100.
4040
sideBarWidthInPercent: number;
41+
// Whether the runs table should occupy the full screen.
42+
runsTableFullScreen: boolean;
4143
}
4244

4345
/*
@@ -99,4 +101,5 @@ export const initialState: CoreState = {
99101
polymerInteropRuns: [],
100102
polymerInteropRunSelection: new Set(),
101103
sideBarWidthInPercent: 20,
104+
runsTableFullScreen: false,
102105
};

tensorboard/webapp/core/testing/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export function createCoreState(override?: Partial<CoreState>): CoreState {
7272
polymerInteropRuns: [],
7373
polymerInteropRunSelection: new Set(),
7474
sideBarWidthInPercent: 0,
75+
runsTableFullScreen: false,
7576
...override,
7677
};
7778
}

0 commit comments

Comments
 (0)