Compare commits

...

4 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] d0c7ec39bf Fix TypeScript errors and formatting
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
2025-11-07 16:20:38 +00:00
copilot-swe-agent[bot] a05d5df470 Add subscription filter to crontab page
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
2025-11-07 16:15:16 +00:00
copilot-swe-agent[bot] ef98aa22d2 Initial exploration - understanding repository structure
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
2025-11-07 16:12:25 +00:00
copilot-swe-agent[bot] e3fe662485 Initial plan 2025-11-07 16:07:18 +00:00
2 changed files with 13166 additions and 10023 deletions
+13112 -9992
View File
File diff suppressed because it is too large Load Diff
+54 -31
View File
@@ -66,6 +66,40 @@ const SHOW_TAB_COUNT = 10;
const Crontab = () => {
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
// State declarations
const [value, setValue] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
const [isModalVisible, setIsModalVisible] = useState(false);
const [isLabelModalVisible, setIsLabelModalVisible] = useState(false);
const [editedCron, setEditedCron] = useState();
const [searchText, setSearchText] = useState('');
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
const [logCron, setLogCron] = useState<any>();
const [selectedRowIds, setSelectedRowIds] = useState<string[]>([]);
const [pageConf, setPageConf] = useState<{
page: number;
size: number;
sorter: any;
filters: any;
}>({} as any);
const [viewConf, setViewConf] = useState<any>();
const [isDetailModalVisible, setIsDetailModalVisible] = useState(false);
const [detailCron, setDetailCron] = useState<any>();
const [searchValue, setSearchValue] = useState('');
const [total, setTotal] = useState<number>();
const [isCreateViewModalVisible, setIsCreateViewModalVisible] =
useState(false);
const [isViewManageModalVisible, setIsViewManageModalVisible] =
useState(false);
const [cronViews, setCronViews] = useState<any[]>([]);
const [enabledCronViews, setEnabledCronViews] = useState<any[]>([]);
const [moreMenuActive, setMoreMenuActive] = useState(false);
const tableRef = useRef<HTMLDivElement>(null);
const tableScrollHeight = useTableScrollHeight(tableRef);
const [activeKey, setActiveKey] = useState('');
const [allSubscriptions, setAllSubscriptions] = useState<any[]>([]);
const columns: ColumnProps<ICrontab>[] = [
{
title: intl.get('名称'),
@@ -270,7 +304,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 || '-',
},
{
@@ -317,37 +357,6 @@ const Crontab = () => {
},
];
const [value, setValue] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
const [isModalVisible, setIsModalVisible] = useState(false);
const [isLabelModalVisible, setIsLabelModalVisible] = useState(false);
const [editedCron, setEditedCron] = useState();
const [searchText, setSearchText] = useState('');
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
const [logCron, setLogCron] = useState<any>();
const [selectedRowIds, setSelectedRowIds] = useState<string[]>([]);
const [pageConf, setPageConf] = useState<{
page: number;
size: number;
sorter: any;
filters: any;
}>({} as any);
const [viewConf, setViewConf] = useState<any>();
const [isDetailModalVisible, setIsDetailModalVisible] = useState(false);
const [detailCron, setDetailCron] = useState<any>();
const [searchValue, setSearchValue] = useState('');
const [total, setTotal] = useState<number>();
const [isCreateViewModalVisible, setIsCreateViewModalVisible] =
useState(false);
const [isViewManageModalVisible, setIsViewManageModalVisible] =
useState(false);
const [cronViews, setCronViews] = useState<any[]>([]);
const [enabledCronViews, setEnabledCronViews] = useState<any[]>([]);
const [moreMenuActive, setMoreMenuActive] = useState(false);
const tableRef = useRef<HTMLDivElement>(null);
const tableScrollHeight = useTableScrollHeight(tableRef);
const [activeKey, setActiveKey] = useState('');
const goToScriptManager = (record: any) => {
const result = getCommandScript(record.command);
if (Array.isArray(result)) {
@@ -801,6 +810,7 @@ const Crontab = () => {
useEffect(() => {
getCronViews();
getAllSubscriptions();
}, []);
const viewAction = (key: string) => {
@@ -886,6 +896,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([]);