feat(platform): copy quality issue identity
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Button, Card, Col, Form, Row, Select, Space, Table, Tag, Toast } from '@douyinfe/semi-ui';
|
import { Button, Card, Col, Form, Row, Select, Space, Table, Tag, Toast } from '@douyinfe/semi-ui';
|
||||||
|
import { IconCopy } from '@douyinfe/semi-icons';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { api } from '../api/client';
|
import { api } from '../api/client';
|
||||||
import type { OpsHealth, QualitySummary, QualityIssueRow } from '../api/types';
|
import type { OpsHealth, QualitySummary, QualityIssueRow } from '../api/types';
|
||||||
@@ -34,6 +35,20 @@ function qualityParams(values: Record<string, string>) {
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function copyText(value: string, label: string) {
|
||||||
|
const text = value.trim();
|
||||||
|
if (!text) {
|
||||||
|
Toast.warning(`${label}为空`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text);
|
||||||
|
Toast.success(`已复制${label}`);
|
||||||
|
} catch {
|
||||||
|
Toast.error(`复制${label}失败`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealth) => void }) {
|
export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealth) => void }) {
|
||||||
const [issues, setIssues] = useState<QualityIssueRow[]>([]);
|
const [issues, setIssues] = useState<QualityIssueRow[]>([]);
|
||||||
const [summary, setSummary] = useState<QualitySummary>(emptySummary);
|
const [summary, setSummary] = useState<QualitySummary>(emptySummary);
|
||||||
@@ -152,7 +167,17 @@ export function Quality({ onHealthLoaded }: { onHealthLoaded?: (health: OpsHealt
|
|||||||
{ title: '问题', dataIndex: 'issueType' },
|
{ title: '问题', dataIndex: 'issueType' },
|
||||||
{ title: '级别', render: (_: unknown, row: QualityIssueRow) => <Tag color={row.severity === 'error' ? 'red' : 'orange'}>{row.severity}</Tag> },
|
{ title: '级别', render: (_: unknown, row: QualityIssueRow) => <Tag color={row.severity === 'error' ? 'red' : 'orange'}>{row.severity}</Tag> },
|
||||||
{ title: '最后时间', dataIndex: 'lastSeen' },
|
{ title: '最后时间', dataIndex: 'lastSeen' },
|
||||||
{ title: '说明', dataIndex: 'detail' }
|
{ title: '说明', dataIndex: 'detail' },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
width: 140,
|
||||||
|
render: (_: unknown, row: QualityIssueRow) => (
|
||||||
|
<Space spacing={4}>
|
||||||
|
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.phone, '手机号')}>手机号</Button>
|
||||||
|
<Button size="small" icon={<IconCopy />} onClick={() => copyText(row.sourceEndpoint, '来源')}>来源</Button>
|
||||||
|
</Space>
|
||||||
|
)
|
||||||
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user