nytai commented on a change in pull request #10298:
URL:
https://github.com/apache/incubator-superset/pull/10298#discussion_r455170161
##########
File path: superset-frontend/src/views/datasetList/DatasetList.tsx
##########
@@ -532,50 +567,64 @@ const DatasetList: FunctionComponent<DatasetListProps> =
({
onConfirm={handleBulkDatasetDelete}
>
{confirmDelete => {
- const bulkActions = [];
- if (canDelete()) {
- bulkActions.push({
- key: 'delete',
- name: (
- <>
- <i className="fa fa-trash" /> {t('Delete')}
- </>
- ),
- onSelect: confirmDelete,
- });
- }
+ const bulkActions: ListViewProps['bulkActions'] = canDelete
+ ? [
+ {
+ key: 'delete',
+ name: t('Delete'),
+ onSelect: confirmDelete,
+ type: 'danger',
+ },
+ ]
+ : [];
+
return (
- <>
- {datasetCurrentlyDeleting && (
- <DeleteModal
- description={t(
- `The dataset ${datasetCurrentlyDeleting.table_name} is
linked to
- ${datasetCurrentlyDeleting.chart_count} charts that appear
on
- ${datasetCurrentlyDeleting.dashboard_count} dashboards.
- Are you sure you want to continue? Deleting the dataset will
break
- those objects.`,
- )}
- onConfirm={() =>
- handleDatasetDelete(datasetCurrentlyDeleting)
- }
- onHide={closeDatasetDeleteModal}
- open
- title={t('Delete Dataset?')}
- />
- )}
- <ListView
- className="dataset-list-view"
- columns={columns}
- data={datasets}
- count={datasetCount}
- pageSize={PAGE_SIZE}
- fetchData={fetchData}
- loading={loading}
- initialSort={initialSort}
- filters={currentFilters}
- bulkActions={bulkActions}
- />
- </>
+ <ListView
+ className="dataset-list-view"
+ columns={columns}
+ data={datasets}
+ count={datasetCount}
+ pageSize={PAGE_SIZE}
+ fetchData={fetchData}
+ loading={loading}
+ initialSort={initialSort}
+ filters={currentFilters}
+ bulkActions={bulkActions}
+ bulkSelectEnabled={bulkSelectEnabled}
+ disableBulkSelect={() => setBulkSelectEnabled(false)}
+ renderBulkSelectCopy={selected => {
+ const { virtualCount, physicalCount } = selected.reduce(
+ (acc, e) => {
+ if (e.original.kind === 'physical') acc.physicalCount += 1;
+ else if (e.original.kind === 'virtual')
+ acc.virtualCount += 1;
+ return acc;
+ },
+ { virtualCount: 0, physicalCount: 0 },
+ );
+
+ if (!selected.length) return t('0 Selected');
+ else if (virtualCount && !physicalCount)
+ return t(
+ '%s Selected (Virtual)',
+ selected.length,
+ virtualCount,
+ );
+ else if (physicalCount && !virtualCount)
+ return t(
+ '%s Selected (Physical)',
+ selected.length,
+ physicalCount,
+ );
Review comment:
I agree with this, I'd be in favor of turning
https://eslint.org/docs/rules/curly on
----------------------------------------------------------------
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]