diff --git a/dolphinscheduler-ui-next/src/service/modules/lineages/index.ts b/dolphinscheduler-ui-next/src/service/modules/lineages/index.ts new file mode 100644 index 0000000000..3b00c7a464 --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/lineages/types.ts b/dolphinscheduler-ui-next/src/service/modules/lineages/types.ts new file mode 100644 index 0000000000..1c748b148e --- /dev/null +++ b/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 } diff --git a/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts b/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts index 832262b427..2371f4ad15 100644 --- a/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts +++ b/dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts @@ -17,95 +17,114 @@ import { axios } from '@/service/service' import { - CodeReq, - ProcessInstanceListReq, - BatchDeleteReq, - SubIdReq, - TaskReq, - LongestReq, - IdReq, - ProcessInstanceReq + CodeReq, + ProcessInstanceListReq, + BatchDeleteReq, + SubIdReq, + TaskReq, + LongestReq, + IdReq, + ProcessInstanceReq, } from './types' -export function queryProcessInstanceListPaging(params: ProcessInstanceListReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances`, - method: 'get', - params, - }) +export function queryProcessInstanceListPaging( + params: ProcessInstanceListReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-instances`, + method: 'get', + params, + }) } -export function batchDeleteProcessInstanceByIds(data: BatchDeleteReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/batch-delete`, - method: 'post', - data, - }) +export function batchDeleteProcessInstanceByIds( + data: BatchDeleteReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-instances/batch-delete`, + method: 'post', + data, + }) } -export function queryParentInstanceBySubId(params: SubIdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/query-parent-by-sub`, - method: 'get', - params, - }) +export function queryParentInstanceBySubId( + params: SubIdReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-instances/query-parent-by-sub`, + method: 'get', + params, + }) } -export function querySubProcessInstanceByTaskCode(params: TaskReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/query-sub-by-parent`, - method: 'get', - params, - }) +export function querySubProcessInstanceByTaskCode( + params: TaskReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-instances/query-sub-by-parent`, + method: 'get', + params, + }) } -export function queryTopNLongestRunningProcessInstance(params: LongestReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/top-n`, - method: 'get', - params, - }) +export function queryTopNLongestRunningProcessInstance( + params: LongestReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-instances/top-n`, + method: 'get', + params, + }) } export function queryProcessInstanceById(id: IdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/${id}`, - method: 'get', - }) + return axios({ + url: `/projects/${code}/process-instances/${id}`, + method: 'get', + }) } -export function updateProcessInstance(data: ProcessInstanceReq, id: IdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/${id}`, - method: 'put', - data - }) +export function updateProcessInstance( + data: ProcessInstanceReq, + id: IdReq, + code: CodeReq +): any { + return axios({ + url: `/projects/${code}/process-instances/${id}`, + method: 'put', + data, + }) } export function deleteProcessInstanceById(id: IdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/${id}`, - method: 'delete', - }) + return axios({ + url: `/projects/${code}/process-instances/${id}`, + method: 'delete', + }) } export function queryTaskListByProcessId(id: IdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/${id}/tasks`, - method: 'get', - }) + return axios({ + url: `/projects/${code}/process-instances/${id}/tasks`, + method: 'get', + }) } export function vieGanttTree(id: IdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/${id}/view-gantt`, - method: 'get', - }) + return axios({ + url: `/projects/${code}/process-instances/${id}/view-gantt`, + method: 'get', + }) } export function viewVariables(id: IdReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}/process-instances/${id}/view-variables`, - method: 'get', - }) + return axios({ + url: `/projects/${code}/process-instances/${id}/view-variables`, + method: 'get', + }) } diff --git a/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts b/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts index 488a142b88..bd1b6f736d 100644 --- a/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts +++ b/dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts @@ -90,5 +90,5 @@ export { TaskReq, LongestReq, IdReq, - ProcessInstanceReq + ProcessInstanceReq, } diff --git a/dolphinscheduler-ui-next/src/service/modules/process-task-relation/index.ts b/dolphinscheduler-ui-next/src/service/modules/process-task-relation/index.ts new file mode 100644 index 0000000000..047f7e81b5 --- /dev/null +++ b/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, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/process-task-relation/types.ts b/dolphinscheduler-ui-next/src/service/modules/process-task-relation/types.ts new file mode 100644 index 0000000000..ad00bf30f8 --- /dev/null +++ b/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, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/projects/index.ts b/dolphinscheduler-ui-next/src/service/modules/projects/index.ts index 43c22911e8..4a61102c67 100644 --- a/dolphinscheduler-ui-next/src/service/modules/projects/index.ts +++ b/dolphinscheduler-ui-next/src/service/modules/projects/index.ts @@ -17,77 +17,77 @@ import { axios } from '@/service/service' import { - ListReq, - ProjectsReq, - UserIdReq, - CodeReq, - UpdateProjectsReq + ListReq, + ProjectsReq, + UserIdReq, + CodeReq, + UpdateProjectsReq, } from './types' export function queryProjectListPaging(params: ListReq): any { - return axios({ - url: `/projects`, - method: 'get', - params, - }) + return axios({ + url: `/projects`, + method: 'get', + params, + }) } export function createProject(data: ProjectsReq): any { - return axios({ - url: `/projects`, - method: 'post', - data, - }) + return axios({ + url: `/projects`, + method: 'post', + data, + }) } export function queryAuthorizedProject(params: UserIdReq): any { - return axios({ - url: `/projects/authed-project`, - method: 'get', - params, - }) + return axios({ + url: `/projects/authed-project`, + method: 'get', + params, + }) } export function queryProjectCreatedAndAuthorizedByUser(): any { - return axios({ - url: `/projects/created-and-authed`, - method: 'get', - }) + return axios({ + url: `/projects/created-and-authed`, + method: 'get', + }) } export function queryAllProjectList(): any { - return axios({ - url: `/projects/list`, - method: 'get', - }) + return axios({ + url: `/projects/list`, + method: 'get', + }) } export function queryUnauthorizedProject(params: UserIdReq): any { - return axios({ - url: `/projects/unauth-project`, - method: 'get', - params - }) + return axios({ + url: `/projects/unauth-project`, + method: 'get', + params, + }) } export function queryProjectByCode(code: CodeReq): any { - return axios({ - url: `/projects/${code}`, - method: 'get', - }) + return axios({ + url: `/projects/${code}`, + method: 'get', + }) } export function updateProject(data: UpdateProjectsReq, code: CodeReq): any { - return axios({ - url: `/projects/${code}`, - method: 'put', - data - }) + return axios({ + url: `/projects/${code}`, + method: 'put', + data, + }) } export function deleteProject(code: CodeReq): any { - return axios({ - url: `/projects/${code}`, - method: 'delete', - }) + return axios({ + url: `/projects/${code}`, + method: 'delete', + }) } diff --git a/dolphinscheduler-ui-next/src/service/modules/projects/types.ts b/dolphinscheduler-ui-next/src/service/modules/projects/types.ts index 288f1c129f..3965a244f9 100644 --- a/dolphinscheduler-ui-next/src/service/modules/projects/types.ts +++ b/dolphinscheduler-ui-next/src/service/modules/projects/types.ts @@ -16,32 +16,26 @@ */ interface ListReq { - pageNo: number - pageSize: number - searchVal?: string + pageNo: number + pageSize: number + searchVal?: string } interface ProjectsReq { - description?: string - projectName?: string + description?: string + projectName?: string } interface UserIdReq { - userId?: number + userId?: number } interface CodeReq { - code: number + code: number } interface UpdateProjectsReq extends ProjectsReq { - userName?: string + userName?: string } -export { - ListReq, - ProjectsReq, - UserIdReq, - CodeReq, - UpdateProjectsReq -} +export { ListReq, ProjectsReq, UserIdReq, CodeReq, UpdateProjectsReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/queues/index.ts b/dolphinscheduler-ui-next/src/service/modules/queues/index.ts index 32e17c5201..a7bf8663ff 100644 --- a/dolphinscheduler-ui-next/src/service/modules/queues/index.ts +++ b/dolphinscheduler-ui-next/src/service/modules/queues/index.ts @@ -16,43 +16,43 @@ */ import { axios } from '@/service/service' -import {ListReq, QueueReq, IdReq} from './types' +import { ListReq, QueueReq, IdReq } from './types' export function queryQueueListPaging(params: ListReq): any { - return axios({ - url: `/queues`, - method: 'get', - params - }) + return axios({ + url: `/queues`, + method: 'get', + params, + }) } export function createQueue(data: QueueReq): any { - return axios({ - url: `/queues`, - method: 'post', - data - }) + return axios({ + url: `/queues`, + method: 'post', + data, + }) } export function queryList(): any { - return axios({ - url: `/queues/list`, - method: 'get', - }) + return axios({ + url: `/queues/list`, + method: 'get', + }) } export function verifyQueue(data: QueueReq): any { - return axios({ - url: `/queues/verify`, - method: 'post', - data - }) + return axios({ + url: `/queues/verify`, + method: 'post', + data, + }) } export function updateQueue(data: QueueReq, id: IdReq): any { - return axios({ - url: `/queues/${id}`, - method: 'put', - data - }) + return axios({ + url: `/queues/${id}`, + method: 'put', + data, + }) } diff --git a/dolphinscheduler-ui-next/src/service/modules/queues/types.ts b/dolphinscheduler-ui-next/src/service/modules/queues/types.ts index f214bfab36..11b34b80f4 100644 --- a/dolphinscheduler-ui-next/src/service/modules/queues/types.ts +++ b/dolphinscheduler-ui-next/src/service/modules/queues/types.ts @@ -16,18 +16,18 @@ */ interface ListReq { - pageNo: number - pageSize: number - searchVal?: string + pageNo: number + pageSize: number + searchVal?: string } interface QueueReq { - queue: string - queueName: string + queue: string + queueName: string } interface IdReq { - id: number + id: number } export { ListReq, QueueReq, IdReq } diff --git a/dolphinscheduler-ui-next/src/service/modules/resources/index.ts b/dolphinscheduler-ui-next/src/service/modules/resources/index.ts index 3e7c6c26f5..9fce316fdb 100644 --- a/dolphinscheduler-ui-next/src/service/modules/resources/index.ts +++ b/dolphinscheduler-ui-next/src/service/modules/resources/index.ts @@ -14,3 +14,235 @@ * See the License for the specific language governing permissions and * 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, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/resources/types.ts b/dolphinscheduler-ui-next/src/service/modules/resources/types.ts index b98d0f7f16..79ec58bdf2 100644 --- a/dolphinscheduler-ui-next/src/service/modules/resources/types.ts +++ b/dolphinscheduler-ui-next/src/service/modules/resources/types.ts @@ -16,40 +16,96 @@ */ interface FileReq { - file: any + file: any } -interface TypeReq { - type: 'FILE' | 'UDF' +interface ResourceTypeReq { + type: 'FILE' | 'UDF' } -interface NameReqReq { - name: string +interface UdfTypeReq { + type: 'HIVE' | 'SPARK' +} + +interface NameReq { + name: string } interface FileNameReq { - fileName: string + fileName: string } -interface ListReq { - id: number - pageNo: number - pageSize: number - type: 'FILE' | 'UDF' - searchVal?: string +interface FullNameReq { + fullName: string } -interface CreateReq extends TypeReq { - currentDir: string - pid: number - description?: string +interface IdReq { + id: number +} + +interface ContentReq { + content: string +} + +interface DescriptionReq { + description?: string +} + +interface CreateReq extends ResourceTypeReq, DescriptionReq { + currentDir: string + pid: number } 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 { - content: string - suffix: string +export { + FileReq, + ResourceTypeReq, + UdfTypeReq, + NameReq, + FileNameReq, + FullNameReq, + IdReq, + ContentReq, + DescriptionReq, + CreateReq, + UserIdReq, + OnlineCreateReq, + ProgramTypeReq, + ListReq, + ViewResourceReq, + ResourceIdReq, + UdfFuncReq, } diff --git a/dolphinscheduler-ui-next/src/service/modules/schedules/index.ts b/dolphinscheduler-ui-next/src/service/modules/schedules/index.ts new file mode 100644 index 0000000000..6b6aaca43b --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/schedules/types.ts b/dolphinscheduler-ui-next/src/service/modules/schedules/types.ts new file mode 100644 index 0000000000..722018fa2c --- /dev/null +++ b/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, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/task-definition/index.ts b/dolphinscheduler-ui-next/src/service/modules/task-definition/index.ts new file mode 100644 index 0000000000..102c2070b2 --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/task-definition/types.ts b/dolphinscheduler-ui-next/src/service/modules/task-definition/types.ts new file mode 100644 index 0000000000..9726500088 --- /dev/null +++ b/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, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/task-instances/index.ts b/dolphinscheduler-ui-next/src/service/modules/task-instances/index.ts new file mode 100644 index 0000000000..24609f495e --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/task-instances/types.ts b/dolphinscheduler-ui-next/src/service/modules/task-instances/types.ts new file mode 100644 index 0000000000..3dbc7b29b6 --- /dev/null +++ b/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 } diff --git a/dolphinscheduler-ui-next/src/service/modules/tenants/index.ts b/dolphinscheduler-ui-next/src/service/modules/tenants/index.ts new file mode 100644 index 0000000000..025282e2a3 --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/tenants/types.ts b/dolphinscheduler-ui-next/src/service/modules/tenants/types.ts new file mode 100644 index 0000000000..59d7d2f007 --- /dev/null +++ b/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 } diff --git a/dolphinscheduler-ui-next/src/service/modules/ui-plugins/index.ts b/dolphinscheduler-ui-next/src/service/modules/ui-plugins/index.ts new file mode 100644 index 0000000000..9b55be3f24 --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/ui-plugins/types.ts b/dolphinscheduler-ui-next/src/service/modules/ui-plugins/types.ts new file mode 100644 index 0000000000..82bec60714 --- /dev/null +++ b/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 } diff --git a/dolphinscheduler-ui-next/src/service/modules/users/index.ts b/dolphinscheduler-ui-next/src/service/modules/users/index.ts new file mode 100644 index 0000000000..8f4e0ff3be --- /dev/null +++ b/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, + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/users/types.ts b/dolphinscheduler-ui-next/src/service/modules/users/types.ts new file mode 100644 index 0000000000..65a5e3477f --- /dev/null +++ b/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, +} diff --git a/dolphinscheduler-ui-next/src/service/modules/worker-groups/index.ts b/dolphinscheduler-ui-next/src/service/modules/worker-groups/index.ts new file mode 100644 index 0000000000..ff11f1410d --- /dev/null +++ b/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', + }) +} diff --git a/dolphinscheduler-ui-next/src/service/modules/worker-groups/types.ts b/dolphinscheduler-ui-next/src/service/modules/worker-groups/types.ts new file mode 100644 index 0000000000..4520a2dc80 --- /dev/null +++ b/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 } diff --git a/dolphinscheduler-ui-next/src/service/service.ts b/dolphinscheduler-ui-next/src/service/service.ts index b3f0fe6424..38b045e90f 100644 --- a/dolphinscheduler-ui-next/src/service/service.ts +++ b/dolphinscheduler-ui-next/src/service/service.ts @@ -25,8 +25,8 @@ const baseRequestConfig: AxiosRequestConfig = { return qs.stringify(params, { arrayFormat: 'repeat' }) }, paramsSerializer: (params) => { - return qs.stringify(params, { arrayFormat: 'repeat'}) - } + return qs.stringify(params, { arrayFormat: 'repeat' }) + }, } const service = axios.create(baseRequestConfig) @@ -42,15 +42,16 @@ service.interceptors.request.use((config: AxiosRequestConfig) => { // The response to intercept service.interceptors.response.use((res: AxiosResponse) => { - // No code will be processed if (res.data.code === undefined) { return res.data } switch (res.data.code) { - case 0: return res.data.data - default: throw new Error(`${res.data.msg}: ${res.config.url}`) + case 0: + return res.data.data + default: + throw new Error(`${res.data.msg}: ${res.config.url}`) } }, err) diff --git a/dolphinscheduler-ui-next/src/views/login/index.tsx b/dolphinscheduler-ui-next/src/views/login/index.tsx index ebd7d42654..7708adaaa2 100644 --- a/dolphinscheduler-ui-next/src/views/login/index.tsx +++ b/dolphinscheduler-ui-next/src/views/login/index.tsx @@ -61,7 +61,7 @@ const login = defineComponent({ const handleLogin = () => { state.loginFormRef.validate((valid: any) => { if (!valid) { - queryLog({...state.loginForm}).then((res: Response) => { + queryLog({ ...state.loginForm }).then((res: Response) => { console.log('res', res) router.push({ path: 'home' }) })