Browse Source

[Feature][UI Next] Add the form of python task to the module of next ui. (#8438)

* add the form of python task

* developed the form of python task
3.0.0/version-upgrade
calvin 3 years ago committed by GitHub
parent
commit
7da84e4aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-ui-next/docs/e2e/data-source.md
  2. 2
      dolphinscheduler-ui-next/docs/e2e/login.md
  3. 1
      dolphinscheduler-ui-next/docs/e2e/navbar.md
  4. 22
      dolphinscheduler-ui-next/docs/e2e/project.md
  5. 19
      dolphinscheduler-ui-next/docs/e2e/resource.md
  6. 13
      dolphinscheduler-ui-next/docs/e2e/security.md
  7. 4
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-delay-time.ts
  8. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-task-type.ts
  9. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts
  10. 83
      dolphinscheduler-ui-next/src/views/projects/task/components/node/tasks/use-python.ts
  11. 2
      dolphinscheduler-ui-next/src/views/projects/task/components/node/tasks/use-shell.ts
  12. 9
      dolphinscheduler-ui-next/src/views/projects/task/components/node/use-task.ts
  13. 1
      dolphinscheduler-ui-next/src/views/projects/task/definition/index.tsx
  14. 13
      dolphinscheduler-ui-next/src/views/security/worker-group-manage/index.tsx

2
dolphinscheduler-ui-next/docs/e2e/data-source.md

@ -1,7 +1,7 @@
### data source ### data source
| check | class | | check | class |
|--------------------|--------------------------------| | ------------------ | ------------------------------ |
| :white_check_mark: | data-source-items | | :white_check_mark: | data-source-items |
| | el-popconfirm | | | el-popconfirm |
| | el-button--primary | | | el-button--primary |

2
dolphinscheduler-ui-next/docs/e2e/login.md

@ -1,7 +1,7 @@
### login ### login
| check | class | | check | class |
|--------------------|----------------| | ------------------ | --------------- |
| :white_check_mark: | input-user-name | | :white_check_mark: | input-user-name |
| :white_check_mark: | input-password | | :white_check_mark: | input-password |
| :white_check_mark: | btn-login | | :white_check_mark: | btn-login |

1
dolphinscheduler-ui-next/docs/e2e/navbar.md

@ -1,6 +1,7 @@
### navbar ### navbar
id: id:
- [ ] tabProject - [ ] tabProject
- [ ] tabSecurity - [ ] tabSecurity
- [ ] tabResource - [ ] tabResource

22
dolphinscheduler-ui-next/docs/e2e/project.md

@ -1,6 +1,7 @@
### project ### project
class: class:
- [ ] items-project - [ ] items-project
- [ ] el-popconfirm - [ ] el-popconfirm
- [ ] el-button--primary - [ ] el-button--primary
@ -8,6 +9,7 @@ class:
- [ ] delete - [ ] delete
id: id:
- [ ] btnCreateProject - [ ] btnCreateProject
- [ ] inputProjectName - [ ] inputProjectName
- [ ] btnSubmit - [ ] btnSubmit
@ -15,6 +17,7 @@ id:
#### detail #### detail
class: class:
- [ ] tab-process-definition - [ ] tab-process-definition
- [ ] tab-process-instance - [ ] tab-process-instance
- [ ] tab-task-instance - [ ] tab-task-instance
@ -22,6 +25,7 @@ class:
#### workflow save dialog #### workflow save dialog
class: class:
- [ ] input-param-key - [ ] input-param-key
- [ ] input-param-val - [ ] input-param-val
- [ ] option-tenants - [ ] option-tenants
@ -29,6 +33,7 @@ class:
- [ ] add-dp - [ ] add-dp
id: id:
- [ ] inputName - [ ] inputName
- [ ] btnSubmit - [ ] btnSubmit
- [ ] selectTenant - [ ] selectTenant
@ -36,11 +41,13 @@ id:
#### workflow run dialog #### workflow run dialog
id: id:
- [ ] btnSubmit - [ ] btnSubmit
#### workflow instance tab #### workflow instance tab
class: class:
- [ ] items-workflow-instances - [ ] items-workflow-instances
- [ ] select-all - [ ] select-all
- [ ] btn-delete-all - [ ] btn-delete-all
@ -54,22 +61,26 @@ class:
#### workflow format dialog #### workflow format dialog
class: class:
- [ ] el-dialog__wrapper
- [ ] el-dialog\_\_wrapper
- [ ] el-button--primary - [ ] el-button--primary
#### workflow form #### workflow form
class: class:
- [ ] graph-format - [ ] graph-format
- [ ] task-item-`type` - [ ] task-item-`type`
- [ ] dag-container - [ ] dag-container
id: id:
- [ ] btnSave - [ ] btnSave
#### workflow definition tab #### workflow definition tab
class: class:
- [ ] select-all - [ ] select-all
- [ ] btn-delete-all - [ ] btn-delete-all
- [ ] el-popconfirm - [ ] el-popconfirm
@ -81,11 +92,13 @@ class:
- [ ] btn-cancel-publish - [ ] btn-cancel-publish
id: id:
- [ ] btnCreateProcess - [ ] btnCreateProcess
#### task instance tab #### task instance tab
class: class:
- [ ] items-task-instances - [ ] items-task-instances
- [ ] task-instance-state - [ ] task-instance-state
- [ ] task-instance-name - [ ] task-instance-name
@ -93,18 +106,21 @@ class:
#### switch task form #### switch task form
class: class:
- [ ] switch-task - [ ] switch-task
- [ ] switch-else - [ ] switch-else
- [ ] el-input__inner - [ ] el-input\_\_inner
- [ ] option-else-branches - [ ] option-else-branches
- [ ] option-if-branches - [ ] option-if-branches
id: id:
- [ ] btnAddIfBranch - [ ] btnAddIfBranch
#### switch task if branch #### switch task if branch
class: class:
- [ ] switch-task - [ ] switch-task
- [ ] switch-list - [ ] switch-list
- [ ] el-input - [ ] el-input
@ -112,6 +128,7 @@ class:
#### task node form #### task node form
class: class:
- [ ] input-param-key - [ ] input-param-key
- [ ] input-param-val - [ ] input-param-val
- [ ] pre_tasks-model - [ ] pre_tasks-model
@ -121,5 +138,6 @@ class:
- [ ] option-pre-tasks - [ ] option-pre-tasks
id: id:
- [ ] inputNodeName - [ ] inputNodeName
- [ ] btnSubmit - [ ] btnSubmit

19
dolphinscheduler-ui-next/docs/e2e/resource.md

@ -3,11 +3,13 @@
#### file manage #### file manage
class: class:
- [ ] items - [ ] items
- [ ] el-popconfirm - [ ] el-popconfirm
- [ ] el-button--primary - [ ] el-button--primary
id: id:
- [ ] btnCreateDirectory - [ ] btnCreateDirectory
- [ ] btnCreateFile - [ ] btnCreateFile
- [ ] btnUploadFile - [ ] btnUploadFile
@ -19,6 +21,7 @@ id:
##### create directory ##### create directory
id: id:
- [ ] inputDirectoryName - [ ] inputDirectoryName
- [ ] inputDescription - [ ] inputDescription
- [ ] btnSubmit - [ ] btnSubmit
@ -27,6 +30,7 @@ id:
##### rename directory ##### rename directory
id: id:
- [ ] inputName - [ ] inputName
- [ ] inputDescription - [ ] inputDescription
- [ ] btnSubmit - [ ] btnSubmit
@ -35,6 +39,7 @@ id:
##### create file ##### create file
id: id:
- [ ] inputFileName - [ ] inputFileName
- [ ] btnSubmit - [ ] btnSubmit
- [ ] btnCancel - [ ] btnCancel
@ -42,6 +47,7 @@ id:
##### upload file ##### upload file
id: id:
- [ ] btnUpload - [ ] btnUpload
- [ ] btnSubmit - [ ] btnSubmit
- [ ] btnCancel - [ ] btnCancel
@ -49,11 +55,13 @@ id:
#### function manage #### function manage
class: class:
- [ ] udf-function-items - [ ] udf-function-items
- [ ] el-popconfirm - [ ] el-popconfirm
- [ ] el-button--primary - [ ] el-button--primary
id: id:
- [ ] btnCreateUdfFunction - [ ] btnCreateUdfFunction
- [ ] btnRename - [ ] btnRename
- [ ] btnDelete - [ ] btnDelete
@ -61,9 +69,11 @@ id:
##### create unf function ##### create unf function
class: class:
- [ ] vue-treeselect__menu
- [ ] vue-treeselect\_\_menu
id: id:
- [ ] inputFunctionName - [ ] inputFunctionName
- [ ] inputClassName - [ ] inputClassName
- [ ] btnUdfResourceDropDown - [ ] btnUdfResourceDropDown
@ -74,6 +84,7 @@ id:
##### rename udf function ##### rename udf function
id: id:
- [ ] inputFunctionName - [ ] inputFunctionName
- [ ] inputClassName - [ ] inputClassName
- [ ] inputDescription - [ ] inputDescription
@ -83,6 +94,7 @@ id:
#### resource #### resource
class: class:
- [ ] tab-file-manage - [ ] tab-file-manage
- [ ] tab-udf-resource-manage - [ ] tab-udf-resource-manage
- [ ] tab-function-resource-manage - [ ] tab-function-resource-manage
@ -90,11 +102,13 @@ class:
#### udf manage #### udf manage
class: class:
- [ ] udf-items - [ ] udf-items
- [ ] el-popconfirm - [ ] el-popconfirm
- [ ] el-button--primary - [ ] el-button--primary
id: id:
- [ ] btnCreateDirectory - [ ] btnCreateDirectory
- [ ] btnUploadUdf - [ ] btnUploadUdf
- [ ] btnDownload - [ ] btnDownload
@ -104,6 +118,7 @@ id:
##### rename directory ##### rename directory
id: id:
- [ ] inputName - [ ] inputName
- [ ] inputDescription - [ ] inputDescription
- [ ] btnSubmit - [ ] btnSubmit
@ -112,6 +127,7 @@ id:
##### upload file ##### upload file
id: id:
- [ ] btnUpload - [ ] btnUpload
- [ ] btnSubmit - [ ] btnSubmit
- [ ] btnCancel - [ ] btnCancel
@ -119,6 +135,7 @@ id:
##### create directory ##### create directory
id: id:
- [ ] inputDirectoryName - [ ] inputDirectoryName
- [ ] inputDescription - [ ] inputDescription
- [ ] btnSubmit - [ ] btnSubmit

13
dolphinscheduler-ui-next/docs/e2e/security.md

@ -1,6 +1,7 @@
### security ### security
class: class:
- [ ] tab-tenant-manage - [ ] tab-tenant-manage
- [ ] tab-user-manage - [ ] tab-user-manage
- [ ] tab-worker-group-manage - [ ] tab-worker-group-manage
@ -11,6 +12,7 @@ class:
#### tenant manage #### tenant manage
class: class:
- [ ] items - [ ] items
- [ ] el-popconfirm - [ ] el-popconfirm
- [ ] el-button--primary - [ ] el-button--primary
@ -19,6 +21,7 @@ class:
- [ ] delete - [ ] delete
id: id:
- [ ] btnCreateTenant - [ ] btnCreateTenant
- [ ] inputTenantCode - [ ] inputTenantCode
- [ ] selectQueue - [ ] selectQueue
@ -29,6 +32,7 @@ id:
#### user manage #### user manage
class: class:
- [ ] items - [ ] items
- [ ] el-popconfirm - [ ] el-popconfirm
- [ ] el-button--primary - [ ] el-button--primary
@ -37,6 +41,7 @@ class:
- [ ] delete - [ ] delete
id: id:
- [ ] btnCreateUser - [ ] btnCreateUser
- [ ] inputUserName - [ ] inputUserName
- [ ] inputUserPassword - [ ] inputUserPassword
@ -52,7 +57,7 @@ id:
#### worker group manage #### worker group manage
| check | class | | check | class |
|--------------------|--------------------------------| | ------------------ | ----------------------- |
| :white_check_mark: | items | | :white_check_mark: | items |
| | el-popconfirm | | | el-popconfirm |
| | el-button--primary | | | el-button--primary |
@ -68,7 +73,7 @@ id:
#### queue manage #### queue manage
| check | class | | check | class |
|--------------------|--------------------------------| | ------------------ | ----------------- |
| :white_check_mark: | items | | :white_check_mark: | items |
| :white_check_mark: | queue-name | | :white_check_mark: | queue-name |
| :white_check_mark: | edit | | :white_check_mark: | edit |
@ -81,7 +86,7 @@ id:
#### environment manage #### environment manage
| check | class | | check | class |
|--------------------|--------------------------------| | ------------------ | ------------------------------ |
| :white_check_mark: | items | | :white_check_mark: | items |
| | el-popconfirm | | | el-popconfirm |
| | el-button--primary | | | el-button--primary |
@ -99,7 +104,7 @@ id:
#### token manage #### token manage
| check | class | | check | class |
|--------------------|--------------------| | ------------------ | ------------------ |
| :white_check_mark: | items | | :white_check_mark: | items |
| | el-popconfirm | | | el-popconfirm |
| | el-button--primary | | | el-button--primary |

4
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-delay-time.ts

@ -18,7 +18,7 @@
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import type { IJsonItem } from '../types' import type { IJsonItem } from '../types'
export function useDelayTime(): IJsonItem { export function useDelayTime(model: { [field: string]: any }): IJsonItem {
const { t } = useI18n() const { t } = useI18n()
return { return {
type: 'input-number', type: 'input-number',
@ -28,6 +28,6 @@ export function useDelayTime(): IJsonItem {
slots: { slots: {
suffix: () => t('project.node.minute') suffix: () => t('project.node.minute')
}, },
value: 0 value: model.delayExecutionTime ? model.delayExecutionTime : 0
} }
} }

2
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-task-type.ts

@ -43,6 +43,6 @@ export function useTaskType(
required: true, required: true,
message: t('project.node.task_type_tips') message: t('project.node.task_type_tips')
}, },
value: 'SHELL' value: model.taskType ? model.taskType : 'SHELL'
} }
} }

