nytai commented on a change in pull request #10094:
URL:
https://github.com/apache/incubator-superset/pull/10094#discussion_r442998604
##########
File path: superset-frontend/src/views/dashboardList/DashboardList.tsx
##########
@@ -508,71 +510,68 @@ class DashboardList extends React.PureComponent<Props,
State> {
dashboardToEdit,
} = this.state;
return (
- <div className="container welcome">
- <Panel>
- <Panel.Body>
- <ConfirmStatusChange
- title={t('Please confirm')}
- description={t(
- 'Are you sure you want to delete the selected dashboards?',
- )}
- onConfirm={this.handleBulkDashboardDelete}
- >
- {confirmDelete => {
- const bulkActions = [];
- if (this.canDelete) {
- bulkActions.push({
- key: 'delete',
- name: (
- <>
- <i className="fa fa-trash" /> Delete
- </>
- ),
- onSelect: confirmDelete,
- });
- }
- if (this.canExport) {
- bulkActions.push({
- key: 'export',
- name: (
- <>
- <i className="fa fa-database" /> Export
- </>
- ),
- onSelect: this.handleBulkDashboardExport,
- });
- }
- return (
+ <>
Review comment:
Something that comes to mind as a flexible solution that would allow
customization across the different views is a BaseListViewPage component that
these could inherit from and override certain methods as needed. This would
remove some of the code redundancies while allowing flexibility in overriding
certain behavior. I generally try to avoid inheritance in JS when possible, but
it seems like there's a case for it here. Thoughts?
Another approach might be to move this into hooks, ie `usePermissions`,
`useFetchListData`, etc. though I'm not convinced this will really remove that
much code redundancy
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]