Skip to content

Commit

Permalink
update menuright
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdotson committed Mar 18, 2022
1 parent 72016cb commit 5f01fda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ import { useSelector } from 'react-redux';
import Loading from 'src/components/Loading';
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
import { useListViewResource } from 'src/views/CRUD/hooks';
import {
createErrorHandler,
checkUploadExtensions,
uploadUserPerms,
} from 'src/views/CRUD/utils';
import { createErrorHandler, uploadUserPerms } from 'src/views/CRUD/utils';
import withToasts from 'src/components/MessageToasts/withToasts';
import SubMenu, { SubMenuProps } from 'src/views/components/SubMenu';
import DeleteModal from 'src/components/DeleteModal';
Expand Down
23 changes: 11 additions & 12 deletions superset-frontend/src/views/components/MenuRight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { useSelector } from 'react-redux';
import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes';
import LanguagePicker from './LanguagePicker';
import DatabaseModal from '../CRUD/data/database/DatabaseModal';
import { checkUploadExtensions, uploadUserPerms } from '../CRUD/utils';
import { uploadUserPerms } from '../CRUD/utils';
import {
ExtentionConfigs,
GlobalMenuDataOptions,
Expand Down Expand Up @@ -86,8 +86,13 @@ const RightMenu = ({
const canChart = findPermission('can_write', 'Chart', roles);
const canDatabase = findPermission('can_write', 'Database', roles);

const { canUploadCSV, canUploadColumnar, canUploadExcel } =
uploadUserPerms(roles);
const { canUploadCSV, canUploadColumnar, canUploadExcel } = uploadUserPerms(
roles,
CSV_EXTENSIONS,
COLUMNAR_EXTENSIONS,
EXCEL_EXTENSIONS,
ALLOWED_EXTENSIONS,
);

const canUpload = canUploadCSV || canUploadColumnar || canUploadExcel;
const showActionDropdown = canSql || canChart || canDashboard;
Expand All @@ -110,25 +115,19 @@ const RightMenu = ({
label: t('Upload CSV to database'),
name: 'Upload a CSV',
url: '/csvtodatabaseview/form',
perm:
checkUploadExtensions(CSV_EXTENSIONS, ALLOWED_EXTENSIONS) &&
canUploadCSV,
perm: canUploadCSV,
},
{
label: t('Upload columnar file to database'),
name: 'Upload a Columnar file',
url: '/columnartodatabaseview/form',
perm:
checkUploadExtensions(COLUMNAR_EXTENSIONS, ALLOWED_EXTENSIONS) &&
canUploadColumnar,
perm: canUploadColumnar,
},
{
label: t('Upload Excel file to database'),
name: 'Upload Excel',
url: '/exceltodatabaseview/form',
perm:
checkUploadExtensions(EXCEL_EXTENSIONS, ALLOWED_EXTENSIONS) &&
canUploadExcel,
perm: canUploadExcel,
},
],
},
Expand Down

0 comments on commit 5f01fda

Please sign in to comment.