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 2023/01/04 15:39:56 UTC

[GitHub] [superset] codyml commented on a diff in pull request #22043: feat: add tabs to edit dataset page

codyml commented on code in PR #22043:
URL: https://github.com/apache/superset/pull/22043#discussion_r1061614573


##########
superset-frontend/src/views/CRUD/data/dataset/AddDataset/EditDataset/index.tsx:
##########
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { styled, t } from '@superset-ui/core';
+import React, { useEffect } from 'react';
+import { useGetDatasetRelatedObjects } from 'src/views/CRUD/data/hooks';
+import Badge from 'src/components/Badge';
+import Tabs from 'src/components/Tabs';
+
+const StyledTabs = styled(Tabs)`
+  ${({ theme }) => `
+  margin-top: ${theme.gridUnit * 8.5}px;
+  padding-left: ${theme.gridUnit * 4}px;
+
+  .ant-tabs-top > .ant-tabs-nav::before {
+    width: ${theme.gridUnit * 50}px;
+  }
+  `}
+`;
+
+const TabStyles = styled.div`
+  ${({ theme }) => `
+  .ant-badge {
+    width: ${theme.gridUnit * 8}px;
+    margin-left: ${theme.gridUnit * 2.5}px;
+  }
+  `}
+`;
+
+interface EditPageProps {
+  id: string;
+}
+
+const TRANSLATIONS = {
+  USAGE_TEXT: t('Usage'),
+  COLUMNS_TEXT: t('Columns'),
+  METRICS_TEXT: t('Metrics'),
+};
+
+const EditPage = ({ id }: EditPageProps) => {
+  const { getDatasetRelatedObjects, usageCount } =
+    useGetDatasetRelatedObjects(id);
+  useEffect(() => {
+    // Todo: this useEffect should be used to call all count methods conncurently
+    // when we populate data for the new tabs. For right separating out this
+    // api call for building the usage page.
+    if (id) {
+      getDatasetRelatedObjects();
+    }
+  }, [id]);

Review Comment:
   I'm getting a dependency array lint warning here; is there a reason `getDatasetRelatedObjects` isn't in the dependency array?



-- 
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