mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-08 15:06:08 +08:00
Add subscription filter to crontab page
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
ef98aa22d2
commit
a05d5df470
|
|
@ -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<HTMLDivElement>(null);
|
||||
const tableScrollHeight = useTableScrollHeight(tableRef);
|
||||
const [activeKey, setActiveKey] = useState('');
|
||||
const [allSubscriptions, setAllSubscriptions] = useState<any[]>([]);
|
||||
|
||||
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([]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user