Merge branch 'refs/heads/1.1.0-beta3' into preview

This commit is contained in:
xlsea 2024-07-11 15:58:09 +08:00
commit eed4d14096
11 changed files with 36 additions and 29 deletions

View File

@ -1,40 +1,46 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useAuthStore } from '@/store/modules/auth';
const route = useRoute();
const authStore = useAuthStore();
const type = defineModel<'job-task' | 'retry-scene' | 'workflow-task'>('type', { required: true });
const type = route.name as string;
const text = computed(() => {
if (type.value === 'job-task') {
return '删除前请检查待删除定时任务是存在通知配置或者工作流任务';
if (type === 'job_task') {
return '删除前请检查待删除定时任务是存在通知配置或者工作流任务';
}
if (type.value === 'retry-scene') {
return '删除前请检查待删除重试场景是存在通知配置或者重试任务';
if (type === 'retry_scene') {
return '删除前请检查待删除重试场景是存在通知配置或者重试任务';
}
if (type.value === 'workflow-task') {
return '删除前请检查待删除工作流任务是存在通知配置';
if (type === 'workflow_task') {
return '删除前请检查待删除工作流任务是存在通知配置;';
}
if (type === 'notify_recipient') {
return '删除前请检查通知配置是存在关联通知人;';
}
return null;
});
const show = computed(() => authStore.getDeleteAlert(type.value));
const show = computed(() => authStore.getDeleteAlert(type) !== false);
const handleClose = () => {
authStore.setDeleteAlert(type.value, false);
authStore.setDeleteAlert(type, false);
return true;
};
</script>
<template>
<NAlert v-if="text && show" :show-icon="false" type="warning" closable @close="handleClose">
<NAlert v-if="show" :show-icon="false" type="warning" closable @close="handleClose">
<div class="color-warning font-500">
<!-- <span class="font-600">提示:</span> -->
📢 {{ text }}该删除为
📢 {{ text }}该删除为
<span class="color-error font-600">物理删除</span>
删除后不可恢复必要时可以先导出备份
</div>
@ -44,13 +50,10 @@ const handleClose = () => {
<style scoped lang="scss">
.n-alert {
--n-padding: 5px 13px !important;
--n-close-margin: 0 13px 0 0 !important;
--n-close-margin: 5px 13px 0 0 !important;
:deep(.n-alert__close) {
display: flex;
justify-content: center;
align-items: center;
height: 100% !important;
:deep(.n-alert-body) {
padding-right: calc(var(--n-close-size) + 15px);
}
}
</style>

View File

@ -36,11 +36,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
roles: [],
buttons: [],
namespaceIds: [],
deleteAlert: {
'job-task': true,
'retry-scene': true,
'workflow-task': true
}
deleteAlert: {}
});
/** is super role in static route */
@ -184,12 +180,12 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
localStg.set('namespaceId', namespaceId);
}
function setDeleteAlert(type: Api.Auth.DeleteAlertType, value: boolean) {
function setDeleteAlert(type: string, value: boolean) {
userInfo.deleteAlert[type] = value;
localStg.set('deleteAlert', userInfo.deleteAlert);
}
function getDeleteAlert(type: Api.Auth.DeleteAlertType) {
function getDeleteAlert(type: string) {
const deleteAlert = localStg.get('deleteAlert') || userInfo.deleteAlert;
return deleteAlert[type];
}

View File

@ -143,7 +143,7 @@ declare namespace Api {
buttons: string[];
namespaceIds: NamespaceId[];
deleteAlert: {
[key in DeleteAlertType]: boolean;
[key: string]: boolean;
};
}

View File

@ -50,7 +50,7 @@ declare namespace StorageType {
data: Api.JobLog.JobMessage[];
};
deleteAlert: {
[key in Api.Auth.DeleteAlertType]: boolean;
[key: string]: boolean;
};
}
}

View File

@ -192,6 +192,7 @@ function handleExport() {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<GroupSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert />
<NCard
:title="$t('page.groupConfig.title')"
:bordered="false"

View File

@ -281,7 +281,7 @@ function handleExport() {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<JobTaskSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert type="job-task" />
<DeleteAlert />
<NCard
:title="$t('page.jobTask.title')"
:bordered="false"
@ -294,6 +294,7 @@ function handleExport() {
v-model:columns="columnChecks"
:loading="loading"
:disabled-delete="checkedRowKeys.length === 0"
:show-delete="hasAuth('R_ADMIN')"
@add="handleAdd"
@delete="handleBatchDelete"
@refresh="getData"

View File

@ -135,6 +135,7 @@ async function handleDelete(uniqueId: string) {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<NamespaceSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert />
<NCard
:title="$t('page.namespace.title')"
:bordered="false"

View File

@ -218,6 +218,7 @@ function edit(id: string) {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<NotifyConfigSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert />
<NCard
:title="$t('page.notifyConfig.title')"
:bordered="false"
@ -230,6 +231,7 @@ function edit(id: string) {
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-delete="hasAuth('R_ADMIN')"
@add="handleAdd"
@delete="handleBatchDelete"
@refresh="getData"

View File

@ -154,6 +154,7 @@ function handleExport() {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<NotifyRecipientSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert />
<NCard
:title="$t('page.notifyRecipient.title')"
:bordered="false"
@ -166,6 +167,7 @@ function handleExport() {
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-delete="hasAuth('R_ADMIN')"
@add="handleAdd"
@delete="handleBatchDelete"
@refresh="getData"

View File

@ -238,7 +238,7 @@ function handleExport() {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<SceneSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert type="retry-scene" />
<DeleteAlert />
<NCard
:title="$t('page.retryScene.title')"
:bordered="false"
@ -251,6 +251,7 @@ function handleExport() {
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
:show-delete="hasAuth('R_ADMIN')"
@add="handleAdd"
@delete="handleBatchDelete"
@refresh="getData"

View File

@ -282,7 +282,7 @@ function goToBatch(workflowId: string) {
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<WorkflowSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<DeleteAlert type="workflow-task" />
<DeleteAlert />
<NCard
:title="$t('page.workflow.title')"
:bordered="false"