From e54bb8c534a6b5b7a15c5827039d01cfa77ab071 Mon Sep 17 00:00:00 2001 From: dhb52 Date: Mon, 8 Jul 2024 22:48:52 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat(sj=5F1.1.0-beta3):=20=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E5=99=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20Python=20=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/business.ts | 3 ++- src/locales/langs/en-us.ts | 3 ++- src/locales/langs/zh-cn.ts | 3 ++- src/typings/api.d.ts | 4 ++-- src/typings/app.d.ts | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/constants/business.ts b/src/constants/business.ts index 9edfead..62e4b7e 100644 --- a/src/constants/business.ts +++ b/src/constants/business.ts @@ -160,7 +160,8 @@ export const contentTypeOptions = transformRecordToNumberOption(contentTypeRecor /** 执行器类型 */ export const executorTypeRecord: Record = { - 1: 'common.executorType.items.java' + 1: 'common.executorType.items.java', + 2: 'common.executorType.items.python' }; export const executorTypeRecordOptions = transformRecordToNumberOption(executorTypeRecord); diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 7368054..e68e57d 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -135,7 +135,8 @@ const local: App.I18n.Schema = { label: 'Executor Type', form: 'Please enter executor type', items: { - java: 'Java' + java: 'Java', + python: 'Python' } }, taskType: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 9ce9603..c56e91d 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -135,7 +135,8 @@ const local: App.I18n.Schema = { label: '执行器类型', form: '请选择执行器类型', items: { - java: 'Java' + java: 'Java', + python: 'Python' } }, taskType: { diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 7a544a4..54f4ba5 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -91,8 +91,8 @@ declare namespace Api { /** 工作流节点状态 */ type WorkFlowNodeStatus = 0 | 1; - /** 执行器类型 1:Java */ - type ExecutorType = 1; + /** 执行器类型 1:Java 2:Python */ + type ExecutorType = 1 | 2; /** 触发类型 2:固定时间 3:CRON 表达式 99:工作流 */ type TriggerType = 2 | 3 | 99; diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index 5e28fc7..c374e10 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -395,6 +395,7 @@ declare namespace App { form: string; items: { java: string; + python: string; }; }; taskType: { From 66496636e8cfca1ea9c770a0ff052ca9364457ac Mon Sep 17 00:00:00 2001 From: xlsea Date: Tue, 9 Jul 2024 09:55:26 +0800 Subject: [PATCH 02/11] =?UTF-8?q?feat(sj=5F1.1.0-beta3):=20=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=A9=BA=E9=97=B4=E4=B8=8E=E7=BB=84=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/job-task-list-table.vue | 98 ++++++++++++++----- .../workflow/modules/common/detail-card.vue | 85 ++-------------- src/service/api/group.ts | 8 ++ src/service/api/namespace.ts | 8 ++ src/service/api/workflow.ts | 2 +- src/store/modules/theme/index.ts | 2 +- src/views/group/index.vue | 22 ++++- .../batch/modules/job-batch-detail-drawer.vue | 8 +- .../task/modules/job-task-detail-drawer.vue | 4 +- src/views/namespace/index.vue | 26 ++++- 10 files changed, 150 insertions(+), 113 deletions(-) diff --git a/src/components/common/job-task-list-table.vue b/src/components/common/job-task-list-table.vue index e84ea34..fa1c8a8 100644 --- a/src/components/common/job-task-list-table.vue +++ b/src/components/common/job-task-list-table.vue @@ -4,9 +4,9 @@ import { NButton, NCode, NTag } from 'naive-ui'; import hljs from 'highlight.js/lib/core'; import json from 'highlight.js/lib/languages/json'; import { ref, render } from 'vue'; -import { taskStatusRecord } from '@/constants/business'; +import { taskStatusRecord, taskStatusRecordOptions } from '@/constants/business'; import { $t } from '@/locales'; -import { parseArgsJson } from '@/utils/common'; +import { parseArgsJson, translateOptions } from '@/utils/common'; import { useTable } from '@/hooks/common/table'; import { fetchGetJobTaskList, fetchGetJobTaskTree } from '@/service/api'; @@ -19,11 +19,15 @@ hljs.registerLanguage('json', json); interface Props { /** row data */ rowData?: Api.JobBatch.JobBatch | null; + isRetry?: boolean; } -const props = defineProps(); +const props = withDefaults(defineProps(), { + rowData: null +}); interface Emits { + (e: 'retry'): void; (e: 'showLog', rowData: Api.Job.JobTask): void; } @@ -33,7 +37,7 @@ const expandedRowKeys = ref([]); const argsDomMap = ref>(new Map()); -const { columns, columnChecks, data, loading, mobilePagination } = useTable({ +const { columns, searchParams, columnChecks, data, getData, loading, mobilePagination } = useTable({ apiFn: fetchGetJobTaskList, apiParams: { page: 1, @@ -41,7 +45,8 @@ const { columns, columnChecks, data, loading, mobilePagination } = useTable({ groupName: props.rowData?.groupName, taskBatchId: props.rowData?.id, startId: 0, - fromIndex: 0 + fromIndex: 0, + taskStatus: undefined // if you want to use the searchParams in Form, you need to define the following properties, and the value is null // the value can not be undefined, otherwise the property in Form will not be reactive }, @@ -217,6 +222,21 @@ const onUpdatePage = (_: number) => { expandedRowKeys.value = []; }; +async function flushed() { + searchParams.taskStatus = undefined; + await getData(); +} + +const retry = async () => { + emit('retry'); +}; + +const isRetry = () => { + return ( + props.rowData?.taskBatchStatus === 4 || props.rowData?.taskBatchStatus === 5 || props.rowData?.taskBatchStatus === 6 + ); +}; + const init = () => { columnChecks.value = columnChecks.value.filter(column => { if (!['4', '5'].includes(String(props.rowData?.taskType) || '-1')) { @@ -231,24 +251,56 @@ init(); diff --git a/src/components/workflow/modules/common/detail-card.vue b/src/components/workflow/modules/common/detail-card.vue index 9148d3f..06ba969 100644 --- a/src/components/workflow/modules/common/detail-card.vue +++ b/src/components/workflow/modules/common/detail-card.vue @@ -1,19 +1,13 @@ @@ -240,39 +201,7 @@ const onUpdatePage = (page: number) => { - - - - - + diff --git a/src/service/api/group.ts b/src/service/api/group.ts index 3750b7e..e152b3c 100644 --- a/src/service/api/group.ts +++ b/src/service/api/group.ts @@ -59,3 +59,11 @@ export function fetchGetAllGroupConfigList(data: string[]) { data }); } + +/** delete Group by id */ +export function fetchDeleteGroup(id: string) { + return request({ + url: `/group/${id}`, + method: 'delete' + }); +} diff --git a/src/service/api/namespace.ts b/src/service/api/namespace.ts index 80d15b6..c927689 100644 --- a/src/service/api/namespace.ts +++ b/src/service/api/namespace.ts @@ -26,3 +26,11 @@ export function fetchEditNamespace(data: Api.Namespace.Namespace) { data }); } + +/** delete namespace by id */ +export function fetchDeleteNamespace(id: string) { + return request({ + url: `/namespace/${id}`, + method: 'delete' + }); +} diff --git a/src/service/api/workflow.ts b/src/service/api/workflow.ts index d91a191..eb575e6 100644 --- a/src/service/api/workflow.ts +++ b/src/service/api/workflow.ts @@ -60,7 +60,7 @@ export function fetchStopWorkflowBatch(id: string) { export function fetchWorkflowNodeRetry(id: string, workflowNodeId: string) { return request({ url: `/workflow/node/retry/${workflowNodeId}/${id}`, - method: 'get' + method: 'post' }); } diff --git a/src/store/modules/theme/index.ts b/src/store/modules/theme/index.ts index e0f4125..43499a4 100644 --- a/src/store/modules/theme/index.ts +++ b/src/store/modules/theme/index.ts @@ -59,7 +59,7 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => { const { setWatermark, clearWatermark } = useWatermark({ id: 'global_watermark_id' }); /** 开启水印 */ - function toggleWatermark(visible: boolean) { + function toggleWatermark(visible: boolean = false) { visible ? setWatermark(settings.value.watermark.text) : clearWatermark(); } diff --git a/src/views/group/index.vue b/src/views/group/index.vue index 48437cb..1464c11 100644 --- a/src/views/group/index.vue +++ b/src/views/group/index.vue @@ -2,7 +2,7 @@ import { NButton, NPopconfirm, NTag } from 'naive-ui'; import { ref } from 'vue'; import { useBoolean } from '@sa/hooks'; -import { fetchGetGroupConfigList, fetchUpdateGroupStatus } from '@/service/api'; +import { fetchDeleteGroup, fetchGetGroupConfigList, fetchUpdateGroupStatus } from '@/service/api'; import { $t } from '@/locales'; import { useAppStore } from '@/store/modules/app'; import { useTable, useTableOperate } from '@/hooks/common/table'; @@ -142,6 +142,17 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP edit(row.id!)}> {$t('common.edit')} + + handleDelete(row.id!)}> + {{ + default: () => $t('common.confirmDelete'), + trigger: () => ( + + {$t('common.delete')} + + ) + }} + ); } @@ -155,7 +166,8 @@ const { editingData, handleAdd, handleEdit, - checkedRowKeys + checkedRowKeys, + onDeleted // closeDrawer } = useTableOperate(data, getData); @@ -163,6 +175,12 @@ function edit(id: string) { handleEdit(id); } +async function handleDelete(id: string) { + const { error } = await fetchDeleteGroup(id); + if (error) return; + onDeleted(); +} + function body(): Api.GroupConfig.ExportGroupConfig { return { groupName: searchParams.groupName, diff --git a/src/views/job/batch/modules/job-batch-detail-drawer.vue b/src/views/job/batch/modules/job-batch-detail-drawer.vue index 82e0b50..9a5fe81 100644 --- a/src/views/job/batch/modules/job-batch-detail-drawer.vue +++ b/src/views/job/batch/modules/job-batch-detail-drawer.vue @@ -36,7 +36,7 @@ async function openLog(row: Api.Job.JobTask) { - + {{ rowData?.groupName }} {{ rowData?.jobName }} @@ -69,4 +69,8 @@ async function openLog(row: Api.Job.JobTask) { - + diff --git a/src/views/job/task/modules/job-task-detail-drawer.vue b/src/views/job/task/modules/job-task-detail-drawer.vue index 7af4837..829f996 100644 --- a/src/views/job/task/modules/job-task-detail-drawer.vue +++ b/src/views/job/task/modules/job-task-detail-drawer.vue @@ -26,7 +26,7 @@ const visible = defineModel('visible', { diff --git a/src/views/namespace/index.vue b/src/views/namespace/index.vue index 5f5faab..d5a0987 100644 --- a/src/views/namespace/index.vue +++ b/src/views/namespace/index.vue @@ -1,7 +1,7 @@