2
dolphinscheduler-ui-next/src/views/projects/task/components/node/format-data.ts

@ -43,7 +43,7 @@ export function formatParams(data: INodeData): {
'processName' 'processName'
]), ]),
code: data.code, code: data.code,
delayTime: data.delayTime ? '0' : String(data.delayTime), delayTime: data.delayTime ? String(data.delayTime) : '0',
environmentCode: data.environmentCode || -1, environmentCode: data.environmentCode || -1,
failRetryTimes: data.failRetryTimes ? String(data.failRetryTimes) : '0', failRetryTimes: data.failRetryTimes ? String(data.failRetryTimes) : '0',
failRetryInterval: data.failRetryTimes failRetryInterval: data.failRetryTimes

83
dolphinscheduler-ui-next/src/views/projects/task/components/node/tasks/use-python.ts

@ -0,0 +1,83 @@
/*
* 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 usePython({
projectCode,
from = 0,
readonly,
data
}: {
projectCode: number
from?: number
readonly?: boolean
data?: ITaskData
}) {
const model = reactive({
name: '',
taskType: 'PYTHON',
flag: 'YES',
description: '',
timeoutFlag: false,
localParams: [],
environmentCode: null,
failRetryInterval: 1,
failRetryTimes: 0,
workerGroup: 'default',
delayTime: 0,
timeout: 30,
rawScript: ''
} as INodeData)
let extra: IJsonItem[] = []
if (from === 1) {
extra = [
Fields.useTaskType(model, readonly),
Fields.useProcessName({
model,
projectCode,
isCreate: !data?.id,
from,
processName: data?.processName,
code: data?.code
})
]
}
return {
json: [
Fields.useName(),
...extra,
Fields.useRunFlag(),
Fields.useDescription(),
Fields.useTaskPriority(),
Fields.useWorkerGroup(),
Fields.useEnvironmentName(model, !model.id),
...Fields.useTaskGroup(model, projectCode),
...Fields.useFailed(),
Fields.useDelayTime(model),
...Fields.useTimeoutAlarm(model),
...Fields.useShell(model),
Fields.usePreTasks(model)
] as IJsonItem[],
model
}
}

2
dolphinscheduler-ui-next/src/views/projects/task/components/node/tasks/use-shell.ts

@ -71,7 +71,7 @@ export function useShell({
Fields.useEnvironmentName(model, !data?.id), Fields.useEnvironmentName(model, !data?.id),
...Fields.useTaskGroup(model, projectCode), ...Fields.useTaskGroup(model, projectCode),
...Fields.useFailed(), ...Fields.useFailed(),
Fields.useDelayTime(), Fields.useDelayTime(model),
...Fields.useTimeoutAlarm(model), ...Fields.useTimeoutAlarm(model),
...Fields.useShell(model), ...Fields.useShell(model),
Fields.usePreTasks(model) Fields.usePreTasks(model)

9
dolphinscheduler-ui-next/src/views/projects/task/components/node/use-task.ts

@ -16,6 +16,7 @@
*/ */
import { useShell } from './tasks/use-shell' import { useShell } from './tasks/use-shell'
import { usePython } from './tasks/use-python'
import { IJsonItem, INodeData, ITaskData } from './types' import { IJsonItem, INodeData, ITaskData } from './types'
export function useTask({ export function useTask({
@ -39,5 +40,13 @@ export function useTask({
data data
}) })
} }
if (taskType === 'PYTHON') {
node = usePython({
projectCode,
from,
readonly,
data
})
}
return node return node
} }

