You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/05/13 07:03:27 UTC

(incubator-devlake) branch fix-7449 created (now e26b55d59)

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

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


      at e26b55d59 fix: remove auto create blueprint when creating project

This branch includes the following new commits:

     new e26b55d59 fix: remove auto create blueprint when creating project

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix: remove auto create blueprint when creating project

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e26b55d59a455a0f4cfa352c9ef3119f1924da04
Author: mintsweet <0x...@gmail.com>
AuthorDate: Mon May 13 19:03:14 2024 +1200

    fix: remove auto create blueprint when creating project
---
 config-ui/src/api/blueprint/index.ts        |  2 +-
 config-ui/src/routes/onboard/step-3.tsx     | 15 ++++-----------
 config-ui/src/routes/project/home/index.tsx | 18 +++---------------
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/config-ui/src/api/blueprint/index.ts b/config-ui/src/api/blueprint/index.ts
index c514ed744..727c026de 100644
--- a/config-ui/src/api/blueprint/index.ts
+++ b/config-ui/src/api/blueprint/index.ts
@@ -32,7 +32,7 @@ export const create = (data: any) =>
 
 export const remove = (id: ID) => request(`/blueprints/${id}`, { method: 'delete' });
 
-export const update = (id: ID, data: IBlueprint) => request(`/blueprints/${id}`, { method: 'patch', data });
+export const update = (id: ID, data: Partial<IBlueprint>) => request(`/blueprints/${id}`, { method: 'patch', data });
 
 export const pipelines = (id: ID) => request(`/blueprints/${id}/pipelines`);
 
diff --git a/config-ui/src/routes/onboard/step-3.tsx b/config-ui/src/routes/onboard/step-3.tsx
index 2e5b79c0b..41fbfd126 100644
--- a/config-ui/src/routes/onboard/step-3.tsx
+++ b/config-ui/src/routes/onboard/step-3.tsx
@@ -57,7 +57,7 @@ export const Step3 = () => {
     const [success] = await operator(
       async () => {
         // 1. create a new project
-        await API.project.create({
+        const { blueprint } = await API.project.create({
           name: projectName,
           description: '',
           metrics: [
@@ -69,18 +69,11 @@ export const Step3 = () => {
           ],
         });
 
-        // 2. add a data scope to the connection
+        // 2. add data scopes to the connection
         await API.scope.batch(plugin, connectionId, { data: scopes.map((it) => it.data) });
 
-        // 3. create a new blueprint
-        const blueprint = await API.blueprint.create({
-          name: `${projectName}-Blueprint`,
-          projectName,
-          mode: IBPMode.NORMAL,
-          enable: true,
-          cronConfig: presets[0],
-          isManual: false,
-          skipOnFail: true,
+        // 3. add data scopes to the blueprint
+        await API.blueprint.update(blueprint.id, {
           timeAfter: formatTime(dayjs().subtract(14, 'day').startOf('day').toDate(), 'YYYY-MM-DD[T]HH:mm:ssZ'),
           connections: [
             {
diff --git a/config-ui/src/routes/project/home/index.tsx b/config-ui/src/routes/project/home/index.tsx
index 5a7a350f4..ff2ae9976 100644
--- a/config-ui/src/routes/project/home/index.tsx
+++ b/config-ui/src/routes/project/home/index.tsx
@@ -85,8 +85,8 @@ export const ProjectHomePage = () => {
     }
 
     const [success] = await operator(
-      async () => {
-        await API.project.create({
+      async () =>
+        API.project.create({
           name,
           description: '',
           metrics: [
@@ -96,19 +96,7 @@ export const ProjectHomePage = () => {
               enable: enableDora,
             },
           ],
-        });
-        return API.blueprint.create({
-          name: `${name}-Blueprint`,
-          projectName: name,
-          mode: IBPMode.NORMAL,
-          enable: true,
-          cronConfig: presets[0],
-          isManual: false,
-          skipOnFail: true,
-          timeAfter: formatTime(dayjs().subtract(6, 'month').startOf('day').toDate(), 'YYYY-MM-DD[T]HH:mm:ssZ'),
-          connections: [],
-        });
-      },
+        }),
       {
         setOperating: setSaving,
       },