Browse Source

[Feature][UI Next] Write part of the api method. (#7507)

3.0.0/version-upgrade
songjianet 3 years ago committed by GitHub
parent
commit
0d86a48d1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      dolphinscheduler-ui-next/src/service/modules/lineages/index.ts
  2. 26
      dolphinscheduler-ui-next/src/service/modules/lineages/types.ts
  3. 147
      dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts
  4. 2
      dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts
  5. 106
      dolphinscheduler-ui-next/src/service/modules/process-task-relation/index.ts
  6. 55
      dolphinscheduler-ui-next/src/service/modules/process-task-relation/types.ts
  7. 92
      dolphinscheduler-ui-next/src/service/modules/projects/index.ts
  8. 24
      dolphinscheduler-ui-next/src/service/modules/projects/types.ts
  9. 50
      dolphinscheduler-ui-next/src/service/modules/queues/index.ts
  10. 12
      dolphinscheduler-ui-next/src/service/modules/queues/types.ts
  11. 232
      dolphinscheduler-ui-next/src/service/modules/resources/index.ts
  12. 96
      dolphinscheduler-ui-next/src/service/modules/resources/types.ts
  13. 119
      dolphinscheduler-ui-next/src/service/modules/schedules/index.ts
  14. 88
      dolphinscheduler-ui-next/src/service/modules/schedules/types.ts
  15. 143
      dolphinscheduler-ui-next/src/service/modules/task-definition/index.ts
  16. 71
      dolphinscheduler-ui-next/src/service/modules/task-definition/types.ts
  17. 37
      dolphinscheduler-ui-next/src/service/modules/task-instances/index.ts
  18. 40
      dolphinscheduler-ui-next/src/service/modules/task-instances/types.ts
  19. 65
      dolphinscheduler-ui-next/src/service/modules/tenants/index.ts
  20. 37
      dolphinscheduler-ui-next/src/service/modules/tenants/types.ts
  21. 34
      dolphinscheduler-ui-next/src/service/modules/ui-plugins/index.ts
  22. 26
      dolphinscheduler-ui-next/src/service/modules/ui-plugins/types.ts
  23. 184
      dolphinscheduler-ui-next/src/service/modules/users/index.ts
  24. 106
      dolphinscheduler-ui-next/src/service/modules/users/types.ts
  25. 56
      dolphinscheduler-ui-next/src/service/modules/worker-groups/index.ts
  26. 34
      dolphinscheduler-ui-next/src/service/modules/worker-groups/types.ts
  27. 11
      dolphinscheduler-ui-next/src/service/service.ts
  28. 2
      dolphinscheduler-ui-next/src/views/login/index.tsx

47
dolphinscheduler-ui-next/src/service/modules/lineages/index.ts

@ -0,0 +1,47 @@
/*
* 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 { ProjectCodeReq, WorkFlowNameReq } from './types'
export function queryWorkFlowList(projectCode: ProjectCodeReq): any {
return axios({
url: `/projects/${projectCode}/lineages/list`,
method: 'get',
})
}
export function queryLineageByWorkFlowName(
params: WorkFlowNameReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/lineages/query-by-name`,
method: 'get',
params,
})
}
export function queryLineageByWorkFlowCode(
workFlowCode: WorkFlowNameReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/lineages/${workFlowCode}`,
method: 'get',
})
}

26
dolphinscheduler-ui-next/src/service/modules/lineages/types.ts

@ -0,0 +1,26 @@
/*
* 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 ProjectCodeReq {
projectCode: number
}
interface WorkFlowNameReq {
workFlowName: string
}
export { ProjectCodeReq, WorkFlowNameReq }

147
dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts

@ -17,95 +17,114 @@
import { axios } from '@/service/service' import { axios } from '@/service/service'
import { import {
CodeReq, CodeReq,
ProcessInstanceListReq, ProcessInstanceListReq,
BatchDeleteReq, BatchDeleteReq,
SubIdReq, SubIdReq,
TaskReq, TaskReq,
LongestReq, LongestReq,
IdReq, IdReq,
ProcessInstanceReq ProcessInstanceReq,
} from './types' } from './types'
export function queryProcessInstanceListPaging(params: ProcessInstanceListReq, code: CodeReq): any { export function queryProcessInstanceListPaging(
return axios({ params: ProcessInstanceListReq,
url: `/projects/${code}/process-instances`, code: CodeReq
method: 'get', ): any {
params, return axios({
}) url: `/projects/${code}/process-instances`,
method: 'get',
params,
})
} }
export function batchDeleteProcessInstanceByIds(data: BatchDeleteReq, code: CodeReq): any { export function batchDeleteProcessInstanceByIds(
return axios({ data: BatchDeleteReq,
url: `/projects/${code}/process-instances/batch-delete`, code: CodeReq
method: 'post', ): any {
data, return axios({
}) url: `/projects/${code}/process-instances/batch-delete`,
method: 'post',
data,
})
} }
export function queryParentInstanceBySubId(params: SubIdReq, code: CodeReq): any { export function queryParentInstanceBySubId(
return axios({ params: SubIdReq,
url: `/projects/${code}/process-instances/query-parent-by-sub`, code: CodeReq
method: 'get', ): any {
params, return axios({
}) url: `/projects/${code}/process-instances/query-parent-by-sub`,
method: 'get',
params,
})
} }
export function querySubProcessInstanceByTaskCode(params: TaskReq, code: CodeReq): any { export function querySubProcessInstanceByTaskCode(
return axios({ params: TaskReq,
url: `/projects/${code}/process-instances/query-sub-by-parent`, code: CodeReq
method: 'get', ): any {
params, return axios({
}) url: `/projects/${code}/process-instances/query-sub-by-parent`,
method: 'get',
params,
})
} }
export function queryTopNLongestRunningProcessInstance(params: LongestReq, code: CodeReq): any { export function queryTopNLongestRunningProcessInstance(
return axios({ params: LongestReq,
url: `/projects/${code}/process-instances/top-n`, code: CodeReq
method: 'get', ): any {
params, return axios({
}) url: `/projects/${code}/process-instances/top-n`,
method: 'get',
params,
})
} }
export function queryProcessInstanceById(id: IdReq, code: CodeReq): any { export function queryProcessInstanceById(id: IdReq, code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}/process-instances/${id}`, url: `/projects/${code}/process-instances/${id}`,
method: 'get', method: 'get',
}) })
} }
export function updateProcessInstance(data: ProcessInstanceReq, id: IdReq, code: CodeReq): any { export function updateProcessInstance(
return axios({ data: ProcessInstanceReq,
url: `/projects/${code}/process-instances/${id}`, id: IdReq,
method: 'put', code: CodeReq
data ): any {
}) return axios({
url: `/projects/${code}/process-instances/${id}`,
method: 'put',
data,
})
} }
export function deleteProcessInstanceById(id: IdReq, code: CodeReq): any { export function deleteProcessInstanceById(id: IdReq, code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}/process-instances/${id}`, url: `/projects/${code}/process-instances/${id}`,
method: 'delete', method: 'delete',
}) })
} }
export function queryTaskListByProcessId(id: IdReq, code: CodeReq): any { export function queryTaskListByProcessId(id: IdReq, code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}/process-instances/${id}/tasks`, url: `/projects/${code}/process-instances/${id}/tasks`,
method: 'get', method: 'get',
}) })
} }
export function vieGanttTree(id: IdReq, code: CodeReq): any { export function vieGanttTree(id: IdReq, code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}/process-instances/${id}/view-gantt`, url: `/projects/${code}/process-instances/${id}/view-gantt`,
method: 'get', method: 'get',
}) })
} }
export function viewVariables(id: IdReq, code: CodeReq): any { export function viewVariables(id: IdReq, code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}/process-instances/${id}/view-variables`, url: `/projects/${code}/process-instances/${id}/view-variables`,
method: 'get', method: 'get',
}) })
} }

2
dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts

@ -90,5 +90,5 @@ export {
TaskReq, TaskReq,
LongestReq, LongestReq,
IdReq, IdReq,
ProcessInstanceReq ProcessInstanceReq,
} }

106
dolphinscheduler-ui-next/src/service/modules/process-task-relation/index.ts

@ -0,0 +1,106 @@
/*
* 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 {
ProjectCodeReq,
ProcessDefinitionCodeReq,
PreTaskCodesReq,
PostTaskCodesReq,
TaskCodeReq,
SaveReq,
MoveReq,
} from './types'
import { axios } from '@/service/service'
export function save(data: SaveReq, projectCode: ProjectCodeReq): any {
return axios({
url: `/projects/${projectCode}/process-task-relation`,
method: 'post',
data,
})
}
export function moveRelation(data: MoveReq, projectCode: ProjectCodeReq): any {
return axios({
url: `/projects/${projectCode}/process-task-relation/move`,
method: 'post',
data,
})
}
export function deleteEdge(data: SaveReq): any {
return axios({
url: `/projects/${data.projectCode}/process-task-relation/${data.processDefinitionCode}/${data.preTaskCode}/${data.postTaskCode}`,
method: 'delete',
})
}
export function deleteRelation(
data: ProcessDefinitionCodeReq,
projectCode: ProjectCodeReq,
taskCode: TaskCodeReq
): any {
return axios({
url: `/projects/${projectCode}/process-task-relation/${taskCode}`,
method: 'delete',
data,
})
}
export function queryDownstreamRelation(
projectCode: ProjectCodeReq,
taskCode: TaskCodeReq
): any {
return axios({
url: `/projects/${projectCode}/process-task-relation/${taskCode}/downstream`,
method: 'get',
})
}
export function deleteDownstreamRelation(
data: PostTaskCodesReq,
projectCode: ProjectCodeReq,
taskCode: TaskCodeReq
): any {
return axios({
url: `/projects/${projectCode}/process-task-relation/${taskCode}/downstream`,
method: 'delete',
data,
})
}
export function queryUpstreamRelation(
projectCode: ProjectCodeReq,
taskCode: TaskCodeReq
): any {
return axios({
url: `/projects/${projectCode}/process-task-relation/${taskCode}/upstream`,
method: 'get',
})
}
export function deleteUpstreamRelation(
data: PreTaskCodesReq,
projectCode: ProjectCodeReq,
taskCode: TaskCodeReq
): any {
return axios({
url: `/projects/${projectCode}/process-task-relation/${taskCode}/upstream`,
method: 'delete',
data,
})
}

55
dolphinscheduler-ui-next/src/service/modules/process-task-relation/types.ts

@ -0,0 +1,55 @@
/*
* 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 ProjectCodeReq {
projectCode: string
}
interface ProcessDefinitionCodeReq {
processDefinitionCode: string
}
interface PreTaskCodesReq {
preTaskCodes: string
}
interface PostTaskCodesReq {
postTaskCodes: string
}
interface TaskCodeReq {
taskCode: string
}
interface SaveReq extends ProcessDefinitionCodeReq, ProjectCodeReq {
postTaskCode: string
preTaskCode: string
}
interface MoveReq extends ProcessDefinitionCodeReq, TaskCodeReq {
targetProcessDefinitionCode: string
}
export {
ProjectCodeReq,
ProcessDefinitionCodeReq,
PreTaskCodesReq,
PostTaskCodesReq,
TaskCodeReq,
SaveReq,
MoveReq,
}

92
dolphinscheduler-ui-next/src/service/modules/projects/index.ts

@ -17,77 +17,77 @@
import { axios } from '@/service/service' import { axios } from '@/service/service'
import { import {
ListReq, ListReq,
ProjectsReq, ProjectsReq,
UserIdReq, UserIdReq,
CodeReq, CodeReq,
UpdateProjectsReq UpdateProjectsReq,
} from './types' } from './types'
export function queryProjectListPaging(params: ListReq): any { export function queryProjectListPaging(params: ListReq): any {
return axios({ return axios({
url: `/projects`, url: `/projects`,
method: 'get', method: 'get',
params, params,
}) })
} }
export function createProject(data: ProjectsReq): any { export function createProject(data: ProjectsReq): any {
return axios({ return axios({
url: `/projects`, url: `/projects`,
method: 'post', method: 'post',
data, data,
}) })
} }
export function queryAuthorizedProject(params: UserIdReq): any { export function queryAuthorizedProject(params: UserIdReq): any {
return axios({ return axios({
url: `/projects/authed-project`, url: `/projects/authed-project`,
method: 'get', method: 'get',
params, params,
}) })
} }
export function queryProjectCreatedAndAuthorizedByUser(): any { export function queryProjectCreatedAndAuthorizedByUser(): any {
return axios({ return axios({
url: `/projects/created-and-authed`, url: `/projects/created-and-authed`,
method: 'get', method: 'get',
}) })
} }
export function queryAllProjectList(): any { export function queryAllProjectList(): any {
return axios({ return axios({
url: `/projects/list`, url: `/projects/list`,
method: 'get', method: 'get',
}) })
} }
export function queryUnauthorizedProject(params: UserIdReq): any { export function queryUnauthorizedProject(params: UserIdReq): any {
return axios({ return axios({
url: `/projects/unauth-project`, url: `/projects/unauth-project`,
method: 'get', method: 'get',
params params,
}) })
} }
export function queryProjectByCode(code: CodeReq): any { export function queryProjectByCode(code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}`, url: `/projects/${code}`,
method: 'get', method: 'get',
}) })
} }
export function updateProject(data: UpdateProjectsReq, code: CodeReq): any { export function updateProject(data: UpdateProjectsReq, code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}`, url: `/projects/${code}`,
method: 'put', method: 'put',
data data,
}) })
} }
export function deleteProject(code: CodeReq): any { export function deleteProject(code: CodeReq): any {
return axios({ return axios({
url: `/projects/${code}`, url: `/projects/${code}`,
method: 'delete', method: 'delete',
}) })
} }

24
dolphinscheduler-ui-next/src/service/modules/projects/types.ts

@ -16,32 +16,26 @@
*/ */
interface ListReq { interface ListReq {
pageNo: number pageNo: number
pageSize: number pageSize: number
searchVal?: string searchVal?: string
} }
interface ProjectsReq { interface ProjectsReq {
description?: string description?: string
projectName?: string projectName?: string
} }
interface UserIdReq { interface UserIdReq {
userId?: number userId?: number
} }
interface CodeReq { interface CodeReq {
code: number code: number
} }
interface UpdateProjectsReq extends ProjectsReq { interface UpdateProjectsReq extends ProjectsReq {
userName?: string userName?: string
} }
export { export { ListReq, ProjectsReq, UserIdReq, CodeReq, UpdateProjectsReq }
ListReq,
ProjectsReq,
UserIdReq,
CodeReq,
UpdateProjectsReq
}

50
dolphinscheduler-ui-next/src/service/modules/queues/index.ts

@ -16,43 +16,43 @@
*/ */
import { axios } from '@/service/service' import { axios } from '@/service/service'
import {ListReq, QueueReq, IdReq} from './types' import { ListReq, QueueReq, IdReq } from './types'
export function queryQueueListPaging(params: ListReq): any { export function queryQueueListPaging(params: ListReq): any {
return axios({ return axios({
url: `/queues`, url: `/queues`,
method: 'get', method: 'get',
params params,
}) })
} }
export function createQueue(data: QueueReq): any { export function createQueue(data: QueueReq): any {
return axios({ return axios({
url: `/queues`, url: `/queues`,
method: 'post', method: 'post',
data data,
}) })
} }
export function queryList(): any { export function queryList(): any {
return axios({ return axios({
url: `/queues/list`, url: `/queues/list`,
method: 'get', method: 'get',
}) })
} }
export function verifyQueue(data: QueueReq): any { export function verifyQueue(data: QueueReq): any {
return axios({ return axios({
url: `/queues/verify`, url: `/queues/verify`,
method: 'post', method: 'post',
data data,
}) })
} }
export function updateQueue(data: QueueReq, id: IdReq): any { export function updateQueue(data: QueueReq, id: IdReq): any {
return axios({ return axios({
url: `/queues/${id}`, url: `/queues/${id}`,
method: 'put', method: 'put',
data data,
}) })
} }

12
dolphinscheduler-ui-next/src/service/modules/queues/types.ts

@ -16,18 +16,18 @@
*/ */
interface ListReq { interface ListReq {
pageNo: number pageNo: number
pageSize: number pageSize: number
searchVal?: string searchVal?: string
} }
interface QueueReq { interface QueueReq {
queue: string queue: string
queueName: string queueName: string
} }
interface IdReq { interface IdReq {
id: number id: number
} }
export { ListReq, QueueReq, IdReq } export { ListReq, QueueReq, IdReq }

232
dolphinscheduler-ui-next/src/service/modules/resources/index.ts

@ -14,3 +14,235 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { axios } from '@/service/service'
import {
FileReq,
ResourceTypeReq,
UdfTypeReq,
NameReq,
FileNameReq,
FullNameReq,
IdReq,
ContentReq,
DescriptionReq,
CreateReq,
UserIdReq,
OnlineCreateReq,
ProgramTypeReq,
ListReq,
ViewResourceReq,
ResourceIdReq,
UdfFuncReq,
} from './types'
export function queryResourceListPaging(
params: ListReq & IdReq & ResourceTypeReq
): any {
return axios({
url: '/resources',
method: 'get',
params,
})
}
export function createResource(
data: CreateReq & FileNameReq & NameReq & ResourceTypeReq
): any {
return axios({
url: '/resources',
method: 'post',
data,
})
}
export function authorizedFile(params: UserIdReq): any {
return axios({
url: '/resources/authed-file',
method: 'get',
params,
})
}
export function authorizeResourceTree(params: UserIdReq): any {
return axios({
url: '/resources/authed-resource-tree',
method: 'get',
params,
})
}
export function authUDFFunc(params: UserIdReq): any {
return axios({
url: '/resources/authed-udf-func',
method: 'get',
params,
})
}
export function createDirectory(
data: CreateReq & NameReq & ResourceTypeReq
): any {
return axios({
url: '/resources/directory',
method: 'post',
data,
})
}
export function queryResourceList(params: ResourceTypeReq): any {
return axios({
url: '/resources/list',
method: 'get',
params,
})
}
export function onlineCreateResource(
data: OnlineCreateReq & FileNameReq & ResourceTypeReq
): any {
return axios({
url: '/resources/online-create',
method: 'post',
data,
})
}
export function queryResourceByProgramType(
params: ResourceTypeReq & ProgramTypeReq
): any {
return axios({
url: '/resources/query-by-type',
method: 'get',
params,
})
}
export function queryUdfFuncListPaging(params: ListReq): any {
return axios({
url: '/resources/udf-func',
method: 'get',
params,
})
}
export function queryUdfFuncList(params: UdfTypeReq): any {
return axios({
url: '/resources/udf-func/list',
method: 'get',
params,
})
}
export function verifyUdfFuncName(params: NameReq): any {
return axios({
url: '/resources/udf-func/verify-name',
method: 'get',
params,
})
}
export function deleteUdfFunc(id: IdReq): any {
return axios({
url: `/resources/udf-func/${id}`,
method: 'delete',
})
}
export function unAuthUDFFunc(params: UserIdReq): any {
return axios({
url: `/resources/unauth-udf-func`,
method: 'get',
params,
})
}
export function verifyResourceName(params: FullNameReq & ResourceTypeReq): any {
return axios({
url: '/resources/verify-name',
method: 'get',
params,
})
}
export function queryResource(
params: FullNameReq & ResourceTypeReq,
id: IdReq
): any {
return axios({
url: `/resources/verify-name/${id}`,
method: 'get',
params,
})
}
export function updateResource(
data: NameReq & ResourceTypeReq,
id: IdReq
): any {
return axios({
url: `/resources/${id}`,
method: 'put',
data,
})
}
export function deleteResource(id: IdReq): any {
return axios({
url: `/resources/${id}`,
method: 'delete',
})
}
export function downloadResource(id: IdReq): any {
return axios({
url: `/resources/${id}/download`,
method: 'get',
})
}
export function viewUIUdfFunction(id: IdReq): any {
return axios({
url: `/resources/${id}/udf-func`,
method: 'get',
})
}
export function updateResourceContent(data: ContentReq, id: IdReq): any {
return axios({
url: `/resources/${id}/update-content`,
method: 'put',
data,
})
}
export function viewResource(params: ViewResourceReq, id: IdReq): any {
return axios({
url: `/resources/${id}/view`,
method: 'get',
params,
})
}
export function createUdfFunc(
data: UdfFuncReq,
resourceId: ResourceIdReq
): any {
return axios({
url: `/resources/${resourceId}/udf-func`,
method: 'post',
data,
})
}
export function updateUdfFunc(
data: UdfFuncReq,
resourceId: ResourceIdReq,
id: IdReq
): any {
return axios({
url: `/resources/${resourceId}/udf-func/${id}`,
method: 'put',
data,
})
}

96
dolphinscheduler-ui-next/src/service/modules/resources/types.ts

@ -16,40 +16,96 @@
*/ */
interface FileReq { interface FileReq {
file: any file: any
} }
interface TypeReq { interface ResourceTypeReq {
type: 'FILE' | 'UDF' type: 'FILE' | 'UDF'
} }
interface NameReqReq { interface UdfTypeReq {
name: string type: 'HIVE' | 'SPARK'
}
interface NameReq {
name: string
} }
interface FileNameReq { interface FileNameReq {
fileName: string fileName: string
} }
interface ListReq { interface FullNameReq {
id: number fullName: string
pageNo: number
pageSize: number
type: 'FILE' | 'UDF'
searchVal?: string
} }
interface CreateReq extends TypeReq { interface IdReq {
currentDir: string id: number
pid: number }
description?: string
interface ContentReq {
content: string
}
interface DescriptionReq {
description?: string
}
interface CreateReq extends ResourceTypeReq, DescriptionReq {
currentDir: string
pid: number
} }
interface UserIdReq { interface UserIdReq {
userId: number userId: number
}
interface OnlineCreateReq extends CreateReq, ContentReq {
suffix: string
}
interface ProgramTypeReq {
programType: 'JAVA' | 'SCALA' | 'PYTHON'
}
interface ListReq {
pageNo: number
pageSize: number
searchVal?: string
}
interface ViewResourceReq {
limit: number
skipLineNum: number
}
interface ResourceIdReq {
resourceId: number
}
interface UdfFuncReq extends UdfTypeReq, DescriptionReq {
className: string
funcName: string
argTypes?: string
database?: string
} }
interface OnlineCreateReq extends CreateReq { export {
content: string FileReq,
suffix: string ResourceTypeReq,
UdfTypeReq,
NameReq,
FileNameReq,
FullNameReq,
IdReq,
ContentReq,
DescriptionReq,
CreateReq,
UserIdReq,
OnlineCreateReq,
ProgramTypeReq,
ListReq,
ViewResourceReq,
ResourceIdReq,
UdfFuncReq,
} }

119
dolphinscheduler-ui-next/src/service/modules/schedules/index.ts

@ -0,0 +1,119 @@
/*
* 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 {
ProjectCodeReq,
IdReq,
CodeReq,
ListReq,
ProcessDefinitionCodeReq,
ScheduleReq,
WorkerGroupIdReq,
ScheduleListReq,
CreateScheduleReq,
DeleteScheduleReq,
} from './types'
export function queryScheduleListPaging(
params: ScheduleListReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/schedules`,
method: 'get',
params,
})
}
export function createSchedule(
data: CreateScheduleReq & WorkerGroupIdReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/schedules`,
method: 'post',
data,
})
}
export function queryScheduleList(projectCode: ProjectCodeReq): any {
return axios({
url: `/projects/${projectCode}/schedules/list`,
method: 'post',
})
}
export function previewSchedule(
data: ScheduleReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/schedules/preview`,
method: 'post',
data,
})
}
export function updateScheduleByProcessDefinitionCode(
data: CreateScheduleReq,
projectCode: ProjectCodeReq,
code: CodeReq
): any {
return axios({
url: `/projects/${projectCode}/schedules/update/${code}`,
method: 'put',
data,
})
}
export function updateSchedule(
data: CreateScheduleReq,
projectCode: ProjectCodeReq,
id: IdReq
): any {
return axios({
url: `/projects/${projectCode}/schedules/${id}`,
method: 'put',
data,
})
}
export function deleteScheduleById(
data: DeleteScheduleReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/schedules/${data.id}`,
method: 'delete',
data,
})
}
export function offline(projectCode: ProjectCodeReq, id: IdReq): any {
return axios({
url: `/projects/${projectCode}/schedules/${id}/offline`,
method: 'post',
})
}
export function online(projectCode: ProjectCodeReq, id: IdReq): any {
return axios({
url: `/projects/${projectCode}/schedules/${id}/online`,
method: 'post',
})
}

88
dolphinscheduler-ui-next/src/service/modules/schedules/types.ts

@ -0,0 +1,88 @@
/*
* 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 ProjectCodeReq {
projectCode: number
}
interface IdReq {
id: number
}
interface CodeReq {
code: number
}
interface ListReq {
pageNo: number
pageSize: number
searchVal?: string
}
interface ProcessDefinitionCodeReq {
processDefinitionCode: number
}
interface ScheduleReq {
schedule?: string
}
interface WorkerGroupIdReq {
workerGroupId?: number
}
interface ScheduleListReq extends ListReq, ProcessDefinitionCodeReq {
processDefinitionId: number
}
interface CreateScheduleReq extends ScheduleReq, ProcessDefinitionCodeReq {
environmentCode?: number
failureStrategy?: 'END' | 'CONTINUE'
processInstancePriority?: 'HIGHEST' | 'HIGH' | 'MEDIUM' | 'LOW' | 'LOWEST'
warningGroupId?: number
warningType?: 'NONE' | 'SUCCESS' | 'FAILURE' | 'ALL'
workerGroup?: string
}
interface DeleteScheduleReq extends IdReq {
alertGroup?: string
createTime?: string
email?: string
phone?: string
queue?: string
queueName?: string
state?: number
tenantCode?: string
tenantId?: number
updateTime?: string
userName?: string
userPassword?: string
userType?: 'ADMIN_USER' | 'GENERAL_USER'
}
export {
ProjectCodeReq,
IdReq,
CodeReq,
ListReq,
ProcessDefinitionCodeReq,
ScheduleReq,
WorkerGroupIdReq,
ScheduleListReq,
CreateScheduleReq,
DeleteScheduleReq,
}

143
dolphinscheduler-ui-next/src/service/modules/task-definition/index.ts

@ -0,0 +1,143 @@
/*
* 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 {
PageReq,
ListReq,
ProjectCodeReq,
TaskDefinitionListReq,
TaskDefinitionJsonReq,
GenNumReq,
CodeReq,
TaskDefinitionJsonObjReq,
ReleaseStateReq,
VersionReq,
} from './types'
export function queryTaskDefinitionListPaging(
params: TaskDefinitionListReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition`,
method: 'get',
params,
})
}
export function save(
data: TaskDefinitionJsonReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition`,
method: 'post',
data,
})
}
export function genTaskCodeList(
params: GenNumReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/gen-task-codes`,
method: 'get',
params,
})
}
export function queryTaskDefinitionByCode(
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}`,
method: 'get',
})
}
export function update(
data: TaskDefinitionJsonObjReq,
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}`,
method: 'put',
data,
})
}
export function deleteTaskDefinition(
data: TaskDefinitionJsonObjReq,
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}`,
method: 'put',
data,
})
}
export function releaseTaskDefinition(
data: ReleaseStateReq,
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}/release`,
method: 'post',
data,
})
}
export function queryVersions(
params: PageReq,
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}/versions`,
method: 'get',
params,
})
}
export function switchVersion(
version: VersionReq,
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}/versions/${version}`,
method: 'get',
})
}
export function deleteVersion(
version: VersionReq,
code: CodeReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-definition/${code}/versions/${version}`,
method: 'delete',
})
}

71
dolphinscheduler-ui-next/src/service/modules/task-definition/types.ts

@ -0,0 +1,71 @@
/*
* 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 PageReq {
pageNo: number
pageSize: number
}
interface ListReq extends PageReq {
searchVal?: string
}
interface ProjectCodeReq {
projectCode: number
}
interface TaskDefinitionListReq extends ListReq {
taskType?: string
userId?: number
}
interface TaskDefinitionJsonReq {
taskDefinitionJson: string
}
interface GenNumReq {
genNum: number
}
interface CodeReq {
code: number
}
interface TaskDefinitionJsonObjReq {
taskDefinitionJsonObj: string
}
interface ReleaseStateReq {
releaseState: 'OFFLINE' | 'ONLINE'
}
interface VersionReq {
version: number
}
export {
PageReq,
ListReq,
ProjectCodeReq,
TaskDefinitionListReq,
TaskDefinitionJsonReq,
GenNumReq,
CodeReq,
TaskDefinitionJsonObjReq,
ReleaseStateReq,
VersionReq,
}

37
dolphinscheduler-ui-next/src/service/modules/task-instances/index.ts

@ -0,0 +1,37 @@
/*
* 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 { ProjectCodeReq, IdReq, TaskListReq } from './types'
export function queryTaskListPaging(
params: TaskListReq,
projectCode: ProjectCodeReq
): any {
return axios({
url: `/projects/${projectCode}/task-instances`,
method: 'get',
params,
})
}
export function forceSuccess(id: IdReq, projectCode: ProjectCodeReq): any {
return axios({
url: `/projects/${projectCode}/task-instances/${id}/force-success`,
method: 'post',
})
}

40
dolphinscheduler-ui-next/src/service/modules/task-instances/types.ts

@ -0,0 +1,40 @@
/*
* 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 ProjectCodeReq {
projectCode: number
}
interface IdReq {
id: number
}
interface TaskListReq {
pageNo: number
pageSize: number
endDate?: string
executorName?: string
host?: string
processInstanceId?: number
processInstanceName?: string
searchVal?: string
startDate?: string
stateType?: string
taskName?: string
}
export { ProjectCodeReq, IdReq, TaskListReq }

65
dolphinscheduler-ui-next/src/service/modules/tenants/index.ts

@ -0,0 +1,65 @@
/*
* 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 { ListReq, TenantCodeReq, TenantReq, IdReq } from './types'
export function queryTenantListPaging(params: ListReq): any {
return axios({
url: '/tenants',
method: 'get',
params,
})
}
export function createTenant(data: TenantReq): any {
return axios({
url: '/tenants',
method: 'post',
data,
})
}
export function queryTenantList(): any {
return axios({
url: '/tenants/list',
method: 'get',
})
}
export function verifyTenantCode(params: TenantCodeReq): any {
return axios({
url: '/tenants/verify-code',
method: 'get',
params,
})
}
export function updateTenant(data: TenantCodeReq, id: IdReq): any {
return axios({
url: `/tenants/${id}`,
method: 'put',
data,
})
}
export function deleteTenantById(id: IdReq): any {
return axios({
url: `/tenants/${id}`,
method: 'delete',
})
}

37
dolphinscheduler-ui-next/src/service/modules/tenants/types.ts

@ -0,0 +1,37 @@
/*
* 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 ListReq {
pageNo: number
pageSize: number
searchVal?: string
}
interface TenantCodeReq {
tenantCode: string
}
interface TenantReq extends TenantCodeReq {
queueId: number
description?: string
}
interface IdReq {
id: number
}
export { ListReq, TenantCodeReq, TenantReq, IdReq }

34
dolphinscheduler-ui-next/src/service/modules/ui-plugins/index.ts

@ -0,0 +1,34 @@
/*
* 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 { PluginTypeReq, IdReq } from './types'
export function queryUiPluginsByType(params: PluginTypeReq): any {
return axios({
url: '/ui-plugins/query-by-type',
method: 'get',
params,
})
}
export function queryUiPluginDetailById(id: IdReq): any {
return axios({
url: `/ui-plugins/${id}`,
method: 'get',
})
}

26
dolphinscheduler-ui-next/src/service/modules/ui-plugins/types.ts

@ -0,0 +1,26 @@
/*
* 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 PluginTypeReq {
pluginType: 'ALERT' | 'REGISTER' | 'TASK'
}
interface IdReq {
id: number
}
export { PluginTypeReq, IdReq }

184
dolphinscheduler-ui-next/src/service/modules/users/index.ts

@ -0,0 +1,184 @@
/*
* 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 {
UserNameReq,
UserNamesReq,
AlertGroupIdReq,
UserReq,
IdReq,
UserIdReq,
GrantDataSourceReq,
GrantResourceReq,
GrantProject,
ProjectCodeReq,
GrantUDFReq,
ListAllReq,
ListReq,
RegisterUserReq,
} from './types'
export function activateUser(data: UserNameReq): any {
return axios({
url: '/users/activate',
method: 'post',
data,
})
}
export function authorizedUser(params: AlertGroupIdReq): any {
return axios({
url: '/users/authed-user',
method: 'get',
params,
})
}
export function batchActivateUser(data: UserNamesReq): any {
return axios({
url: '/users/batch/activate',
method: 'post',
data,
})
}
export function createUser(data: UserReq): any {
return axios({
url: '/users/create',
method: 'post',
data,
})
}
export function delUserById(data: IdReq): any {
return axios({
url: '/users/delete',
method: 'post',
data,
})
}
export function getUserInfo(): any {
return axios({
url: '/users/get-user-info',
method: 'get',
})
}
export function grantDataSource(data: GrantDataSourceReq): any {
return axios({
url: '/users/grant-datasource',
method: 'post',
data,
})
}
export function grantResource(data: GrantResourceReq): any {
return axios({
url: '/users/grant-file',
method: 'post',
data,
})
}
export function grantProject(data: GrantProject): any {
return axios({
url: '/users/grant-project',
method: 'post',
data,
})
}
export function grantProjectByCode(data: ProjectCodeReq & UserIdReq): any {
return axios({
url: '/users/grant-project-by-code',
method: 'post',
data,
})
}
export function grantUDFFunc(data: GrantUDFReq & UserIdReq): any {
return axios({
url: '/users/grant-udf-func',
method: 'post',
data,
})
}
export function listUser(): any {
return axios({
url: '/users/list',
method: 'get',
})
}
export function listAll(params: ListAllReq): any {
return axios({
url: '/users/list-all',
method: 'get',
params,
})
}
export function queryUserList(params: ListReq): any {
return axios({
url: '/users/list-paging',
method: 'get',
params,
})
}
export function registerUser(data: RegisterUserReq): any {
return axios({
url: '/users/register',
method: 'post',
data,
})
}
export function revokeProject(data: ProjectCodeReq & UserIdReq): any {
return axios({
url: '/users/revoke-project',
method: 'post',
data,
})
}
export function unauthorizedUser(params: AlertGroupIdReq): any {
return axios({
url: '/users/unauth-user',
method: 'get',
params,
})
}
export function updateUser(data: IdReq & UserReq): any {
return axios({
url: '/users/update',
method: 'post',
data,
})
}
export function verifyUserName(params: UserNameReq): any {
return axios({
url: '/users/verify-user-name',
method: 'get',
params,
})
}

106
dolphinscheduler-ui-next/src/service/modules/users/types.ts

@ -0,0 +1,106 @@
/*
* 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 UserNameReq {
userName?: string
}
interface UserNamesReq {
userNames?: string
}
interface AlertGroupIdReq {
alertgroupId: string
}
interface UserReq {
email: string
tenantId: number
userName: string
userPassword: string
phone?: string
queue?: string
state?: number
}
interface IdReq {
id: number
}
interface UserIdReq {
userId: number
}
interface GrantDataSourceReq extends UserIdReq {
datasourceIds: string
}
interface GrantResourceReq extends UserIdReq {
resourceIds: string
}
interface GrantProject extends UserIdReq {
projectIds: string
}
interface ProjectCodeReq {
projectCode: string
}
interface GrantUDFReq {
udfIds: string
}
interface ListAllReq extends UserReq {
alertGroup?: string
createTime?: string
id?: number
queueName?: string
tenantCode?: string
updateTime?: string
userType?: 'ADMIN_USER' | 'GENERAL_USER'
}
interface ListReq {
pageNo: number
pageSize: number
searchVal?: string
}
interface RegisterUserReq {
email: string
repeatPassword: string
userName: string
userPassword: string
}
export {
UserNameReq,
UserNamesReq,
AlertGroupIdReq,
UserReq,
IdReq,
UserIdReq,
GrantDataSourceReq,
GrantResourceReq,
GrantProject,
ProjectCodeReq,
GrantUDFReq,
ListAllReq,
ListReq,
RegisterUserReq,
}

56
dolphinscheduler-ui-next/src/service/modules/worker-groups/index.ts

@ -0,0 +1,56 @@
/*
* 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 { ListReq, WorkerGroupReq, IdReq } from './types'
export function queryAllWorkerGroupsPaging(params: ListReq): any {
return axios({
url: '/worker-groups',
method: 'get',
params,
})
}
export function saveWorkerGroup(data: WorkerGroupReq): any {
return axios({
url: '/worker-groups',
method: 'post',
data,
})
}
export function queryAllWorkerGroups(): any {
return axios({
url: '/worker-groups/all',
method: 'get',
})
}
export function queryWorkerAddressList(): any {
return axios({
url: '/worker-groups/worker-address-list',
method: 'get',
})
}
export function deleteById(id: IdReq): any {
return axios({
url: `/worker-groups/${id}`,
method: 'delete',
})
}

34
dolphinscheduler-ui-next/src/service/modules/worker-groups/types.ts

@ -0,0 +1,34 @@
/*
* 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 ListReq {
pageNo: number
pageSize: number
searchVal?: string
}
interface WorkerGroupReq {
addrList: string
name: string
id?: number
}
interface IdReq {
id: number
}
export { ListReq, WorkerGroupReq, IdReq }

11
dolphinscheduler-ui-next/src/service/service.ts

@ -25,8 +25,8 @@ const baseRequestConfig: AxiosRequestConfig = {
return qs.stringify(params, { arrayFormat: 'repeat' }) return qs.stringify(params, { arrayFormat: 'repeat' })
}, },
paramsSerializer: (params) => { paramsSerializer: (params) => {
return qs.stringify(params, { arrayFormat: 'repeat'}) return qs.stringify(params, { arrayFormat: 'repeat' })
} },
} }
const service = axios.create(baseRequestConfig) const service = axios.create(baseRequestConfig)
@ -42,15 +42,16 @@ service.interceptors.request.use((config: AxiosRequestConfig<any>) => {
// The response to intercept // The response to intercept
service.interceptors.response.use((res: AxiosResponse) => { service.interceptors.response.use((res: AxiosResponse) => {
// No code will be processed // No code will be processed
if (res.data.code === undefined) { if (res.data.code === undefined) {
return res.data return res.data
} }
switch (res.data.code) { switch (res.data.code) {
case 0: return res.data.data case 0:
default: throw new Error(`${res.data.msg}: ${res.config.url}`) return res.data.data
default:
throw new Error(`${res.data.msg}: ${res.config.url}`)
} }
}, err) }, err)

2
dolphinscheduler-ui-next/src/views/login/index.tsx

@ -61,7 +61,7 @@ const login = defineComponent({
const handleLogin = () => { const handleLogin = () => {
state.loginFormRef.validate((valid: any) => { state.loginFormRef.validate((valid: any) => {
if (!valid) { if (!valid) {
queryLog({...state.loginForm}).then((res: Response) => { queryLog({ ...state.loginForm }).then((res: Response) => {
console.log('res', res) console.log('res', res)
router.push({ path: 'home' }) router.push({ path: 'home' })
}) })

Loading…
Cancel
Save