You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "featzhang (via GitHub)" <gi...@apache.org> on 2023/04/24 14:15:30 UTC

[GitHub] [inlong] featzhang commented on a diff in pull request #7860: [INLONG-7789][Dashboard] Support create stream fields by statement

featzhang commented on code in PR #7860:
URL: https://github.com/apache/inlong/pull/7860#discussion_r1175353091


##########
inlong-dashboard/src/ui/components/EditableTable/index.tsx:
##########
@@ -274,23 +304,300 @@ const EditableTable = ({
         ),
     } as any);
   }
+  const [csvData, setCsvData] = useState('');
+  const [jsonData, setJsonData] = useState('');
+  const [sqlData, setSqlData] = useState('');
+  const [isModalVisible, setIsModalVisible] = useState(false);
+  const [parseMethod, setParseMethod] = useState('CSV');
+  const [parseStatement, setParseStatement] = useState('');
+  const [previewData, setPreviewData] = useState(null);
+
+  const {
+    loading,
+    data: pData,
+    error,
+    run: runParseFields,
+  } = useRequest(
+    {
+      url: '/stream/parseFields',
+      method: 'POST',
+      data: {
+        method: parseMethod,
+        statement: parseStatement,
+      },
+    },
+    {
+      manual: true,
+      onSuccess: res => {
+        setPreviewData(res);
+      },
+    },
+  );
+
+  const handleParseCsv = () => {
+    setParseMethod('csv');
+    setParseStatement(csvData);
+    runParseFields();
+  };
+
+  const handleParseJSON = () => {
+    setParseMethod('json');
+    setParseStatement(jsonData);
+    runParseFields();
+    // 解析JSON数据
+    message.success('JSON数据解析成功');
+  };
+  const handleParseSQL = () => {
+    setParseMethod('sql');
+    setParseStatement(sqlData);
+    runParseFields();
+    // 解析SQL数据
+    message.success('SQL数据解析成功');
+  };
+  const handleClearCSV = () => {
+    setCsvData('');
+    setPreviewData(null);
+  };
+  const handleClearJSON = () => {
+    setJsonData('');
+  };
+  const handleClearSQL = () => {
+    setSqlData('');
+  };
+  const handleDownloadExcelTemplate = () => {
+    // 下载Excel模板

Review Comment:
   Fixed



##########
inlong-dashboard/src/ui/components/EditableTable/index.tsx:
##########
@@ -274,23 +304,300 @@ const EditableTable = ({
         ),
     } as any);
   }
+  const [csvData, setCsvData] = useState('');
+  const [jsonData, setJsonData] = useState('');
+  const [sqlData, setSqlData] = useState('');
+  const [isModalVisible, setIsModalVisible] = useState(false);
+  const [parseMethod, setParseMethod] = useState('CSV');
+  const [parseStatement, setParseStatement] = useState('');
+  const [previewData, setPreviewData] = useState(null);
+
+  const {
+    loading,
+    data: pData,
+    error,
+    run: runParseFields,
+  } = useRequest(
+    {
+      url: '/stream/parseFields',
+      method: 'POST',
+      data: {
+        method: parseMethod,
+        statement: parseStatement,
+      },
+    },
+    {
+      manual: true,
+      onSuccess: res => {
+        setPreviewData(res);
+      },
+    },
+  );
+
+  const handleParseCsv = () => {
+    setParseMethod('csv');
+    setParseStatement(csvData);
+    runParseFields();
+  };
+
+  const handleParseJSON = () => {
+    setParseMethod('json');
+    setParseStatement(jsonData);
+    runParseFields();
+    // 解析JSON数据
+    message.success('JSON数据解析成功');
+  };
+  const handleParseSQL = () => {
+    setParseMethod('sql');
+    setParseStatement(sqlData);
+    runParseFields();
+    // 解析SQL数据
+    message.success('SQL数据解析成功');
+  };
+  const handleClearCSV = () => {
+    setCsvData('');
+    setPreviewData(null);
+  };
+  const handleClearJSON = () => {
+    setJsonData('');
+  };
+  const handleClearSQL = () => {
+    setSqlData('');
+  };
+  const handleDownloadExcelTemplate = () => {
+    // 下载Excel模板
+    message.success('Excel模板下载成功');
+  };
+  const handleUploadExcel = () => {
+    // 上传Excel数据并解析

Review Comment:
   Fixed



-- 
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: commits-unsubscribe@inlong.apache.org

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