mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-08 15:06:08 +08:00
Merge d0c7ec39bf into 73f8f3c5fa
This commit is contained in:
commit
eb04439e4c
23104
pnpm-lock.yaml
23104
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -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([]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user