feat(sj_1.1.0-beta3): 优化删除

This commit is contained in:
opensnail 2024-07-09 23:50:25 +08:00
parent 863f8cf5ce
commit 07af1b6553
10 changed files with 16 additions and 37 deletions

View File

@ -61,9 +61,9 @@ export function fetchGetAllGroupConfigList(data: string[]) {
} }
/** delete group by id */ /** delete group by id */
export function fetchDeleteGroup(id: string) { export function fetchDeleteGroup(groupName: string) {
return request<boolean>({ return request<boolean>({
url: `/group/${id}`, url: `/group/${groupName}`,
method: 'delete' method: 'delete'
}); });
} }

View File

@ -71,14 +71,6 @@ export function fetchUpdateJobStatus(data: Api.Job.JobUpdateJobStatusRequestVO)
}); });
} }
/** delete Job by id */
export function fetchDeleteJob(id: string) {
return request<boolean>({
url: `/job/${id}`,
method: 'delete'
});
}
/** batch delete Job by id */ /** batch delete Job by id */
export function fetchBatchDeleteJob(data: string[]) { export function fetchBatchDeleteJob(data: string[]) {
return request<boolean>({ return request<boolean>({

View File

@ -28,9 +28,9 @@ export function fetchEditNamespace(data: Api.Namespace.Namespace) {
} }
/** delete namespace by id */ /** delete namespace by id */
export function fetchDeleteNamespace(id: string) { export function fetchDeleteNamespace(uniqueId: string) {
return request<boolean>({ return request<boolean>({
url: `/namespace/${id}`, url: `/namespace/${uniqueId}`,
method: 'delete' method: 'delete'
}); });
} }

View File

@ -43,13 +43,6 @@ export function fetchUpdateWorkflowStatus(id: string) {
}); });
} }
export function fetchDelWorkflow(id: string) {
return request({
url: `/workflow/${id}`,
method: 'delete'
});
}
export function fetchBatchDeleteWorkflow(data: string[]) { export function fetchBatchDeleteWorkflow(data: string[]) {
return request({ return request({
url: '/workflow/ids', url: '/workflow/ids',

View File

@ -138,7 +138,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
{$t('common.edit')} {$t('common.edit')}
</NButton> </NButton>
<n-divider vertical /> <n-divider vertical />
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}> <NPopconfirm onPositiveClick={() => handleDelete(row.groupName!)}>
{{ {{
default: () => $t('common.confirmDelete'), default: () => $t('common.confirmDelete'),
trigger: () => ( trigger: () => (
@ -170,8 +170,8 @@ function edit(id: string) {
handleEdit(id); handleEdit(id);
} }
async function handleDelete(id: string) { async function handleDelete(groupName: string) {
const { error } = await fetchDeleteGroup(id); const { error } = await fetchDeleteGroup(groupName);
if (error) return; if (error) return;
onDeleted(); onDeleted();
} }

View File

@ -2,13 +2,7 @@
import { NButton, NPopconfirm, NTag } from 'naive-ui'; import { NButton, NPopconfirm, NTag } from 'naive-ui';
import { useBoolean } from '@sa/hooks'; import { useBoolean } from '@sa/hooks';
import { ref } from 'vue'; import { ref } from 'vue';
import { import { fetchBatchDeleteJob, fetchGetJobPage, fetchTriggerJob, fetchUpdateJobStatus } from '@/service/api';
fetchBatchDeleteJob,
fetchDeleteJob,
fetchGetJobPage,
fetchTriggerJob,
fetchUpdateJobStatus
} from '@/service/api';
import { $t } from '@/locales'; import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app'; import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table'; import { useTable, useTableOperate } from '@/hooks/common/table';
@ -241,7 +235,7 @@ const {
} = useTableOperate(data, getData); } = useTableOperate(data, getData);
async function handleDelete(id: string) { async function handleDelete(id: string) {
const { error } = await fetchDeleteJob(id); const { error } = await fetchBatchDeleteJob([id]);
if (error) return; if (error) return;
onDeleted(); onDeleted();
} }

View File

@ -90,7 +90,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
{$t('common.switch')} {$t('common.switch')}
</NButton> </NButton>
<n-divider vertical /> <n-divider vertical />
<NPopconfirm onPositiveClick={() => handleDelete(row.id!)}> <NPopconfirm onPositiveClick={() => handleDelete(row.uniqueId!)}>
{{ {{
default: () => $t('common.confirmDelete'), default: () => $t('common.confirmDelete'),
trigger: () => ( trigger: () => (
@ -125,8 +125,8 @@ function edit(id: string) {
handleEdit(id); handleEdit(id);
} }
async function handleDelete(id: string) { async function handleDelete(uniqueId: string) {
const { error } = await fetchDeleteNamespace(id); const { error } = await fetchDeleteNamespace(uniqueId);
if (error) return; if (error) return;
onDeleted(); onDeleted();
} }

View File

@ -42,7 +42,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
type: 'selection', type: 'selection',
align: 'center', align: 'center',
width: 48, width: 48,
disabled: row => row.retryStatus !== 1 disabled: row => row.retryStatus === 0
}, },
{ {
key: 'id', key: 'id',

View File

@ -43,7 +43,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
{ {
type: 'selection', type: 'selection',
align: 'center', align: 'center',
width: 48 width: 48,
disabled: row => row.retryStatus === 0
}, },
{ {
key: 'id', key: 'id',

View File

@ -3,7 +3,6 @@ import { NButton, NDropdown, NPopconfirm, NTag } from 'naive-ui';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { import {
fetchBatchDeleteWorkflow, fetchBatchDeleteWorkflow,
fetchDelWorkflow,
fetchGetWorkflowPageList, fetchGetWorkflowPageList,
fetchTriggerWorkflow, fetchTriggerWorkflow,
fetchUpdateWorkflowStatus fetchUpdateWorkflowStatus
@ -230,7 +229,7 @@ async function handleBatchDelete() {
async function handleDelete(id: string) { async function handleDelete(id: string) {
// request // request
const { error } = await fetchDelWorkflow(id!); const { error } = await fetchBatchDeleteWorkflow([id!]);
if (error) return; if (error) return;
onDeleted(); onDeleted();
} }