diff --git a/dolphinscheduler-ui/public/images/task-icons/data_factory.png b/dolphinscheduler-ui/public/images/task-icons/data_factory.png new file mode 100644 index 000000000000..fb3bbd33d51d Binary files /dev/null and b/dolphinscheduler-ui/public/images/task-icons/data_factory.png differ diff --git a/dolphinscheduler-ui/public/images/task-icons/data_factory_hover.png b/dolphinscheduler-ui/public/images/task-icons/data_factory_hover.png new file mode 100644 index 000000000000..9cebaceee44b Binary files /dev/null and b/dolphinscheduler-ui/public/images/task-icons/data_factory_hover.png differ diff --git a/dolphinscheduler-ui/src/locales/en_US/project.ts b/dolphinscheduler-ui/src/locales/en_US/project.ts index 5a42e12f536c..741daad716e5 100644 --- a/dolphinscheduler-ui/src/locales/en_US/project.ts +++ b/dolphinscheduler-ui/src/locales/en_US/project.ts @@ -37,10 +37,10 @@ export default { confirm: 'Confirm', cancel: 'Cancel', delete_confirm: 'Delete?', - authorize_level:'Authorize Level', + authorize_level: 'Authorize Level', no_permission: 'No Permission', read_permission: 'Read Permission', - all_permission: 'All Permission', + all_permission: 'All Permission' }, workflow: { on_line: 'Online', @@ -215,7 +215,7 @@ export default { workflow_relation_no_data_result_desc: 'There is not any workflows. Please create a workflow, and then visit this page again.', ready_to_block: 'Ready to block', - block: 'Block', + block: 'Block' }, task: { on_line: 'Online', @@ -329,7 +329,7 @@ export default { online: 'Online' }, node: { - is_cache: "Cache Execution", + is_cache: 'Cache Execution', jvm_args: 'Java VM Parameters', jvm_args_tips: 'Please enter virtual machine parameters', run_type: 'Run Type', @@ -377,7 +377,8 @@ export default { image: 'Image', image_tips: 'Please enter image', command: 'Command', - command_tips: 'Please enter the container execution command, for example: /bin/echo hello world', + command_tips: + 'Please enter the container execution command, for example: /bin/echo hello world', min_memory_tips: 'Please enter min memory', state: 'State', branch_flow: 'Branch flow', @@ -798,7 +799,10 @@ export default { pytorch_requirements: 'Requirement File', pytorch_conda_python_version: 'Python Version', pytorch_conda_python_version_tips: - 'Please enter the version number, such as 3.6, 3.7, 3.x' + 'Please enter the version number, such as 3.6, 3.7, 3.x', + factory_name: 'Factory Name', + resource_group_name: 'Resource Group Name', + pipeline_name: 'Pipeline Name' }, menu: { fav: 'Favorites', @@ -808,6 +812,6 @@ export default { di: 'Data Integration', dq: 'Data Quality', ml: 'Machine Learning', - other: 'Other', + other: 'Other' } } diff --git a/dolphinscheduler-ui/src/locales/zh_CN/project.ts b/dolphinscheduler-ui/src/locales/zh_CN/project.ts index 54c77d4633e9..e840a86b5e0a 100644 --- a/dolphinscheduler-ui/src/locales/zh_CN/project.ts +++ b/dolphinscheduler-ui/src/locales/zh_CN/project.ts @@ -777,7 +777,10 @@ export default { pytorch_python_env_tool: 'python环境管理工具', pytorch_requirements: '依赖文件', pytorch_conda_python_version: 'python版本', - pytorch_conda_python_version_tips: '请输入版本号,如 3.6, 3.7, 3.x等' + pytorch_conda_python_version_tips: '请输入版本号,如 3.6, 3.7, 3.x等', + factory_name: '工厂名称', + resource_group_name: '资源组名称', + pipeline_name: 'pipeline名称' }, menu: { fav: '收藏组件', diff --git a/dolphinscheduler-ui/src/service/modules/azure/index.ts b/dolphinscheduler-ui/src/service/modules/azure/index.ts new file mode 100644 index 000000000000..28f83db45c61 --- /dev/null +++ b/dolphinscheduler-ui/src/service/modules/azure/index.ts @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { axios } from '@/service/service' +import { DataFactoryReq } from './types' + +export function queryDataFactoryFactories(): any { + return axios({ + url: '/cloud/azure/datafactory/factories', + method: 'get' + }) +} + +export function queryDataFactoryResourceGroups(): any { + return axios({ + url: '/cloud/azure/datafactory/resourceGroups', + method: 'get' + }) +} + +export function queryDataFactoryPipelines(params: DataFactoryReq): any { + return axios({ + url: '/cloud/azure/datafactory/pipelines', + method: 'get', + params + }) +} diff --git a/dolphinscheduler-ui/src/service/modules/azure/types.ts b/dolphinscheduler-ui/src/service/modules/azure/types.ts new file mode 100644 index 000000000000..5f59d70bded2 --- /dev/null +++ b/dolphinscheduler-ui/src/service/modules/azure/types.ts @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +interface DataFactoryReq { + factoryName: string + resourceGroupName: string +} + +export { DataFactoryReq } diff --git a/dolphinscheduler-ui/src/store/project/task-type.ts b/dolphinscheduler-ui/src/store/project/task-type.ts index b1f426bef85b..24bc05614d9f 100644 --- a/dolphinscheduler-ui/src/store/project/task-type.ts +++ b/dolphinscheduler-ui/src/store/project/task-type.ts @@ -149,6 +149,10 @@ export const TASK_TYPES_MAP = { LINKIS: { alias: 'LINKIS', helperLinkDisable: true + }, + DATA_FACTORY: { + alias: 'DATA_FACTORY', + helperLinkDisable: true } } as { [key in TaskType]: { diff --git a/dolphinscheduler-ui/src/store/project/types.ts b/dolphinscheduler-ui/src/store/project/types.ts index e801f4a1eb32..0df130e77b51 100644 --- a/dolphinscheduler-ui/src/store/project/types.ts +++ b/dolphinscheduler-ui/src/store/project/types.ts @@ -56,6 +56,7 @@ type TaskType = | 'DATASYNC' | 'KUBEFLOW' | 'LINKIS' + | 'DATA_FACTORY' type ProgramType = 'JAVA' | 'SCALA' | 'PYTHON' diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts index e7b4ab06f801..4510f471839d 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/index.ts @@ -85,3 +85,4 @@ export { useDms } from './use-dms' export { useDatasync } from './use-datasync' export { useKubeflow } from './use-kubeflow' export { useLinkis } from './use-linkis' +export { useDataFactory } from './use-data-factory' diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-data-factory.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-data-factory.ts new file mode 100644 index 000000000000..17e9a2689e6f --- /dev/null +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-data-factory.ts @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { + queryDataFactoryFactories, + queryDataFactoryPipelines, + queryDataFactoryResourceGroups +} from '@/service/modules/azure' +import { onMounted, ref, watch } from 'vue' +import { useI18n } from 'vue-i18n' +import { useCustomParams } from '.' +import type { IJsonItem } from '../types' + +export function useDataFactory(model: { [field: string]: any }): IJsonItem[] { + const { t } = useI18n() + + const factoryOptions = ref([] as { label: string; value: number }[]) + const resourceGroupOptions = ref([] as { label: string; value: number }[]) + const pipelineOptions = ref([] as { label: string; value: number }[]) + + const getFactoryOptions = async () => { + const factories = await queryDataFactoryFactories() + factoryOptions.value = factories.map((factory: string) => ({ + label: factory, + value: factory + })) + } + + const getResourceGroupName = async () => { + const groupNames = await queryDataFactoryResourceGroups() + resourceGroupOptions.value = groupNames.map((groupName: string) => ({ + label: groupName, + value: groupName + })) + } + + const getPipelineName = async ( + factoryName: string, + resourceGroupName: string + ) => { + const pipelineNames = await queryDataFactoryPipelines({ + factoryName, + resourceGroupName + }) + pipelineOptions.value = pipelineNames.map((pipelineName: string) => ({ + label: pipelineName, + value: pipelineName + })) + } + + const onChange = () => { + model['pipelineName'] = '' + if (model['factoryName'] && model['resourceGroupName']) { + getPipelineName(model['factoryName'], model['resourceGroupName']) + } + } + + watch( + () => model['pipelineName'], + () => { + if (model['pipelineName'] && pipelineOptions.value.length === 0) { + getPipelineName(model['factoryName'], model['resourceGroupName']) + } + } + ) + + onMounted(() => { + getFactoryOptions() + getResourceGroupName() + }) + + return [ + { + type: 'select', + field: 'factoryName', + span: 24, + name: t('project.node.factory_name'), + options: factoryOptions, + props: { + 'on-update:value': onChange + }, + validate: { + required: true + } + }, + { + type: 'select', + field: 'resourceGroupName', + span: 24, + name: t('project.node.resource_group_name'), + options: resourceGroupOptions, + props: { + 'on-update:value': onChange + }, + validate: { + required: true + } + }, + { + type: 'select', + field: 'pipelineName', + span: 24, + name: t('project.node.pipeline_name'), + options: pipelineOptions, + validate: { + required: true + } + }, + ...useCustomParams({ + model, + field: 'localParams', + isSimple: true + }) + ] +} diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts index ea804dc1d739..7d227db0e7b5 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts @@ -449,13 +449,19 @@ export function formatParams(data: INodeData): { taskParams.yamlContent = data.yamlContent taskParams.namespace = data.namespace } - + if (data.taskType === 'LINKIS') { taskParams.useCustom = data.useCustom taskParams.paramScript = data.paramScript taskParams.rawScript = data.rawScript } + if (data.taskType === 'DATA_FACTORY') { + taskParams.factoryName = data.factoryName + taskParams.resourceGroupName = data.resourceGroupName + taskParams.pipelineName = data.pipelineName + } + let timeoutNotifyStrategy = '' if (data.timeoutNotifyStrategy) { if (data.timeoutNotifyStrategy.length === 1) { diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/index.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/index.ts index 1b6f998b4e41..04a351824243 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/index.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/index.ts @@ -50,6 +50,7 @@ import { useDms } from './use-dms' import { useDatasync } from './use-datasync' import { useKubeflow } from './use-kubeflow' import { useLinkis } from './use-linkis' +import { useDataFactory } from './use-data-factory' export default { SHELL: useShell, @@ -86,5 +87,6 @@ export default { DMS: useDms, DATASYNC: useDatasync, KUBEFLOW: useKubeflow, - LINKIS: useLinkis + LINKIS: useLinkis, + DATA_FACTORY: useDataFactory } diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-factory.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-factory.ts new file mode 100644 index 000000000000..c845fd0246be --- /dev/null +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/tasks/use-data-factory.ts @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { reactive } from 'vue' +import * as Fields from '../fields/index' +import type { IJsonItem, INodeData } from '../types' +import { ITaskData } from '../types' + +export function useDataFactory({ + projectCode, + from = 0, + readonly, + data +}: { + projectCode: number + from?: number + readonly?: boolean + data?: ITaskData +}) { + const model = reactive({ + name: '', + taskType: 'DATA_FACTORY', + flag: 'YES', + description: '', + timeoutFlag: false, + localParams: [], + environmentCode: null, + failRetryInterval: 1, + failRetryTimes: 0, + workerGroup: 'default', + delayTime: 0, + timeout: 30, + timeoutNotifyStrategy: ['WARN'], + factoryName: '', + resourceGroupName: '', + pipelineName: '' + } as INodeData) + + return { + json: [ + Fields.useName(from), + ...Fields.useTaskDefinition({ projectCode, from, readonly, data, model }), + Fields.useRunFlag(), + Fields.useCache(), + Fields.useDescription(), + Fields.useTaskPriority(), + Fields.useWorkerGroup(), + Fields.useEnvironmentName(model, !data?.id), + ...Fields.useTaskGroup(model, projectCode), + ...Fields.useFailed(), + Fields.useDelayTime(model), + ...Fields.useTimeoutAlarm(model), + ...Fields.useDataFactory(model), + Fields.usePreTasks() + ] as IJsonItem[], + model + } +} diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts index 282948345b80..490503aafdbb 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts @@ -405,6 +405,9 @@ interface ITaskParams { cloudWatchLogGroupArn?: string yamlContent?: string paramScript?: ILocalParam[] + factoryName?: string + resourceGroupName?: string + pipelineName?: string } interface INodeData diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag.module.scss b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag.module.scss index 7aa0c9c709f3..65b7aa0067a1 100644 --- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag.module.scss +++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/dag.module.scss @@ -204,6 +204,9 @@ $bgLight: #ffffff; &.icon-kubeflow { background-image: url('/images/task-icons/kubeflow.png'); } + &.icon-data_factory { + background-image: url('/images/task-icons/data_factory.png'); + } } &:hover { @@ -311,6 +314,9 @@ $bgLight: #ffffff; &.icon-kubeflow { background-image: url('/images/task-icons/kubeflow_hover.png'); } + &.icon-data_factory { + background-image: url('/images/task-icons/data_factory_hover.png'); + } } }