williaster 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_r279119436
##########
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
Review comment:
I would add one more line that says _why_ we don't allow `top => nested`
since it may not be obvious, which is that it could result in _two_ levels of
nested tabs (`top > nested` becomes `nested > nested`) which is _invalid_.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]