1
dolphinscheduler-ui-next/src/views/projects/task/definition/index.tsx

@ -77,6 +77,7 @@ const TaskDefinition = defineComponent({
requestData() requestData()
} }
const onCreate = () => { const onCreate = () => {
task.taskReadonly = false
onToggleShow(true) onToggleShow(true)
} }
const onTaskCancel = () => { const onTaskCancel = () => {

13
dolphinscheduler-ui-next/src/views/security/worker-group-manage/index.tsx

@ -106,7 +106,12 @@ const workerGroupManage = defineComponent({
<NCard> <NCard>
<div class={styles['search-card']}> <div class={styles['search-card']}>
<div> <div>
<NButton size='small' type='primary' onClick={handleModalChange} class='btn-create-worker-group'> <NButton
size='small'
type='primary'
onClick={handleModalChange}
class='btn-create-worker-group'
>
{t('security.worker_group.create_worker_group')} {t('security.worker_group.create_worker_group')}
</NButton> </NButton>
</div> </div>
@ -130,7 +135,11 @@ const workerGroupManage = defineComponent({
</div> </div>
</NCard> </NCard>
<Card class={styles['table-card']}> <Card class={styles['table-card']}>
<NDataTable row-class-name='items' columns={this.columns} data={this.tableData} /> <NDataTable
row-class-name='items'
columns={this.columns}
data={this.tableData}
/>
<div class={styles.pagination}> <div class={styles.pagination}>
<NPagination <NPagination
v-model:page={this.page} v-model:page={this.page}

Loading…
Cancel
Save