import React, { useEffect, useState } from 'react'; import { Form, Header, Label, Segment, Table } from 'semantic-ui-react'; import { API, formatDateTime, showError } from '../../helpers'; const ApplyLog = () => { const [logs, setLogs] = useState([]); const [keyword, setKeyword] = useState(''); const [loading, setLoading] = useState(false); const loadLogs = async (nodeId = '') => { setLoading(true); const path = nodeId ? `/api/apply-logs/?node_id=${encodeURIComponent(nodeId)}` : '/api/apply-logs/'; const res = await API.get(path); const { success, message, data } = res.data; if (success) { setLogs(data || []); } else { showError(message); } setLoading(false); }; useEffect(() => { loadLogs().then(); }, []); const submit = async () => { await loadLogs(keyword.trim()); }; return (
应用记录

按节点查看配置应用成功或失败记录。

setKeyword(value)} /> Node ID 版本 结果 信息 时间 {logs.map((log) => ( {log.node_id} {log.version} {log.result === 'success' ? : } {log.message || '无'} {formatDateTime(log.created_at)} ))}
); }; export default ApplyLog;