diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 976c0ffa..2c93c892 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -270,7 +270,13 @@ const Crontab = () => { }, { title: intl.get('关联订阅'), + key: 'sub_id', + dataIndex: 'sub_id', width: 185, + filters: allSubscriptions.map((sub) => ({ + text: sub.name || sub.alias, + value: sub.id, + })), render: (text, record: any) => record?.subscription?.name || '-', }, { @@ -347,6 +353,7 @@ const Crontab = () => { const tableRef = useRef(null); const tableScrollHeight = useTableScrollHeight(tableRef); const [activeKey, setActiveKey] = useState(''); + const [allSubscriptions, setAllSubscriptions] = useState([]); const goToScriptManager = (record: any) => { const result = getCommandScript(record.command); @@ -801,6 +808,7 @@ const Crontab = () => { useEffect(() => { getCronViews(); + getAllSubscriptions(); }, []); const viewAction = (key: string) => { @@ -886,6 +894,19 @@ const Crontab = () => { }); }; + const getAllSubscriptions = () => { + request + .get(`${config.apiPrefix}subscriptions`) + .then(({ code, data }) => { + if (code === 200) { + setAllSubscriptions(data || []); + } + }) + .catch(() => { + // Silently fail if subscriptions can't be loaded + }); + }; + const tabClick = (key: string) => { const view = enabledCronViews.find((x) => x.id == key); setSelectedRowIds([]);