mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-09 16:16:07 +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('关联订阅'),
|
title: intl.get('关联订阅'),
|
||||||
|
key: 'sub_id',
|
||||||
|
dataIndex: 'sub_id',
|
||||||
width: 185,
|
width: 185,
|
||||||
|
filters: allSubscriptions.map((sub) => ({
|
||||||
|
text: sub.name || sub.alias,
|
||||||
|
value: sub.id,
|
||||||
|
})),
|
||||||
render: (text, record: any) => record?.subscription?.name || '-',
|
render: (text, record: any) => record?.subscription?.name || '-',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -347,6 +353,7 @@ const Crontab = () => {
|
||||||
const tableRef = useRef<HTMLDivElement>(null);
|
const tableRef = useRef<HTMLDivElement>(null);
|
||||||
const tableScrollHeight = useTableScrollHeight(tableRef);
|
const tableScrollHeight = useTableScrollHeight(tableRef);
|
||||||
const [activeKey, setActiveKey] = useState('');
|
const [activeKey, setActiveKey] = useState('');
|
||||||
|
const [allSubscriptions, setAllSubscriptions] = useState<any[]>([]);
|
||||||
|
|
||||||
const goToScriptManager = (record: any) => {
|
const goToScriptManager = (record: any) => {
|
||||||
const result = getCommandScript(record.command);
|
const result = getCommandScript(record.command);
|
||||||
|
|
@ -801,6 +808,7 @@ const Crontab = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCronViews();
|
getCronViews();
|
||||||
|
getAllSubscriptions();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const viewAction = (key: string) => {
|
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 tabClick = (key: string) => {
|
||||||
const view = enabledCronViews.find((x) => x.id == key);
|
const view = enabledCronViews.find((x) => x.id == key);
|
||||||
setSelectedRowIds([]);
|
setSelectedRowIds([]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user