You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/08 17:48:28 UTC

[GitHub] [superset] AAfghahi commented on a diff in pull request #19051: fix: update Permissions for right nav

AAfghahi commented on code in PR #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r846355430


##########
superset-frontend/src/views/components/MenuRight.tsx:
##########
@@ -175,14 +212,48 @@ const RightMenu = ({
     setShowModal(false);
   };
 
+  const isDisabled = isAdmin && !allowUploads;
+
+  const tooltipText = t(
+    "Enable 'Allow data upload' in any database's settings",
+  );
+
+  const buildMenuItem = (item: Record<string, any>) => {
+    const disabledText = isDisabled && item.url;
+    return disabledText ? (
+      <Menu.Item key={item.name} css={styledDisabled}>
+        <Tooltip placement="top" title={tooltipText}>
+          {item.label}
+        </Tooltip>
+      </Menu.Item>
+    ) : (
+      <Menu.Item key={item.name}>
+        {item.url ? <a href={item.url}> {item.label} </a> : item.label}
+      </Menu.Item>
+    );
+  };
+
+  const onMenuOpen = (openKeys: string[]) => {
+    if (openKeys.length) {
+      return hasFileUploadEnabled();
+    }
+    return null;
+  };
+
   return (
     <StyledDiv align={align}>
       <DatabaseModal
         onHide={handleOnHideModal}
         show={showModal}
+        onDatabaseAdd={() => {}}

Review Comment:
   it already was optional so I just deleted it. 



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org