fix: address code review feedback - improve notifyType logic and typing

Agent-Logs-Url: https://github.com/whyour/qinglong/sessions/4c9f0ab1-8b0e-4b94-b295-39c90ed942c2

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-25 06:50:47 +00:00 committed by GitHub
parent 79964f149c
commit 0d33d2321a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 15 deletions

View File

@ -393,12 +393,13 @@ export default class SystemService {
} }
let notifyType: string | undefined; let notifyType: string | undefined;
try {
const notifConfig = await this.getDb({ type: AuthDataType.notification });
notifyType = notifConfig.info?.type as string | undefined;
} catch (e) {}
if (notificationInfo?.type) { if (notificationInfo?.type) {
notifyType = typeString || (notificationInfo.type as string); notifyType = typeString || (notificationInfo.type as string);
} else {
try {
const notifConfig = await this.getDb({ type: AuthDataType.notification });
notifyType = notifConfig.info?.type as string | undefined;
} catch (e) {}
} }
const isSuccess = await this.notificationService.notify( const isSuccess = await this.notificationService.notify(

View File

@ -3,15 +3,24 @@ import React from 'react';
import { Table, Tag } from 'antd'; import { Table, Tag } from 'antd';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
enum NotifyStatus { interface NotifyLogItem {
'成功', id?: number;
'失败', timestamp?: number;
title?: string;
content?: string;
status?: number;
notifyType?: string;
} }
enum NotifyStatusColor { const NotifyStatusLabel: Record<number, string> = {
'success', 0: '成功',
'error', 1: '失败',
} };
const NotifyStatusColor: Record<number, string> = {
0: 'success',
1: 'error',
};
const columns = [ const columns = [
{ {
@ -56,13 +65,14 @@ const columns = [
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
width: 90, width: 90,
render: (text: string, record: any) => { render: (text: string, record: NotifyLogItem) => {
const statusKey = record.status ?? 1;
return ( return (
<Tag <Tag
color={NotifyStatusColor[record.status]} color={NotifyStatusColor[statusKey]}
style={{ marginRight: 0 }} style={{ marginRight: 0 }}
> >
{intl.get(NotifyStatus[record.status])} {intl.get(NotifyStatusLabel[statusKey])}
</Tag> </Tag>
); );
}, },
@ -73,7 +83,7 @@ const NotifyLog = ({
data, data,
height, height,
}: { }: {
data: Array<object>; data: Array<NotifyLogItem>;
height: number; height: number;
}) => { }) => {
return ( return (