From 1e273b3d95d746d8451881863938f97ee6ccc868 Mon Sep 17 00:00:00 2001 From: Rouni Date: Thu, 22 Feb 2024 15:47:25 +0800 Subject: [PATCH] repo-sync-2024-02-22T15:47:15+0800 --- LEGAL.md | 8 +- package.json | 4 +- .../login/component/change-password/index.tsx | 2 +- src/modules/login/login.service.ts | 2 +- src/modules/node/node.service.ts | 2 +- src/modules/task-details/index.less | 2 +- src/services/ezpsi-board/DataController.ts | 17 +- src/services/ezpsi-board/NodeController.ts | 23 ++- .../ezpsi-board/NodeRouteController.ts | 32 +++- src/services/ezpsi-board/ProjectController.ts | 180 +++++++++++------- src/services/ezpsi-board/UserController.ts | 5 +- src/services/ezpsi-board/typings.d.ts | 6 +- 12 files changed, 178 insertions(+), 105 deletions(-) diff --git a/LEGAL.md b/LEGAL.md index f968920..779629f 100644 --- a/LEGAL.md +++ b/LEGAL.md @@ -1,7 +1,11 @@ Legal Disclaimer -Within this source code, the comments in Chinese shall be the original, governing version. Any comment in other languages are for reference only. In the event of any conflict between the Chinese language version comments and other language version comments, the Chinese language version shall prevail. +Within this source code, the comments in Chinese shall be the original, governing +version. Any comment in other languages are for reference only. In the event of any +conflict between the Chinese language version comments and other language version +comments, the Chinese language version shall prevail. 法律免责声明 -关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。 \ No newline at end of file +关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存 +在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。 diff --git a/package.json b/package.json index a7f9331..c677c0f 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,12 @@ "start": "pnpm run dev", "lint": "umi lint", "prepare": "husky install", + "ci": "pnpm run lint:js & pnpm run lint:css & pnpm run lint:format", "lint:js": "eslint 'src/**/*.{js,jsx,ts,tsx}'", "lint:css": "stylelint --allow-empty-input 'src/**/*.{css,less}'", "lint:format": "prettier --check *.json 'src/**/*.{js,jsx,ts,tsx,css,less,md,json}'", - "lint:typing": "tsc --noEmit" + "lint:typing": "tsc --noEmit", + "format-all": "prettier --write '**/src/**/*.{html,js,jsx,ts,tsx,css,less,json}' **/*.md" }, "dependencies": { "@ant-design/icons": "^5.2.6", diff --git a/src/modules/login/component/change-password/index.tsx b/src/modules/login/component/change-password/index.tsx index 3c561f1..b838c09 100644 --- a/src/modules/login/component/change-password/index.tsx +++ b/src/modules/login/component/change-password/index.tsx @@ -28,7 +28,7 @@ export const ChangePasswordModal = ({ visible, close }: IChangePasswordModal) => value.newPassword, value.verifiedNewPassword, ); - if (status?.code == 0) { + if (status?.code === 0) { message.success('账户密码修改成功'); close(); await API.AuthController.logout( diff --git a/src/modules/login/login.service.ts b/src/modules/login/login.service.ts index 6a21f88..e99cd0f 100644 --- a/src/modules/login/login.service.ts +++ b/src/modules/login/login.service.ts @@ -45,6 +45,6 @@ export class LoginService extends Model { newPasswordHash: sha256(newPwd).toString(), confirmPasswordHash: sha256(verifiedNewPwd).toString(), }); - return res.status + return res.status; }; } diff --git a/src/modules/node/node.service.ts b/src/modules/node/node.service.ts index 800ce17..c2d1f2a 100644 --- a/src/modules/node/node.service.ts +++ b/src/modules/node/node.service.ts @@ -29,7 +29,7 @@ export class NodeService extends Model implements NodeServiceProtocol { nodeRemark?: string; srcNetAddress: string; }): Promise { - const { status } = await API.NodeController.createNode({ ...info}); + const { status } = await API.NodeController.createNode({ ...info }); if (status?.code !== 0) throw new Error(status?.msg); } async deleteNodeRoute(routerId: string): Promise { diff --git a/src/modules/task-details/index.less b/src/modules/task-details/index.less index 3568050..1d4658b 100644 --- a/src/modules/task-details/index.less +++ b/src/modules/task-details/index.less @@ -149,7 +149,7 @@ margin-bottom: 12px; } - .ant-descriptions-row{ + .ant-descriptions-row { .ant-descriptions-item { padding-bottom: 12px; } diff --git a/src/services/ezpsi-board/DataController.ts b/src/services/ezpsi-board/DataController.ts index 818473e..0d8eb0b 100644 --- a/src/services/ezpsi-board/DataController.ts +++ b/src/services/ezpsi-board/DataController.ts @@ -7,14 +7,17 @@ export async function queryDataTableInformation( body?: API.GetDataTableInformatinoRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/data/count', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/data/count', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** 此处后端没有提供注释 POST /api/v1alpha1/data/version */ diff --git a/src/services/ezpsi-board/NodeController.ts b/src/services/ezpsi-board/NodeController.ts index 85d26c9..33cc38b 100644 --- a/src/services/ezpsi-board/NodeController.ts +++ b/src/services/ezpsi-board/NodeController.ts @@ -6,7 +6,10 @@ import request from 'umi-request'; @param request create node request @return successful SecretPadResponse with nodeId POST /api/v1alpha1/node/create */ -export async function createNode(body?: API.CreateNodeRequest, options?: { [key: string]: any }) { +export async function createNode( + body?: API.CreateNodeRequest, + options?: { [key: string]: any }, +) { return request('/api/v1alpha1/node/create', { method: 'POST', headers: { @@ -18,7 +21,10 @@ export async function createNode(body?: API.CreateNodeRequest, options?: { [key: } /** 此处后端没有提供注释 POST /api/v1alpha1/node/delete */ -export async function deleteNode(body?: API.DeleteNodeIdRequest, options?: { [key: string]: any }) { +export async function deleteNode( + body?: API.DeleteNodeIdRequest, + options?: { [key: string]: any }, +) { return request('/api/v1alpha1/node/delete', { method: 'POST', headers: { @@ -74,9 +80,12 @@ export async function upload(files?: File[], options?: { [key: string]: any }) { if (files) { formData.append('file', files[0] || ''); } - return request('/api/v1alpha1/node/upload', { - method: 'POST', - data: formData, - ...(options || {}), - }); + return request( + '/api/v1alpha1/node/upload', + { + method: 'POST', + data: formData, + ...(options || {}), + }, + ); } diff --git a/src/services/ezpsi-board/NodeRouteController.ts b/src/services/ezpsi-board/NodeRouteController.ts index 3ef3dc7..6e96d58 100644 --- a/src/services/ezpsi-board/NodeRouteController.ts +++ b/src/services/ezpsi-board/NodeRouteController.ts @@ -14,19 +14,28 @@ export async function queryCollaborationList(options?: { [key: string]: any }) { } /** 此处后端没有提供注释 POST /api/v1alpha1/nodeRoute/refresh */ -export async function refresh(body?: API.RouterIdRequest, options?: { [key: string]: any }) { - return request('/api/v1alpha1/nodeRoute/refresh', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', +export async function refresh( + body?: API.RouterIdRequest, + options?: { [key: string]: any }, +) { + return request( + '/api/v1alpha1/nodeRoute/refresh', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** 此处后端没有提供注释 POST /api/v1alpha1/nodeRoute/test */ -export async function test(body?: API.RouterAddressRequest, options?: { [key: string]: any }) { +export async function test( + body?: API.RouterAddressRequest, + options?: { [key: string]: any }, +) { return request('/api/v1alpha1/nodeRoute/test', { method: 'POST', headers: { @@ -38,7 +47,10 @@ export async function test(body?: API.RouterAddressRequest, options?: { [key: st } /** 此处后端没有提供注释 POST /api/v1alpha1/nodeRoute/update */ -export async function update(body?: API.UpdateNodeRouterRequest, options?: { [key: string]: any }) { +export async function update( + body?: API.UpdateNodeRouterRequest, + options?: { [key: string]: any }, +) { return request('/api/v1alpha1/nodeRoute/update', { method: 'POST', headers: { diff --git a/src/services/ezpsi-board/ProjectController.ts b/src/services/ezpsi-board/ProjectController.ts index e59f096..92fdadb 100644 --- a/src/services/ezpsi-board/ProjectController.ts +++ b/src/services/ezpsi-board/ProjectController.ts @@ -46,14 +46,17 @@ export async function continueKusciaJob( body?: API.StopProjectJobTaskRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/continue/kuscia', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/job/continue/kuscia', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Create project job api @@ -64,14 +67,17 @@ export async function createJob( body?: API.CreateProjectJobRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/create', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/job/create', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Create project job api @@ -82,14 +88,17 @@ export async function createKusciaJob( body?: API.CreateProjectJobTaskRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/create/kuscia', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/job/create/kuscia', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Delete project job api @@ -118,14 +127,17 @@ export async function downloadProjectResult( body?: API.DownloadProjectResult, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/result/download', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/job/result/download', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Query csv data header @@ -135,14 +147,17 @@ export async function getDataHeader( body?: API.GetProjectJobDataHeaderRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/data/header', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/data/header', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Query csv data table @@ -152,21 +167,27 @@ export async function getDataTable( body?: API.GetProjectJobTableRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/data/table', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/data/table', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Query project job detail api @param request get project job request @return successful SecretPadResponse with project job view object POST /api/v1alpha1/project/job/get */ -export async function getJob(body?: API.GetProjectJobRequest, options?: { [key: string]: any }) { +export async function getJob( + body?: API.GetProjectJobRequest, + options?: { [key: string]: any }, +) { return request('/api/v1alpha1/project/job/get', { method: 'POST', headers: { @@ -184,14 +205,17 @@ export async function getProjectLogs( body?: API.GetProjectJobLogRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/logs', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/job/logs', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Download project result api @@ -209,24 +233,30 @@ export async function getloadProjectResult( }, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/result/download', { - method: 'GET', - params: { - ...params, - response: undefined, - ...params['response'], - request: undefined, - ...params['request'], + return request( + '/api/v1alpha1/project/job/result/download', + { + method: 'GET', + params: { + ...params, + response: undefined, + ...params['response'], + request: undefined, + ...params['request'], + }, + ...(options || {}), }, - ...(options || {}), - }); + ); } /** Paging list project job list api @param request list project job request @return successful SecretPadResponse with paging project job view object POST /api/v1alpha1/project/job/list */ -export async function listJob(body?: API.ListProjectJobRequest, options?: { [key: string]: any }) { +export async function listJob( + body?: API.ListProjectJobRequest, + options?: { [key: string]: any }, +) { return request( '/api/v1alpha1/project/job/list', { @@ -266,24 +296,30 @@ export async function pauseKusciaJob( body?: API.StopProjectJobTaskRequest, options?: { [key: string]: any }, ) { - return request('/api/v1alpha1/project/job/pause/kuscia', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', + return request( + '/api/v1alpha1/project/job/pause/kuscia', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), }, - data: body, - ...(options || {}), - }); + ); } /** Query project edge job list @return project job view object list POST /api/v1alpha1/project/edge/job/list */ export async function queryEdgeProjectJobs(options?: { [key: string]: any }) { - return request('/api/v1alpha1/project/edge/job/list', { - method: 'POST', - ...(options || {}), - }); + return request( + '/api/v1alpha1/project/edge/job/list', + { + method: 'POST', + ...(options || {}), + }, + ); } /** Reject project job api diff --git a/src/services/ezpsi-board/UserController.ts b/src/services/ezpsi-board/UserController.ts index 0ee0155..943644f 100644 --- a/src/services/ezpsi-board/UserController.ts +++ b/src/services/ezpsi-board/UserController.ts @@ -16,7 +16,10 @@ export async function get(options?: { [key: string]: any }) { @param userUpdatePwdRequest @return {@link SecretPadResponse }<{@link Boolean }> POST /api/v1alpha1/user/updatePwd */ -export async function updatePwd(body?: API.UserUpdatePwdRequest, options?: { [key: string]: any }) { +export async function updatePwd( + body?: API.UserUpdatePwdRequest, + options?: { [key: string]: any }, +) { return request('/api/v1alpha1/user/updatePwd', { method: 'POST', headers: { diff --git a/src/services/ezpsi-board/typings.d.ts b/src/services/ezpsi-board/typings.d.ts index c687901..0aaf9c6 100644 --- a/src/services/ezpsi-board/typings.d.ts +++ b/src/services/ezpsi-board/typings.d.ts @@ -262,7 +262,11 @@ declare namespace API { | 202011914 | 'PROJECT_JOB_RESULT_HASH_EXPIRED_ERROR'; - type KusciaGrpcErrorCode = 202012101 | 'RPC_ERROR' | 202012102 | 'KUSCIA_CPMMECT_ERROR'; + type KusciaGrpcErrorCode = + | 202012101 + | 'RPC_ERROR' + | 202012102 + | 'KUSCIA_CPMMECT_ERROR'; interface ListProjectJobRequest { /** What page is currently requested? Note that starting at 1 represents the first page */