Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions taier-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"react-copy-to-clipboard": "^5.1.0",
"react-dom": "~18.2.0",
"react-router-dom": "^6.0.2",
"react-use": "^17.4.0",
"reflect-metadata": "^0.1.13",
"tsyringe": "^4.6.0",
"umi": "^3.5.20",
Expand Down
3 changes: 3 additions & 0 deletions taier-ui/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,7 @@ export default {
getAllDataSource(params: any) {
return http.post(req.GET_ALL_DATA_SOURCE, params);
},
getComponentVersionByTaskType<T = any>(params: any) {
return http.post<T>(req.GET_COMPONENT_VERSION, params);
},
};
1 change: 1 addition & 0 deletions taier-ui/src/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,5 @@ export default {
QUERY_SUPPORT_SOURCE: `${BASE_URI}/dataSource/manager/support`, // 获取当前各组件支持的数据源
GET_RESOURCES_BY_TENANT: `${BASE_URI}/console/clusterResourcesByTenantId`, // 基于租户 ID 获取集群信息
GET_ALL_DATA_SOURCE: `${BASE_URI}/dataSource/manager/total`, // 获取全部数据源
GET_COMPONENT_VERSION: `${BASE_URI}/task/getComponentVersionByTaskType`, // 获取当前任务支持的版本
};
73 changes: 50 additions & 23 deletions taier-ui/src/components/scaffolds/create.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import {
CATALOGUE_TYPE,
CREATE_MODEL_TYPE,
DATA_SYNC_MODE,
FLINK_VERSIONS,
FLINK_VERSION_TYPE,
PythonVersionKind,
} from '@/constant';
import { useEffect, useState } from 'react';
import { usePrevious } from 'react-use';
import { CATALOGUE_TYPE, CREATE_MODEL_TYPE, DATA_SYNC_MODE, PythonVersionKind } from '@/constant';
import { Button, Empty, Form, Input, Radio, Select, Spin } from 'antd';
import { syncModeHelp, syncTaskHelp } from '../helpDoc/docs';
import FolderPicker from '../folderPicker';
import resourceManagerTree from '@/services/resourceManagerService';
import { dataSourceService, taskRenderService } from '@/services';
import { useEffect, useState } from 'react';
import { IDataSourceProps } from '@/interface';
import molecule from '@dtinsight/molecule';
import api from '@/api';
import type { IDataSourceProps } from '@/interface';

interface ICreateFormProps {
disabled?: boolean;
Expand Down Expand Up @@ -70,17 +64,49 @@ const SyncModel = ({ disabled }: ICreateFormProps) => (
/**
* 引擎版本物料
*/
const ComponentVersion = ({ onChange }: ICreateFormProps) => (
<Form.Item label="引擎版本" name="componentVersion" initialValue={FLINK_VERSIONS.FLINK_1_12}>
<Select onChange={onChange}>
{FLINK_VERSION_TYPE.map(({ value, label }) => (
<Select.Option key={value} value={value}>
{label}
</Select.Option>
))}
</Select>
</Form.Item>
);
const ComponentVersion = ({ onChange }: ICreateFormProps) => {
const form = Form.useFormInstance();
const taskType = Form.useWatch('taskType');
const prevTaskType = usePrevious(taskType);
const [versions, setVersions] = useState<{ label: string; value: string }[]>([]);

useEffect(() => {
if (taskType) {
api.getComponentVersionByTaskType<
{ componentVersion: string; default: boolean; componentName: string }[]
>({
taskType,
}).then((res) => {
if (res.code === 1) {
setVersions(
res.data?.map((v) => ({
label: v.componentName,
value: v.componentVersion,
})) || [],
);

const currentComponentVersion = form.getFieldValue('componentVersion');
if (
!currentComponentVersion ||
!res.data.find((v) => v.componentVersion === currentComponentVersion)
) {
// reset initial value
form.setFieldValue(
'componentVersion',
res.data.find((v) => v.default)?.componentVersion,
);
}
}
});
}
}, [taskType, prevTaskType]);

return (
<Form.Item label="引擎版本" name="componentVersion">
<Select onChange={onChange} showSearch options={versions} optionFilterProp="label" />
</Form.Item>
);
};

/**
* 资源下拉菜单物料
Expand Down Expand Up @@ -178,6 +204,7 @@ const PythonVersion = ({ disabled }: ICreateFormProps) => (
const DataSource = () => {
const form = Form.useFormInstance();
const taskType = Form.useWatch('taskType');
const prevTaskType = usePrevious(taskType);
const [dataSource, setDataSource] = useState<IDataSourceProps[]>([]);

const handleGotoSourceCenter = () => {
Expand All @@ -199,10 +226,10 @@ const DataSource = () => {
}, []);

useEffect(() => {
if (taskType !== undefined) {
if (taskType !== prevTaskType && prevTaskType !== undefined) {
form.resetFields(['datasourceId']);
}
}, [taskType]);
}, [taskType, prevTaskType]);

return (
<Form.Item label="数据源" name="datasourceId" required>
Expand Down
6 changes: 6 additions & 0 deletions taier-ui/src/pages/editor/spark.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Flink from './flink';

export default function Spark() {
// Same as Flink
return <Flink />;
}
1 change: 1 addition & 0 deletions taier-ui/src/services/taskSaveService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ class TaskSaveService extends GlobalEvent {

return Promise.reject();
}
case TASK_TYPE_ENUM.SPARK:
case TASK_TYPE_ENUM.FLINK: {
const {
id,
Expand Down