Browse Source

[Fix][UI][V1.0.0-Beta] Replace the back-end interface for dependent task. (#9645)

* queryProjectCreatedAndAuthorizedByUser to queryAllProjectList
* queryAllByProjectCode to queryProcessDefinitionList
* getTasksByDefinitionCode to getTasksByDefinitionList
3.0.0/version-upgrade
Amy0104 3 years ago committed by GitHub
parent
commit
6966a70acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      dolphinscheduler-ui-next/src/service/modules/process-definition/index.ts
  2. 22
      dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-dependent.ts

15
dolphinscheduler-ui-next/src/service/modules/process-definition/index.ts

@ -47,9 +47,9 @@ export function createProcessDefinition(
}) })
} }
export function queryAllByProjectCode(code: number): any { export function queryProcessDefinitionList(projectCode: number): any {
return axios({ return axios({
url: `/projects/${code}/process-definition/all`, url: `/projects/${projectCode}/process-definition/query-process-definition-list`,
method: 'get' method: 'get'
}) })
} }
@ -186,13 +186,16 @@ export function release(
}) })
} }
export function getTasksByDefinitionCode( export function getTasksByDefinitionList(
code: number, projectCode: number,
processCode: number processCode: number
): any { ): any {
return axios({ return axios({
url: `/projects/${code}/process-definition/${processCode}/tasks`, url: `/projects/${projectCode}/process-definition/query-task-definition-list`,
method: 'get' method: 'get',
params: {
processDefinitionCode: processCode
}
}) })
} }

22
dolphinscheduler-ui-next/src/views/projects/task/components/node/fields/use-dependent.ts

@ -18,10 +18,10 @@
import { ref, onMounted, watch } from 'vue' import { ref, onMounted, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useRelationCustomParams, useDependentTimeout } from '.' import { useRelationCustomParams, useDependentTimeout } from '.'
import { queryProjectCreatedAndAuthorizedByUser } from '@/service/modules/projects' import { queryAllProjectList } from '@/service/modules/projects'
import { import {
queryAllByProjectCode, queryProcessDefinitionList,
getTasksByDefinitionCode getTasksByDefinitionList
} from '@/service/modules/process-definition' } from '@/service/modules/process-definition'
import type { IJsonItem, IDependpendItem, IDependTask } from '../types' import type { IJsonItem, IDependpendItem, IDependTask } from '../types'
@ -161,7 +161,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
} }
const getProjectList = async () => { const getProjectList = async () => {
const result = await queryProjectCreatedAndAuthorizedByUser() const result = await queryAllProjectList()
projectList.value = result.map((item: { code: number; name: string }) => ({ projectList.value = result.map((item: { code: number; name: string }) => ({
value: item.code, value: item.code,
label: item.name label: item.name
@ -172,13 +172,11 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
if (processCache[code]) { if (processCache[code]) {
return processCache[code] return processCache[code]
} }
const result = await queryAllByProjectCode(code) const result = await queryProcessDefinitionList(code)
const processList = result.map( const processList = result.map((item: { code: number; name: string }) => ({
(item: { processDefinition: { code: number; name: string } }) => ({ value: item.code,
value: item.processDefinition.code, label: item.name
label: item.processDefinition.name }))
})
)
processCache[code] = processList processCache[code] = processList
return processList return processList
@ -188,7 +186,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] {
if (taskCache[processCode]) { if (taskCache[processCode]) {
return taskCache[processCode] return taskCache[processCode]
} }
const result = await getTasksByDefinitionCode(code, processCode) const result = await getTasksByDefinitionList(code, processCode)
const taskList = result.map((item: { code: number; name: string }) => ({ const taskList = result.map((item: { code: number; name: string }) => ({
value: item.code, value: item.code,
label: item.name label: item.name

Loading…
Cancel
Save