mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 10:55:51 +02:00
feat: update notification template for config sync
This commit is contained in:
parent
1c1da92363
commit
c9370a0562
7 changed files with 84 additions and 93 deletions
|
@ -13,13 +13,13 @@ export const detailRender = (args: customRender) => {
|
|||
return syncCertificateSuccess(args.text)
|
||||
case 'Sync Certificate Error':
|
||||
return syncCertificateError(args.text)
|
||||
case 'Sync Rename Configuration Success':
|
||||
case 'Rename Remote Config Success':
|
||||
return syncRenameConfigSuccess(args.text)
|
||||
case 'Sync Rename Configuration Error':
|
||||
case 'Rename Remote Config Error':
|
||||
return syncRenameConfigError(args.text)
|
||||
case 'Sync Configuration Success':
|
||||
case 'Sync Config Success':
|
||||
return syncConfigSuccess(args.text)
|
||||
case 'Sync Configuration Error':
|
||||
case 'Sync Config Error':
|
||||
return syncConfigError(args.text)
|
||||
default:
|
||||
return args.text
|
||||
|
|
|
@ -13,7 +13,7 @@ export interface StdCurdProps<T> extends StdTableProps<T> {
|
|||
modalMask?: boolean
|
||||
exportExcel?: boolean
|
||||
importExcel?: boolean
|
||||
|
||||
disableTrash?: boolean
|
||||
disableAdd?: boolean
|
||||
onClickAdd?: () => void
|
||||
|
||||
|
@ -201,7 +201,7 @@ const localOverwriteParams = reactive(props.overwriteParams ?? {})
|
|||
@click="add"
|
||||
>{{ $gettext('Add') }}</a>
|
||||
<slot name="extra" />
|
||||
<template v-if="!disableDelete">
|
||||
<template v-if="!disableDelete && !disableTrash">
|
||||
<a
|
||||
v-if="!getParams.trash"
|
||||
@click="getParams.trash = true"
|
||||
|
|
|
@ -33,6 +33,7 @@ const pageSize = computed({
|
|||
v-model:pageSize="pageSize"
|
||||
:disabled="loading"
|
||||
:current="pagination.current_page"
|
||||
show-size-changer
|
||||
:size="size"
|
||||
:total="pagination.total"
|
||||
@change="change"
|
||||
|
|
|
@ -20,7 +20,6 @@ export interface StdTableProps<T = any> {
|
|||
title?: string
|
||||
mode?: string
|
||||
rowKey?: string
|
||||
|
||||
api: Curd<T>
|
||||
columns: Column[]
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
|
|
@ -2,41 +2,8 @@
|
|||
import { message } from 'ant-design-vue'
|
||||
import StdCurd from '@/components/StdDesign/StdDataDisplay/StdCurd.vue'
|
||||
import notification from '@/api/notification'
|
||||
import type { Column } from '@/components/StdDesign/types'
|
||||
import type { customRender } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
|
||||
import { datetime, mask } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
|
||||
import { NotificationType } from '@/constants'
|
||||
import { useUserStore } from '@/pinia'
|
||||
import { detailRender } from '@/components/Notification/detailRender'
|
||||
|
||||
const columns: Column[] = [{
|
||||
title: () => $gettext('Type'),
|
||||
dataIndex: 'type',
|
||||
customRender: mask(NotificationType),
|
||||
sortable: true,
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Title'),
|
||||
dataIndex: 'title',
|
||||
customRender: (args: customRender) => {
|
||||
return h('span', $gettext(args.text))
|
||||
},
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Details'),
|
||||
dataIndex: 'details',
|
||||
customRender: detailRender,
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Created at'),
|
||||
dataIndex: 'created_at',
|
||||
sortable: true,
|
||||
customRender: datetime,
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Action'),
|
||||
dataIndex: 'action',
|
||||
}]
|
||||
import notificationColumns from '@/views/notification/notificationColumns'
|
||||
|
||||
const { unreadCount } = storeToRefs(useUserStore())
|
||||
|
||||
|
@ -60,10 +27,11 @@ watch(unreadCount, () => {
|
|||
<StdCurd
|
||||
ref="curd"
|
||||
:title="$gettext('Notification')"
|
||||
:columns="columns"
|
||||
:columns="notificationColumns"
|
||||
:api="notification"
|
||||
disabled-modify
|
||||
disable-modify
|
||||
disable-add
|
||||
disable-trash
|
||||
>
|
||||
<template #extra>
|
||||
<APopconfirm
|
||||
|
|
58
app/src/views/notification/notificationColumns.tsx
Normal file
58
app/src/views/notification/notificationColumns.tsx
Normal file
|
@ -0,0 +1,58 @@
|
|||
import { Tag } from 'ant-design-vue'
|
||||
import type { Column } from '@/components/StdDesign/types'
|
||||
import type { customRender } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
|
||||
import { datetime } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer'
|
||||
import { NotificationTypeT } from '@/constants'
|
||||
import { detailRender } from '@/components/Notification/detailRender'
|
||||
|
||||
const columns: Column[] = [{
|
||||
title: () => $gettext('Type'),
|
||||
dataIndex: 'type',
|
||||
customRender: (args: customRender) => {
|
||||
if (args.text === NotificationTypeT.Error) {
|
||||
return <Tag color="error">
|
||||
{ $gettext('Error') }
|
||||
</Tag>
|
||||
}
|
||||
else if (args.text === NotificationTypeT.Warning) {
|
||||
return <Tag color="warning">
|
||||
{ $gettext('Warning') }
|
||||
</Tag>
|
||||
}
|
||||
else if (args.text === NotificationTypeT.Info) {
|
||||
return <Tag color="info">
|
||||
{ $gettext('Info')}
|
||||
</Tag>
|
||||
}
|
||||
else if (args.text === NotificationTypeT.Success) {
|
||||
return <Tag color="success">
|
||||
{ $gettext('Success') }
|
||||
</Tag>
|
||||
}
|
||||
},
|
||||
sortable: true,
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Title'),
|
||||
dataIndex: 'title',
|
||||
customRender: (args: customRender) => {
|
||||
return h('span', $gettext(args.text))
|
||||
},
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Details'),
|
||||
dataIndex: 'details',
|
||||
customRender: detailRender,
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Created at'),
|
||||
dataIndex: 'created_at',
|
||||
sortable: true,
|
||||
customRender: datetime,
|
||||
pithy: true,
|
||||
}, {
|
||||
title: () => $gettext('Action'),
|
||||
dataIndex: 'action',
|
||||
}]
|
||||
|
||||
export default columns
|
Loading…
Add table
Add a link
Reference in a new issue