eschutho commented on a change in pull request #18722:
URL: https://github.com/apache/superset/pull/18722#discussion_r813230531
##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -123,16 +124,22 @@ const RightMenu = ({
const { roles } = useSelector<any, UserWithPermissionsAndRoles>(
state => state.user,
);
- // @ts-ignore
- const { CSV_EXTENSIONS, COLUMNAR_EXTENSIONS, EXCEL_EXTENSIONS } =
useSelector<
- any,
- CommonBootstrapData
- >(state => state.common.conf);
+ const [showModal, setShowModal] = useState<boolean>(false);
+ const [engine, setEngine] = useState<string>('');
+ const {
+ CSV_EXTENSIONS,
+ COLUMNAR_EXTENSIONS,
+ EXCEL_EXTENSIONS,
+ SHOW_GLOBAL_GSHEETS,
+ } = useSelector<any, ExtentionConfigs>(state => state.common.conf);
+
// if user has any of these roles the dropdown will appear
const configMap = {
'Upload a CSV': CSV_EXTENSIONS,
'Upload a Columnar file': COLUMNAR_EXTENSIONS,
'Upload Excel': EXCEL_EXTENSIONS,
+ [GlobalMenuDataOptions.GOOGLE_SHEETS]: SHOW_GLOBAL_GSHEETS,
+ [GlobalMenuDataOptions.DB_CONNECTION]: true, // todo(hugh): add permission
check here for database creation
Review comment:
instead of a separate map here, how about we move these values into the
upper dropdownItems map with a key of something like `has_perm`? Then below
instead of `configMap[item.name] === true` you can say `item.has_perm`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]