Merge branch 'refs/heads/1.1.0-beta3' into preview
This commit is contained in:
commit
1a08735cfb
56
src/components/common/delete-alert.vue
Normal file
56
src/components/common/delete-alert.vue
Normal file
@ -0,0 +1,56 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useAuthStore } from '@/store/modules/auth';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const type = defineModel<'job-task' | 'retry-scene' | 'workflow-task'>('type', { required: true });
|
||||
|
||||
const text = computed(() => {
|
||||
if (type.value === 'job-task') {
|
||||
return '删除前请检查待删除定时任务是存在通知配置或者工作流任务';
|
||||
}
|
||||
|
||||
if (type.value === 'retry-scene') {
|
||||
return '删除前请检查待删除重试场景是存在通知配置或者重试任务';
|
||||
}
|
||||
|
||||
if (type.value === 'workflow-task') {
|
||||
return '删除前请检查待删除工作流任务是存在通知配置';
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
const show = computed(() => authStore.getDeleteAlert(type.value));
|
||||
|
||||
const handleClose = () => {
|
||||
authStore.setDeleteAlert(type.value, false);
|
||||
return true;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NAlert v-if="text && show" :show-icon="false" type="warning" closable @close="handleClose">
|
||||
<div class="color-warning font-500">
|
||||
<!-- <span class="font-600">提示:</span> -->
|
||||
📢 {{ text }};该删除为
|
||||
<span class="color-error font-600">物理删除</span>
|
||||
,删除后不可恢复,必要时可以先导出备份
|
||||
</div>
|
||||
</NAlert>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.n-alert {
|
||||
--n-padding: 5px 13px !important;
|
||||
--n-close-margin: 0 13px 0 0 !important;
|
||||
|
||||
:deep(.n-alert__close) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -35,7 +35,12 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
userName: '',
|
||||
roles: [],
|
||||
buttons: [],
|
||||
namespaceIds: []
|
||||
namespaceIds: [],
|
||||
deleteAlert: {
|
||||
'job-task': true,
|
||||
'retry-scene': true,
|
||||
'workflow-task': true
|
||||
}
|
||||
});
|
||||
|
||||
/** is super role in static route */
|
||||
@ -140,6 +145,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
info!.userName = info?.username;
|
||||
info!.roles = [roleTypeRecord[info.role]];
|
||||
localStg.set('userInfo', info);
|
||||
localStg.set('userInfo', info);
|
||||
Object.assign(userInfo, info);
|
||||
themeStore.setWatermarkText(`${userInfo.userName}@${appTitle}`);
|
||||
|
||||
@ -178,6 +184,16 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
localStg.set('namespaceId', namespaceId);
|
||||
}
|
||||
|
||||
function setDeleteAlert(type: Api.Auth.DeleteAlertType, value: boolean) {
|
||||
userInfo.deleteAlert[type] = value;
|
||||
localStg.set('deleteAlert', userInfo.deleteAlert);
|
||||
}
|
||||
|
||||
function getDeleteAlert(type: Api.Auth.DeleteAlertType) {
|
||||
const deleteAlert = localStg.get('deleteAlert') || userInfo.deleteAlert;
|
||||
return deleteAlert[type];
|
||||
}
|
||||
|
||||
return {
|
||||
token,
|
||||
userInfo,
|
||||
@ -190,6 +206,8 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
||||
getUserInfo,
|
||||
initUserInfo,
|
||||
initAppVersion,
|
||||
setNamespaceId
|
||||
setNamespaceId,
|
||||
setDeleteAlert,
|
||||
getDeleteAlert
|
||||
};
|
||||
});
|
||||
|
@ -16,7 +16,12 @@ export function getUserInfo() {
|
||||
role: 1,
|
||||
roles: [],
|
||||
buttons: [],
|
||||
namespaceIds: []
|
||||
namespaceIds: [],
|
||||
deleteAlert: {
|
||||
'job-task': true,
|
||||
'retry-scene': true,
|
||||
'workflow-task': true
|
||||
}
|
||||
};
|
||||
const userInfo = localStg.get('userInfo') || emptyInfo;
|
||||
|
||||
@ -34,4 +39,5 @@ export function clearAuthStorage() {
|
||||
// localStg.remove('refreshToken');
|
||||
localStg.remove('namespaceId');
|
||||
localStg.remove('userInfo');
|
||||
localStg.remove('deleteAlert');
|
||||
}
|
||||
|
5
src/typings/api.d.ts
vendored
5
src/typings/api.d.ts
vendored
@ -130,6 +130,8 @@ declare namespace Api {
|
||||
namespaceIds: NamespaceId[];
|
||||
}
|
||||
|
||||
type DeleteAlertType = 'job-task' | 'retry-scene' | 'workflow-task';
|
||||
|
||||
interface UserInfo {
|
||||
id: string;
|
||||
userId: string;
|
||||
@ -140,6 +142,9 @@ declare namespace Api {
|
||||
roles: string[];
|
||||
buttons: string[];
|
||||
namespaceIds: NamespaceId[];
|
||||
deleteAlert: {
|
||||
[key in DeleteAlertType]: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface NamespaceId {
|
||||
|
3
src/typings/storage.d.ts
vendored
3
src/typings/storage.d.ts
vendored
@ -49,5 +49,8 @@ declare namespace StorageType {
|
||||
taskBatchId: string;
|
||||
data: Api.JobLog.JobMessage[];
|
||||
};
|
||||
deleteAlert: {
|
||||
[key in Api.Auth.DeleteAlertType]: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -281,6 +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" />
|
||||
<NCard
|
||||
:title="$t('page.jobTask.title')"
|
||||
:bordered="false"
|
||||
|
@ -238,6 +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" />
|
||||
<NCard
|
||||
:title="$t('page.retryScene.title')"
|
||||
:bordered="false"
|
||||
|
@ -152,7 +152,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'd2'
|
||||
},
|
||||
{
|
||||
show: hasAuth('R_ADMIN'),
|
||||
type: 'render',
|
||||
key: 'delete',
|
||||
render: () => (
|
||||
@ -283,6 +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" />
|
||||
<NCard
|
||||
:title="$t('page.workflow.title')"
|
||||
:bordered="false"
|
||||
@ -295,6 +295,7 @@ function goToBatch(workflowId: string) {
|
||||
v-model:columns="columnChecks"
|
||||
:disabled-delete="checkedRowKeys.length === 0"
|
||||
:loading="loading"
|
||||
:show-delete="hasAuth('R_ADMIN')"
|
||||
@add="handleAdd"
|
||||
@delete="handleBatchDelete"
|
||||
@refresh="getData"
|
||||
|
Loading…
Reference in New Issue
Block a user