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 2019/04/28 23:31:19 UTC

[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #7390: [dashboard] allow user re-order top-level tabs

graceguo-supercat commented on a change in pull request #7390: [dashboard] allow user re-order top-level tabs
URL: https://github.com/apache/incubator-superset/pull/7390#discussion_r279217925
 
 

 ##########
 File path: superset/assets/src/dashboard/actions/dashboardLayout.js
 ##########
 @@ -163,10 +163,30 @@ export function handleComponentDrop(dropResult) {
     const droppedOnRoot = destination && destination.id === DASHBOARD_ROOT_ID;
     const isNewComponent = source.id === NEW_COMPONENTS_SOURCE_ID;
 
+    const { dashboardLayout: undoableLayout } = getState();
+    const { present: layout } = undoableLayout;
+    const dashboardRoot = layout[DASHBOARD_ROOT_ID];
+    const rootChildId =
+      dashboardRoot && dashboardRoot.children ? dashboardRoot.children[0] : '';
+
     if (droppedOnRoot) {
       dispatch(createTopLevelTabs(dropResult));
     } else if (destination && isNewComponent) {
       dispatch(createComponent(dropResult));
+    } else if (
+      // Add additional allow-to-drop logic for tag/tags source.
+      // we only allow
+      // - top-level tab => top-level tab: rearrange top-level tab order
+      // - nested tab => top-level tab: allow row tab become top-level tab
+      // we do not allow top-level tab become nested tab
+      source.type === TABS_TYPE &&
+      destination.type === TABS_TYPE &&
+      source.id === rootChildId &&
+      destination.id !== rootChildId
+    ) {
+      return dispatch(
+        addInfoToast(`Can not move top level tab into nested tabs`),
 
 Review comment:
   added `t` function. I saw other message, `There is not enough space for this component` is also info not warning. should i can make both of them warning message?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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