-
Notifications
You must be signed in to change notification settings - Fork 1.7k
HParam UI: Replace RunsTableComponent with DataTable widget behind flag #6394
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
HParam UI: Replace RunsTableComponent with DataTable widget behind flag #6394
Conversation
201f55e to
7d25a86
Compare
| let selectSpy: jasmine.Spy; | ||
|
|
||
| // To make sure we only return the runs when called with the right props. | ||
| selectSpy = spyOn(store, 'select').and.callThrough(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
| selectSpy = spyOn(store, 'select').and.callThrough(); | |
| const selectSpy = spyOn(store, 'select').and.callThrough(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| let selectSpy: jasmine.Spy; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
| let selectSpy: jasmine.Spy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| sortOption$ = this.store.select(getRunSelectorSort); | ||
| paginationOption$ = this.store.select(getRunSelectorPaginationOption); | ||
| regexFilter$ = this.store.select(getRunSelectorRegexFilter); | ||
| HParamsEnabled = new BehaviorSubject<boolean>(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be a BehaviorSubject? It seems much more complicated this way
| HParamsEnabled = new BehaviorSubject<boolean>(false); | |
| hparamsEnabled$ = this.store.select(getEnableHparamsInTimeSeries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think I could use an observable as a value in this component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing the *ngIf with an async pipe. It did not work. Leaving it as is.
| private getRunTableDataForExperiment( | ||
| experimentId: string | ||
| ): Observable<TableData[]> { | ||
| return combineLatest([ | ||
| this.store.select(getRuns, {experimentId}), | ||
| this.store.select(getRunColorMap), | ||
| ]).pipe( | ||
| map(([runs, colorMap]) => { | ||
| return runs.map((run) => { | ||
| const tableData: TableData = { | ||
| id: run.id, | ||
| color: colorMap[run.id], | ||
| }; | ||
| this.runsColumns.forEach((column) => { | ||
| switch (column.type) { | ||
| case ColumnHeaderType.RUN: | ||
| tableData[column.name!] = run.name; | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| }); | ||
| return tableData; | ||
| }); | ||
| }) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a selector, but I don't mind it being this way for now (until I get my generalized selector checked in).
Could this at least be a lot shorter?
| private getRunTableDataForExperiment( | |
| experimentId: string | |
| ): Observable<TableData[]> { | |
| return combineLatest([ | |
| this.store.select(getRuns, {experimentId}), | |
| this.store.select(getRunColorMap), | |
| ]).pipe( | |
| map(([runs, colorMap]) => { | |
| return runs.map((run) => { | |
| const tableData: TableData = { | |
| id: run.id, | |
| color: colorMap[run.id], | |
| }; | |
| this.runsColumns.forEach((column) => { | |
| switch (column.type) { | |
| case ColumnHeaderType.RUN: | |
| tableData[column.name!] = run.name; | |
| break; | |
| default: | |
| break; | |
| } | |
| }); | |
| return tableData; | |
| }); | |
| }) | |
| ); | |
| } | |
| const runColumnName = this.runColumns.find((column) => column.type === ColumnHeaderType.RUN).name; | |
| return runs.map((run) => ({ | |
| id: run.id, | |
| color: colorMap[run.id], | |
| [runColumnName]: run.name | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather leave it as is. It is more extensible this way for other columns. I definitely see this being moved to a selector. However, the selector would be similar to this structure to accommodate all columns instead of just run.
205698f to
ca064cd
Compare
## Motivation for features / changes As part the effort to add hparams to time series we have updated the runs table to use the data table in #6394. Now I am updating the runs data table to read its columns from the redux state. ## Screenshots of UI changes (or N/A) N/A (but there will be soon!) ## Alternate designs / implementations considered (or N/A) We could have reused the existing sorting property in redux and added keys to it, but I prefered to create a seperate one and remove the existing property when we remove the old runs table.
Motivation for features / changes
We are adding lots of functionality to the scalar data table and the runs table. For consistency and reuse we are replacing the table in the runs table with a DataTable widget. This is the first step towards that change.
Technical description of changes
Besides the data all the values which are passed in are hard coded into the runs_table_container. This is done so that we have a data table to work with quickly and unblock some other work. These values will be set up in ngrx in future PRs.
Screenshots of UI changes (or N/A)
We have a plan to restyle this table for the Runs Table. However, that will come later. For now it is just the standard data table which looks like this.

Alternate designs / implementations considered (or N/A)
We considered leaving the runs table and adding all features to both.