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