-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changes reorder column events to use source and destination #6733
Conversation
@@ -18,10 +18,8 @@ | |||
<tb-data-table | |||
[headers]="columnHeaders" | |||
[sortingInfo]="sortingInfo" | |||
[columnCustomizationEnabled]="columnCustomizationEnabled" |
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.
unused
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.
👏
(sortDataBy)="sortDataBy.emit($event)" | ||
(orderColumns)="orderColumns($event)" | ||
(removeColumn)="removeColumn.emit($event)" |
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.
scalar tables shouldn't be able to remove columns, just hide them. But there will be no functional change atm because this is currently disabled.
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.
Once the scalar card show hparam columns I would expect to be able to remove them from there.
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 agree that showing both "hide" and "remove" buttons is also reasonable, but showing both in the same context menu might make a lot of users wondering what the difference is. Meanwhile, allowing only one of these functionalities per table might make the distinction a bit clearer.
In any case, I think it's important to gather more feedback from the team and from users on what the ideal context menu setup should be. It should be trivial to add/remove items later as necessary.
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.
We definitely shouldn't show both in the same context menu. I'm not sure splitting the functionality by table will be clearer for users.
@@ -21,16 +21,16 @@ | |||
(selectedTabChange)="tabChange($event)" | |||
> | |||
<mat-tab [label]="'Single'"> | |||
<ngContext |
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.
ngContext doesn't seem to be a valid directive? replaced with ng-container, which is.
@@ -48,16 +56,27 @@ import {DataTableMode} from '../../../../widgets/data_table/types'; | |||
export class ScalarColumnEditorContainer { | |||
constructor(private readonly store: Store<State>) {} | |||
|
|||
readonly singleHeaders$ = this.store.select(getSingleSelectionHeaders); | |||
readonly rangeHeaders$ = this.store.select(getRangeSelectionHeaders); | |||
readonly singleHeaders$ = this.store |
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.
runs are now hidden in the edit menu so they will no longer be sortable or hidable
@@ -235,7 +235,8 @@ export class OSSSettingsConverter extends SettingsConverter< | |||
if ( | |||
Array.isArray(backendSettings.singleSelectionHeaders) && | |||
// If the settings stored in the backend are invalid, reset back to default. | |||
backendSettings.singleSelectionHeaders[0].name !== undefined | |||
backendSettings.singleSelectionHeaders[0].name !== undefined && | |||
backendSettings.singleSelectionHeaders[0].type === 'RUN' |
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.
adds check when loading from existing localstorage as downstream sorting logic depends on RUN being first
return newColumns; | ||
} | ||
|
||
export const DataTableUtils = { |
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 export style is ugly, but necessary due to #5991
(state, {source, destination, side, dataTableMode}) => { | ||
let headers = | ||
dataTableMode === DataTableMode.RANGE | ||
? [...state.rangeSelectionHeaders] |
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.
Previously the headers were retrieved from the action, now they are being retrieved from the current state. How can the headers ever change?
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.
To clarify:
dataTableColumnEdited
is currently only used for reordering- runs and hparams features already define separate actions for reordering and adding (e.g.
runsTableHeaderAdded
,runsTableHeaderOrderChanged
)
To prevent confusion (and for consistency) I'll change dataTableColumnEdited
-> dataTableColumnOrderChanged
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.
(a separate dataTableColumnAdded
action will be added in an upcoming PR)
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.
In that case can you headers
from the props?
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.
Wait sorry - I need to correct myself. I did add a dataTableColumnAdded
in #6737, but it's unused because we don't actually have a feature for adding standard columns, only hparam columns. Thus, only the hparams action dashboardHparamColumnAdded
will be used to add new columns.
Regarding passing headers
to the props, I propose that an action signature like dashboardHparamColumnAdded, i.e. only specifying {column, nextTo, side} and letting the reducer figure out how put it in the right place, is more in line with redux best practices, which advocate putting logic in reducers, not components; passing in headers via the action implies that the component must do some data manipulation first.
(Note that the previously implemented runs table add action already uses the "put logic in reducers" pattern, albeit with a slightly different signature.)
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 fully agree with everything in this statement.
The thing that I find confusing is that the action dataTableColumnEdited takes HeaderEditInfo as props which has an unused attribute headers
tensorboard/webapp/metrics/views/card_renderer/scalar_card_container.ts
Outdated
Show resolved
Hide resolved
...board/webapp/metrics/views/right_pane/scalar_column_editor/scalar_column_editor_component.ts
Outdated
Show resolved
Hide resolved
...board/webapp/metrics/views/right_pane/scalar_column_editor/scalar_column_editor_component.ts
Outdated
Show resolved
Hide resolved
...board/webapp/metrics/views/right_pane/scalar_column_editor/scalar_column_editor_container.ts
Outdated
Show resolved
Hide resolved
...board/webapp/metrics/views/right_pane/scalar_column_editor/scalar_column_editor_container.ts
Outdated
Show resolved
Hide resolved
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.
Thanks for sticking with this. I would really like to see the props changed on dataTableColumnEdited
but otherwise things look pretty good.
go/small-cls
Ack -
Yeah my bad, I didn't realize the code would get so bloated after tests 😭 I'll take care to make them smaller next time. Thanks btw for the comprehensive reviews on these huge batches of code! |
## Motivation for features / changes Recently merged hparam column PRs (#6732, #6733, #6736) will cause build and lint errors during 1p sync. ## Technical description of changes - import map from rxjs/operators instead of rxjs - `DataTableUtils` -> `dataTableUtils` - use proper string signature on CardStateMap in tests
Motivation for features / changes
To prepare for showing shared hparam columns across runs and scalar tables, we need to unify the column re-ordering logic to use the same source/destination parameters (introduced in #6727).
Technical description of changes
misc:
Detailed steps to verify changes work correctly (as executed by you)