feat(admin): 重做后台工作台并补齐运营明细看板
This commit is contained in:
@@ -51,6 +51,9 @@ export function AdminPushPage() {
|
||||
queryClient.invalidateQueries({ queryKey: ['admin-push-rules'] }),
|
||||
])
|
||||
|
||||
const channels = Array.isArray(channelsQuery.data) ? channelsQuery.data : []
|
||||
const rules = Array.isArray(rulesQuery.data) ? rulesQuery.data : []
|
||||
|
||||
const create = async () => {
|
||||
const values = await form.validateFields()
|
||||
let config: Record<string, unknown>
|
||||
@@ -90,7 +93,7 @@ export function AdminPushPage() {
|
||||
description="维护推送渠道(Webhook/企业微信等)与通知规则。"
|
||||
meta={
|
||||
<Tag color="geekblue">
|
||||
渠道 {channelsQuery.data?.length ?? 0} · 规则 {rulesQuery.data?.length ?? 0}
|
||||
渠道 {channels.length} · 规则 {rules.length}
|
||||
</Tag>
|
||||
}
|
||||
extra={
|
||||
@@ -184,7 +187,7 @@ export function AdminPushPage() {
|
||||
),
|
||||
},
|
||||
]}
|
||||
dataSource={channelsQuery.data ?? []}
|
||||
dataSource={channels}
|
||||
rowKey="id"
|
||||
loading={channelsQuery.isFetching}
|
||||
extra={
|
||||
@@ -238,8 +241,12 @@ export function AdminPushPage() {
|
||||
checked={row.enabled}
|
||||
disabled={!canManage}
|
||||
onChange={async checked => {
|
||||
await updatePushRule(row.id, { enabled: checked })
|
||||
await invalidate()
|
||||
try {
|
||||
await updatePushRule(row.id, { enabled: checked })
|
||||
await invalidate()
|
||||
} catch (error) {
|
||||
message.error(errorText(error))
|
||||
}
|
||||
}}
|
||||
/>
|
||||
),
|
||||
@@ -266,7 +273,7 @@ export function AdminPushPage() {
|
||||
),
|
||||
},
|
||||
]}
|
||||
dataSource={rulesQuery.data ?? []}
|
||||
dataSource={rules}
|
||||
rowKey="id"
|
||||
loading={rulesQuery.isFetching}
|
||||
emptyDescription="还没有通知规则"
|
||||
|
||||
Reference in New Issue
Block a user