mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-13 12:23:29 +08:00
修复创建脚本可能失败
This commit is contained in:
@@ -56,12 +56,10 @@ interface LogItem {
|
||||
const CronDetailModal = ({
|
||||
cron = {},
|
||||
handleCancel,
|
||||
visible,
|
||||
theme,
|
||||
isPhone,
|
||||
}: {
|
||||
cron?: any;
|
||||
visible: boolean;
|
||||
handleCancel: (needUpdate?: boolean) => void;
|
||||
theme: string;
|
||||
isPhone: boolean;
|
||||
@@ -440,7 +438,7 @@ const CronDetailModal = ({
|
||||
</div>
|
||||
}
|
||||
centered
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
footer={false}
|
||||
onCancel={() => handleCancel()}
|
||||
@@ -559,15 +557,16 @@ const CronDetailModal = ({
|
||||
{contentList[activeTabKey]}
|
||||
</Card>
|
||||
</div>
|
||||
<CronLogModal
|
||||
visible={isLogModalVisible}
|
||||
handleCancel={() => {
|
||||
setIsLogModalVisible(false);
|
||||
}}
|
||||
cron={cron}
|
||||
data={log}
|
||||
logUrl={logUrl}
|
||||
/>
|
||||
{isLogModalVisible && (
|
||||
<CronLogModal
|
||||
handleCancel={() => {
|
||||
setIsLogModalVisible(false);
|
||||
}}
|
||||
cron={cron}
|
||||
data={log}
|
||||
logUrl={logUrl}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
+52
-49
@@ -1037,55 +1037,58 @@ const Crontab = () => {
|
||||
components={isPhone || pageConf.size < 50 ? undefined : vt}
|
||||
/>
|
||||
</div>
|
||||
<CronLogModal
|
||||
visible={isLogModalVisible}
|
||||
handleCancel={() => {
|
||||
getCronDetail(logCron);
|
||||
setIsLogModalVisible(false);
|
||||
}}
|
||||
cron={logCron}
|
||||
/>
|
||||
<CronModal
|
||||
visible={isModalVisible}
|
||||
handleCancel={handleCancel}
|
||||
cron={editedCron}
|
||||
/>
|
||||
<CronLabelModal
|
||||
visible={isLabelModalVisible}
|
||||
handleCancel={(needUpdate?: boolean) => {
|
||||
setIsLabelModalVisible(false);
|
||||
if (needUpdate) {
|
||||
getCrons();
|
||||
}
|
||||
}}
|
||||
ids={selectedRowIds}
|
||||
/>
|
||||
<CronDetailModal
|
||||
visible={isDetailModalVisible}
|
||||
handleCancel={() => {
|
||||
setIsDetailModalVisible(false);
|
||||
}}
|
||||
cron={detailCron}
|
||||
theme={theme}
|
||||
isPhone={isPhone}
|
||||
/>
|
||||
<ViewCreateModal
|
||||
visible={isCreateViewModalVisible}
|
||||
handleCancel={(data) => {
|
||||
setIsCreateViewModalVisible(false);
|
||||
getCronViews();
|
||||
}}
|
||||
/>
|
||||
<ViewManageModal
|
||||
cronViews={cronViews}
|
||||
visible={isViewManageModalVisible}
|
||||
handleCancel={() => {
|
||||
setIsViewManageModalVisible(false);
|
||||
}}
|
||||
cronViewChange={(data) => {
|
||||
getCronViews();
|
||||
}}
|
||||
/>
|
||||
{isLogModalVisible && (
|
||||
<CronLogModal
|
||||
handleCancel={() => {
|
||||
getCronDetail(logCron);
|
||||
setIsLogModalVisible(false);
|
||||
}}
|
||||
cron={logCron}
|
||||
/>
|
||||
)}
|
||||
{isModalVisible && (
|
||||
<CronModal handleCancel={handleCancel} cron={editedCron} />
|
||||
)}
|
||||
{isLabelModalVisible && (
|
||||
<CronLabelModal
|
||||
handleCancel={(needUpdate?: boolean) => {
|
||||
setIsLabelModalVisible(false);
|
||||
if (needUpdate) {
|
||||
getCrons();
|
||||
}
|
||||
}}
|
||||
ids={selectedRowIds}
|
||||
/>
|
||||
)}
|
||||
{isDetailModalVisible && (
|
||||
<CronDetailModal
|
||||
handleCancel={() => {
|
||||
setIsDetailModalVisible(false);
|
||||
}}
|
||||
cron={detailCron}
|
||||
theme={theme}
|
||||
isPhone={isPhone}
|
||||
/>
|
||||
)}
|
||||
{isCreateViewModalVisible && (
|
||||
<ViewCreateModal
|
||||
handleCancel={(data) => {
|
||||
setIsCreateViewModalVisible(false);
|
||||
getCronViews();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isViewManageModalVisible && (
|
||||
<ViewManageModal
|
||||
cronViews={cronViews}
|
||||
handleCancel={() => {
|
||||
setIsViewManageModalVisible(false);
|
||||
}}
|
||||
cronViewChange={(data) => {
|
||||
getCronViews();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -25,12 +25,10 @@ const { Countdown } = Statistic;
|
||||
const CronLogModal = ({
|
||||
cron,
|
||||
handleCancel,
|
||||
visible,
|
||||
data,
|
||||
logUrl,
|
||||
}: {
|
||||
cron?: any;
|
||||
visible: boolean;
|
||||
handleCancel: () => void;
|
||||
data?: string;
|
||||
logUrl?: string;
|
||||
@@ -120,11 +118,10 @@ const CronLogModal = ({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (cron && cron.id && visible) {
|
||||
if (cron && cron.id) {
|
||||
getCronLog(true);
|
||||
scrollInfoRef.current.down = true;
|
||||
}
|
||||
}, [cron, visible]);
|
||||
}, [cron]);
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
@@ -139,7 +136,7 @@ const CronLogModal = ({
|
||||
return (
|
||||
<Modal
|
||||
title={titleElement()}
|
||||
open={visible}
|
||||
open={true}
|
||||
centered
|
||||
className="log-modal"
|
||||
forceRender
|
||||
|
||||
@@ -12,10 +12,8 @@ import { ScheduleType } from './type';
|
||||
const CronModal = ({
|
||||
cron,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
cron?: any;
|
||||
visible: boolean;
|
||||
handleCancel: (needUpdate?: boolean) => void;
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
@@ -58,11 +56,6 @@ const CronModal = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
setScheduleType(getScheduleType(cron?.schedule));
|
||||
}, [cron, visible]);
|
||||
|
||||
const handleScheduleTypeChange = (type: ScheduleType) => {
|
||||
setScheduleType(type);
|
||||
form.setFieldValue('schedule', '');
|
||||
@@ -146,7 +139,7 @@ const CronModal = ({
|
||||
return (
|
||||
<Modal
|
||||
title={cron?.id ? intl.get('编辑任务') : intl.get('创建任务')}
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
centered
|
||||
maskClosable={false}
|
||||
@@ -251,10 +244,8 @@ const CronModal = ({
|
||||
const CronLabelModal = ({
|
||||
ids,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
ids: Array<string>;
|
||||
visible: boolean;
|
||||
handleCancel: (needUpdate?: boolean) => void;
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
@@ -290,10 +281,6 @@ const CronLabelModal = ({
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
}, [ids, visible]);
|
||||
|
||||
const buttons = [
|
||||
<Button onClick={() => handleCancel(false)}>{intl.get('取消')}</Button>,
|
||||
<Button type="primary" danger onClick={() => update('delete')}>
|
||||
@@ -307,7 +294,7 @@ const CronLabelModal = ({
|
||||
return (
|
||||
<Modal
|
||||
title={intl.get('批量修改标签')}
|
||||
open={visible}
|
||||
open={true}
|
||||
footer={buttons}
|
||||
centered
|
||||
maskClosable={false}
|
||||
|
||||
@@ -56,10 +56,8 @@ enum ViewFilterRelation {
|
||||
const ViewCreateModal = ({
|
||||
view,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
view?: any;
|
||||
visible: boolean;
|
||||
handleCancel: (param?: any) => void;
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
@@ -101,17 +99,6 @@ const ViewCreateModal = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!view) {
|
||||
form.resetFields();
|
||||
}
|
||||
form.setFieldsValue(
|
||||
view || {
|
||||
filters: [{ property: 'command' }],
|
||||
},
|
||||
);
|
||||
}, [view, visible]);
|
||||
|
||||
const OperationElement = ({ name, ...others }: { name: number }) => {
|
||||
const property = form.getFieldValue(['filters', name, 'property']);
|
||||
return (
|
||||
@@ -172,7 +159,7 @@ const ViewCreateModal = ({
|
||||
return (
|
||||
<Modal
|
||||
title={view ? intl.get('编辑视图') : intl.get('创建视图')}
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
width={580}
|
||||
centered
|
||||
@@ -190,7 +177,16 @@ const ViewCreateModal = ({
|
||||
onCancel={() => handleCancel()}
|
||||
confirmLoading={loading}
|
||||
>
|
||||
<Form form={form} layout="vertical" name="env_modal">
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
initialValues={
|
||||
view || {
|
||||
filters: [{ property: 'command' }],
|
||||
}
|
||||
}
|
||||
name="env_modal"
|
||||
>
|
||||
<Form.Item
|
||||
name="name"
|
||||
label={intl.get('视图名称')}
|
||||
|
||||
@@ -68,11 +68,9 @@ const DragableBodyRow = ({
|
||||
const ViewManageModal = ({
|
||||
cronViews,
|
||||
handleCancel,
|
||||
visible,
|
||||
cronViewChange,
|
||||
}: {
|
||||
cronViews: any[];
|
||||
visible: boolean;
|
||||
handleCancel: () => void;
|
||||
cronViewChange: (data?: any) => void;
|
||||
}) => {
|
||||
@@ -218,7 +216,7 @@ const ViewManageModal = ({
|
||||
return (
|
||||
<Modal
|
||||
title={intl.get('视图管理')}
|
||||
open={visible}
|
||||
open={true}
|
||||
centered
|
||||
width={620}
|
||||
onCancel={() => handleCancel()}
|
||||
@@ -263,14 +261,15 @@ const ViewManageModal = ({
|
||||
}}
|
||||
/>
|
||||
</DndProvider>
|
||||
<ViewCreateModal
|
||||
view={editedView}
|
||||
visible={isCreateViewModalVisible}
|
||||
handleCancel={(data) => {
|
||||
setIsCreateViewModalVisible(false);
|
||||
cronViewChange(data);
|
||||
}}
|
||||
/>
|
||||
{isCreateViewModalVisible && (
|
||||
<ViewCreateModal
|
||||
view={editedView}
|
||||
handleCancel={(data) => {
|
||||
setIsCreateViewModalVisible(false);
|
||||
cronViewChange(data);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user