This is an automated email from the ASF dual-hosted git repository.
abeizn 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 f7f808742 fix: remove auto create blueprint when creating project
(#7462)
f7f808742 is described below
commit f7f808742e4e3e2042953291e8fd3e80e93f08a2
Author: 青湛 <[email protected]>
AuthorDate: Tue May 14 14:35:07 2024 +1200
fix: remove auto create blueprint when creating project (#7462)
---
config-ui/src/api/blueprint/index.ts | 2 +-
config-ui/src/routes/onboard/step-3.tsx | 18 ++++--------------
config-ui/src/routes/project/home/index.tsx | 24 +++++-------------------
3 files changed, 10 insertions(+), 34 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..4ee900bfa 100644
--- a/config-ui/src/routes/onboard/step-3.tsx
+++ b/config-ui/src/routes/onboard/step-3.tsx
@@ -21,9 +21,7 @@ import { Flex, Button } from 'antd';
import dayjs from 'dayjs';
import API from '@/api';
-import { cronPresets } from '@/config';
import { Markdown } from '@/components';
-import { IBPMode } from '@/types';
import { DataScopeRemote, getPluginScopeId } from '@/plugins';
import { operator, formatTime } from '@/utils';
@@ -43,7 +41,6 @@ export const Step3 = () => {
.then((text) => setQA(text));
}, [plugin]);
- const presets = useMemo(() => cronPresets.map((preset) => preset.config),
[]);
const connectionId = useMemo(() => {
const record = records.find((it) => it.plugin === plugin);
return record?.connectionId ?? null;
@@ -57,7 +54,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 +66,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..7c253d91e 100644
--- a/config-ui/src/routes/project/home/index.tsx
+++ b/config-ui/src/routes/project/home/index.tsx
@@ -20,18 +20,17 @@ import { useState, useMemo, useRef } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { PlusOutlined, SettingOutlined } from '@ant-design/icons';
import { Flex, Table, Button, Modal, Input, Checkbox, message } from 'antd';
-import dayjs from 'dayjs';
import API from '@/api';
import { PageHeader, Block, ExternalLink, IconButton } from '@/components';
-import { getCron, cronPresets, PATHS } from '@/config';
+import { getCron, PATHS } from '@/config';
import { ConnectionName } from '@/features';
import { useRefreshData } from '@/hooks';
import { OnboardTour } from '@/routes/onboard/components';
import { DOC_URL } from '@/release';
import { formatTime, operator } from '@/utils';
import { PipelineStatus } from '@/routes/pipeline';
-import { IBlueprint, IBPMode } from '@/types';
+import { IBlueprint } from '@/types';
import { validName } from '../utils';
@@ -52,7 +51,6 @@ export const ProjectHomePage = () => {
const navigate = useNavigate();
- const presets = useMemo(() => cronPresets.map((preset) => preset.config),
[]);
const [dataSource, total] = useMemo(
() => [
(data?.projects ?? []).map((it) => {
@@ -85,8 +83,8 @@ export const ProjectHomePage = () => {
}
const [success] = await operator(
- async () => {
- await API.project.create({
+ async () =>
+ API.project.create({
name,
description: '',
metrics: [
@@ -96,19 +94,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,
},