This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new e5828b382 fix: differentiate between clone git repo and other tasks 
(#7288)
e5828b382 is described below

commit e5828b3829a61c414112f9f1b5d005bb3afa1290
Author: 青湛 <[email protected]>
AuthorDate: Mon Apr 8 13:11:20 2024 +0800

    fix: differentiate between clone git repo and other tasks (#7288)
---
 config-ui/src/routes/onboard/components/logs.tsx | 28 +++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/config-ui/src/routes/onboard/components/logs.tsx 
b/config-ui/src/routes/onboard/components/logs.tsx
index 9dbe8aa16..155eb6fdc 100644
--- a/config-ui/src/routes/onboard/components/logs.tsx
+++ b/config-ui/src/routes/onboard/components/logs.tsx
@@ -73,6 +73,28 @@ const Wrapper = styled.div`
   }
 `;
 
+const getStatus = (task: { step: number; name: string; status: string; 
finishedRecords: number }) => {
+  if (task.status === 'pending') {
+    return 'Pending';
+  }
+
+  if (task.status === 'running' && task.name === 'Clone Git Repo') {
+    return 'N/A';
+  }
+
+  if (task.status === 'success' && task.name === 'Clone Git Repo') {
+    return 'Completed';
+  }
+
+  if (task.status === 'failed' && task.name === 'Clone Git Repo') {
+    return 'Failed';
+  }
+
+  if (['running', 'success', 'failed'].includes(task.status)) {
+    return `Records collected: ${task.finishedRecords}`;
+  }
+};
+
 interface LogsProps {
   style?: React.CSSProperties;
   log: {
@@ -113,11 +135,7 @@ export const Logs = ({ style, log: { plugin, name, 
percent, tasks } }: LogsProps
             <span className="name">
               Step {task.step} - {task.name}
             </span>
-            {task.status === 'pending' ? (
-              <span className="status">Pending</span>
-            ) : (
-              <span className="status">Records collected: 
{task.finishedRecords}</span>
-            )}
+            <span className="status">{getStatus(task)}</span>
             {task.status === 'running' && <LoadingOutlined style={{ color: 
colorPrimary }} />}
             {task.status === 'success' && <CheckCircleOutlined style={{ color: 
green5 }} />}
             {task.status === 'failed' && <CloseCircleOutlined style={{ color: 
red5 }} />}

Reply via email to