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/08/31 15:20:54 UTC

[GitHub] [superset] AAfghahi commented on a diff in pull request #21241: feat: rough draft of footer component

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


##########
superset-frontend/src/views/CRUD/data/dataset/AddDataset/Footer/index.tsx:
##########
@@ -17,7 +17,53 @@
  * under the License.
  */
 import React from 'react';
+import Button from 'src/components/Button';
+import { t } from '@superset-ui/core';
+import { useSingleViewResource } from 'src/views/CRUD/hooks';
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+import { DatasetObject } from '../types';
 
-export default function Footer() {
-  return <div>Footer</div>;
+interface FooterObject {
+  url: string;
+  datasetObject?: Partial<DatasetObject> | null;
+}
+
+export default function Footer({ url, datasetObject }: FooterObject) {
+  const { createResource } = useSingleViewResource<Partial<DatasetObject>>(
+    'dataset',
+    t('dataset'),
+    addDangerToast,
+  );
+  const cancelButtonOnClick = () => {
+    // this is a placeholder url until the final feature gets implemented
+    // at that point we will be passing in the url of the previous location.
+    window.location.href = url;
+  };
+
+  const tooltipText = t('Select a database table.');
+
+  const onSave = () => {
+    if (datasetObject) {
+      createResource(datasetObject).then(response => {
+        if (!response) {
+          return;
+        }

Review Comment:
   oh, I am sorry for the late response, didn't see this. 
   
   To be perfectly honest, I am not 100% sure what the function is, I haven't been able to fully test it with a dataset yet. But I was emulating the structure that I found when others used createResource, like this:
   https://github.com/apache/superset/blob/master/superset-frontend/src/views/CRUD/annotationlayers/AnnotationLayerModal.tsx#L144
   



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