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

mintsweet pushed a commit to branch fix-onboard-recollect
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 7516c3999c610cac1e48dac0552b82e4f079302e
Author: mintsweet <[email protected]>
AuthorDate: Fri Mar 29 20:53:56 2024 +1300

    fix: incorrect current pipeline in onboard recollect
---
 config-ui/src/routes/onboard/step-4.tsx | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/config-ui/src/routes/onboard/step-4.tsx 
b/config-ui/src/routes/onboard/step-4.tsx
index d54d3d105..84129db84 100644
--- a/config-ui/src/routes/onboard/step-4.tsx
+++ b/config-ui/src/routes/onboard/step-4.tsx
@@ -107,7 +107,7 @@ export const Step4 = () => {
 
   const navigate = useNavigate();
 
-  const { step, records, projectName, plugin } = useContext(Context);
+  const { step, records, done, projectName, plugin, setRecords } = 
useContext(Context);
 
   const record = useMemo(() => records.find((it) => it.plugin === plugin), 
[plugin, records]);
 
@@ -199,7 +199,33 @@ export const Step4 = () => {
     }
 
     const [success] = await operator(
-      () => API.blueprint.trigger(record.blueprintId, { skipCollectors: false, 
fullSync: false }),
+      async () => {
+        // 1. re trigger this bulueprint
+        await API.blueprint.trigger(record.blueprintId, { skipCollectors: 
false, fullSync: false });
+
+        // 2. get current run pipeline
+        const pipeline = await API.blueprint.pipelines(record.blueprintId);
+
+        const newRecords = records.map((it) =>
+          it.plugin !== plugin
+            ? it
+            : {
+                ...it,
+                pipelineId: pipeline.pipelines[0].id,
+              },
+        );
+
+        setRecords(newRecords);
+
+        // 3. update store
+        await API.store.set('onboard', {
+          step: 4,
+          records: newRecords,
+          done,
+          projectName,
+          plugin,
+        });
+      },
       {
         setOperating,
       },
@@ -264,7 +290,7 @@ export const Step4 = () => {
       {status === 'failed' && (
         <div className="top">
           <div className="info">Something went wrong with the collection 
process.</div>
-          <div className="tips">
+          <div className="tip">
             Please verify your network connection and ensure your token's rate 
limits have not been exceeded, then
             attempt to collect the data again. Alternatively, you may report 
the issue by filing a bug on{' '}
             <ExternalLink 
link="https://github.com/apache/incubator-devlake/issues/new/choose";>GitHub</ExternalLink>.

Reply via email to