mirror of https://github.com/apache/superset.git
fix(listview): hide actions column if no actions are allowed (#11337)
This commit is contained in:
parent
cae54ac00e
commit
225c905bd5
|
@ -47,6 +47,10 @@ const TableWrapper = styled.div`
|
|||
`;
|
||||
|
||||
const TableStyles = styled.div`
|
||||
table {
|
||||
background-color: ${({ theme }) => theme.colors.grayscale.light4};
|
||||
}
|
||||
|
||||
.table > thead > tr > th {
|
||||
border-bottom: ${({ theme }) => theme.gridUnit / 2}px solid
|
||||
${({ theme }) => theme.colors.grayscale.light2};
|
||||
|
|
|
@ -34,6 +34,7 @@ interface TableCollectionProps {
|
|||
}
|
||||
|
||||
export const Table = styled.table`
|
||||
background-color: ${({ theme }) => theme.colors.grayscale.light5};
|
||||
border-collapse: separate;
|
||||
border-radius: ${({ theme }) => theme.borderRadius}px;
|
||||
|
||||
|
|
|
@ -268,9 +268,6 @@ function ChartList(props: ChartListProps) {
|
|||
Cell: ({ row: { original } }: any) => {
|
||||
const handleDelete = () => handleChartDelete(original);
|
||||
const openEditModal = () => openChartEditModal(original);
|
||||
if (!canEdit && !canDelete) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="actions">
|
||||
|
@ -325,6 +322,7 @@ function ChartList(props: ChartListProps) {
|
|||
Header: t('Actions'),
|
||||
id: 'actions',
|
||||
disableSortBy: true,
|
||||
hidden: !canEdit && !canDelete,
|
||||
},
|
||||
],
|
||||
[canEdit, canDelete],
|
||||
|
|
|
@ -152,15 +152,12 @@ function CssTemplatesList({
|
|||
: null,
|
||||
].filter(item => !!item);
|
||||
|
||||
if (!canEdit && !canDelete) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <ActionsBar actions={actions as ActionProps[]} />;
|
||||
},
|
||||
Header: t('Actions'),
|
||||
id: 'actions',
|
||||
disableSortBy: true,
|
||||
hidden: !canEdit && !canDelete,
|
||||
size: 'xl',
|
||||
},
|
||||
],
|
||||
|
|
|
@ -258,9 +258,7 @@ function DashboardList(props: DashboardListProps) {
|
|||
const handleDelete = () => handleDashboardDelete(original);
|
||||
const handleEdit = () => openDashboardEditModal(original);
|
||||
const handleExport = () => handleBulkDashboardExport([original]);
|
||||
if (!canEdit && !canDelete && !canExport) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="actions">
|
||||
{canDelete && (
|
||||
|
@ -332,6 +330,7 @@ function DashboardList(props: DashboardListProps) {
|
|||
},
|
||||
Header: t('Actions'),
|
||||
id: 'actions',
|
||||
hidden: !canEdit && !canDelete && !canExport,
|
||||
disableSortBy: true,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -238,9 +238,7 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) {
|
|||
Cell: ({ row: { original } }: any) => {
|
||||
const handleEdit = () => handleDatabaseEdit(original);
|
||||
const handleDelete = () => openDatabaseDeleteModal(original);
|
||||
if (!canEdit && !canDelete) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="actions">
|
||||
{canEdit && (
|
||||
|
@ -281,6 +279,7 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) {
|
|||
},
|
||||
Header: t('Actions'),
|
||||
id: 'actions',
|
||||
hidden: !canEdit && !canDelete,
|
||||
disableSortBy: true,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -250,9 +250,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
|
|||
Cell: ({ row: { original } }: any) => {
|
||||
const handleEdit = () => openDatasetEditModal(original);
|
||||
const handleDelete = () => openDatasetDeleteModal(original);
|
||||
if (!canEdit && !canDelete) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="actions">
|
||||
{canDelete && (
|
||||
|
@ -293,6 +291,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
|
|||
},
|
||||
Header: t('Actions'),
|
||||
id: 'actions',
|
||||
hidden: !canEdit && !canDelete,
|
||||
disableSortBy: true,
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue