Browse Source

done (#15724)

dev_wenjun_refactorMaster
calvin 8 months ago committed by GitHub
parent
commit
832826ea52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 75
      dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx

75
dolphinscheduler-ui/src/views/projects/workflow/definition/components/start-modal.tsx

@ -54,6 +54,7 @@ import {
} from '@vicons/antd'
import { IDefinitionData } from '../types'
import styles from '../index.module.scss'
import { queryProjectPreferenceByProjectCode } from '@/service/modules/projects-preference'
const props = {
row: {
@ -172,6 +173,75 @@ export default defineComponent({
]
}
const projectPreferences = ref({} as any)
const initProjectPreferences = async (projectCode: number) => {
if (projectCode) {
await queryProjectPreferenceByProjectCode(projectCode).then(
(result: any) => {
if (result?.preferences && result.state === 1) {
projectPreferences.value = JSON.parse(result.preferences)
}
}
)
}
}
const containValueInOptions = (
options: Array<any>,
findingValue: string
): boolean => {
for (let { value } of options) {
if (findingValue === value) {
return true
}
}
return false
}
const restructureForm = async (form: any) => {
await initProjectPreferences(props.row.projectCode)
if (projectPreferences.value?.taskPriority) {
form.processInstancePriority = projectPreferences.value.taskPriority
}
if (projectPreferences.value?.warningType) {
form.warningType = projectPreferences.value.warningType
}
if (projectPreferences.value?.workerGroup) {
if (
containValueInOptions(
variables.workerGroups,
projectPreferences.value.workerGroup
)
) {
form.workerGroup = projectPreferences.value.workerGroup
}
}
if (projectPreferences.value?.tenant) {
if (
containValueInOptions(
variables.tenantList,
projectPreferences.value.tenant
)
) {
form.tenantCode = projectPreferences.value.tenant
}
}
if (
projectPreferences.value?.environmentCode &&
variables?.environmentList
) {
if (
containValueInOptions(
variables.environmentList,
projectPreferences.value.environmentCode
)
) {
form.environmentCode = projectPreferences.value.environmentCode
}
}
}
const updateWorkerGroup = () => {
startState.startForm.environmentCode = null
}
@ -206,6 +276,7 @@ export default defineComponent({
() => {
if (props.show) {
getStartParamsList(props.row.code)
restructureForm(startState.startForm)
if (props.taskCode)
startState.startForm.startNodeList = props.taskCode
}
@ -438,8 +509,8 @@ export default defineComponent({
</NFormItem>
)}
<NFormItem
label={t('project.workflow.order_of_execution')}
path='executionOrder'
label={t('project.workflow.order_of_execution')}
path='executionOrder'
>
<NRadioGroup v-model:value={this.startForm.executionOrder}>
<NSpace>

Loading…
Cancel
Save