From a05d5df470c2cb8e9f0b9da1222fa8bb071d2274 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 7 Nov 2025 16:15:16 +0000 Subject: [PATCH] Add subscription filter to crontab page Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- src/pages/crontab/index.tsx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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([]);