Browse Source

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

songjianet 3 years ago
parent
commit
2f7a406ea9

+ 95 - 0
dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts

@@ -14,3 +14,98 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+import { axios } from '@/service/service'
+import {
+	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 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 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 queryProcessInstanceById(id: IdReq, code: CodeReq): any {
+	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 deleteProcessInstanceById(id: IdReq, code: CodeReq): any {
+	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',
+	})
+}
+
+export function vieGanttTree(id: IdReq, code: CodeReq): any {
+	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',
+	})
+}

+ 23 - 0
dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts

@@ -69,3 +69,26 @@ interface LongestReq {
 interface IdReq {
   id: number
 }
+
+interface ProcessInstanceReq {
+  syncDefine: string
+  flag?: string
+  globalParams?: string
+  locations?: string
+  scheduleTime?: string
+  taskDefinitionJson?: string
+  taskRelationJson?: string
+  tenantCode?: string
+  timeout?: string
+}
+
+export {
+  CodeReq,
+  ProcessInstanceListReq,
+  BatchDeleteReq,
+  SubIdReq,
+  TaskReq,
+  LongestReq,
+  IdReq,
+  ProcessInstanceReq
+}

+ 93 - 0
dolphinscheduler-ui-next/src/service/modules/projects/index.ts

@@ -0,0 +1,93 @@
+/*
+ * 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,
+	ProjectsReq,
+	UserIdReq,
+	CodeReq,
+	UpdateProjectsReq
+} from './types'
+
+export function queryProjectListPaging(params: ListReq): any {
+	return axios({
+		url: `/projects`,
+		method: 'get',
+		params,
+	})
+}
+
+export function createProject(data: ProjectsReq): any {
+	return axios({
+		url: `/projects`,
+		method: 'post',
+		data,
+	})
+}
+
+export function queryAuthorizedProject(params: UserIdReq): any {
+	return axios({
+		url: `/projects/authed-project`,
+		method: 'get',
+		params,
+	})
+}
+
+export function queryProjectCreatedAndAuthorizedByUser(): any {
+	return axios({
+		url: `/projects/created-and-authed`,
+		method: 'get',
+	})
+}
+
+export function queryAllProjectList(): any {
+	return axios({
+		url: `/projects/list`,
+		method: 'get',
+	})
+}
+
+export function queryUnauthorizedProject(params: UserIdReq): any {
+	return axios({
+		url: `/projects/unauth-project`,
+		method: 'get',
+		params
+	})
+}
+
+export function queryProjectByCode(code: CodeReq): any {
+	return axios({
+		url: `/projects/${code}`,
+		method: 'get',
+	})
+}
+
+export function updateProject(data: UpdateProjectsReq, code: CodeReq): any {
+	return axios({
+		url: `/projects/${code}`,
+		method: 'put',
+		data
+	})
+}
+
+export function deleteProject(code: CodeReq): any {
+	return axios({
+		url: `/projects/${code}`,
+		method: 'delete',
+	})
+}

+ 47 - 0
dolphinscheduler-ui-next/src/service/modules/projects/types.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.
+ */
+
+interface ListReq {
+	pageNo: number
+	pageSize: number
+	searchVal?: string
+}
+
+interface ProjectsReq {
+	description?: string
+	projectName?: string
+}
+
+interface UserIdReq {
+	userId?: number
+}
+
+interface CodeReq {
+	code: number
+}
+
+interface UpdateProjectsReq extends ProjectsReq {
+	userName?: string
+}
+
+export {
+	ListReq,
+	ProjectsReq,
+	UserIdReq,
+	CodeReq,
+	UpdateProjectsReq
+}

+ 58 - 0
dolphinscheduler-ui-next/src/service/modules/queues/index.ts

@@ -0,0 +1,58 @@
+/*
+ * 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, QueueReq, IdReq} from './types'
+
+export function queryQueueListPaging(params: ListReq): any {
+	return axios({
+		url: `/queues`,
+		method: 'get',
+		params
+	})
+}
+
+export function createQueue(data: QueueReq): any {
+	return axios({
+		url: `/queues`,
+		method: 'post',
+		data
+	})
+}
+
+export function queryList(): any {
+	return axios({
+		url: `/queues/list`,
+		method: 'get',
+	})
+}
+
+export function verifyQueue(data: QueueReq): any {
+	return axios({
+		url: `/queues/verify`,
+		method: 'post',
+		data
+	})
+}
+
+export function updateQueue(data: QueueReq, id: IdReq): any {
+	return axios({
+		url: `/queues/${id}`,
+		method: 'put',
+		data
+	})
+}

+ 33 - 0
dolphinscheduler-ui-next/src/service/modules/queues/types.ts

@@ -0,0 +1,33 @@
+/*
+ * 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 QueueReq {
+	queue: string
+	queueName: string
+}
+
+interface IdReq {
+	id: number
+}
+
+export { ListReq, QueueReq, IdReq }

+ 16 - 0
dolphinscheduler-ui-next/src/service/modules/resources/index.ts

@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */

+ 55 - 0
dolphinscheduler-ui-next/src/service/modules/resources/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 FileReq {
+	file: any
+}
+
+interface TypeReq {
+	type: 'FILE' | 'UDF'
+}
+
+interface NameReqReq {
+	name: string
+}
+
+interface FileNameReq {
+	fileName: string
+}
+
+interface ListReq {
+	id: number
+	pageNo: number
+	pageSize: number
+	type: 'FILE' | 'UDF'
+	searchVal?: string
+}
+
+interface CreateReq extends TypeReq {
+	currentDir: string
+	pid: number
+	description?: string
+}
+
+interface UserIdReq {
+	userId: number
+}
+
+interface OnlineCreateReq extends CreateReq {
+	content: string
+	suffix: string
+}