@whyour/qinglong 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyour/qinglong",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -91,6 +91,10 @@ export TG_API_HOST=""
91
91
  export DD_BOT_TOKEN=""
92
92
  export DD_BOT_SECRET=""
93
93
 
94
+ ## 企业微信反向代理地址
95
+ ## (环境变量名 QYWX_ORIGIN)
96
+ export QYWX_ORIGIN=""
97
+
94
98
  ## 5. 企业微信机器人
95
99
  ## 官方说明文档:https://work.weixin.qq.com/api/doc/90000/90136/91770
96
100
  ## 下方填写密钥,企业微信推送 webhook 后面的 key
package/shell/share.sh CHANGED
@@ -305,7 +305,7 @@ git_clone_scripts() {
305
305
  local branch="$3"
306
306
  local proxy="$4"
307
307
  [[ $branch ]] && local part_cmd="-b $branch "
308
- echo -e "开始克隆仓库 $url 到 $dir\n"
308
+ echo -e "开始拉取 $url 到 $dir\n"
309
309
 
310
310
  set_proxy "$proxy"
311
311
 
package/shell/update.sh CHANGED
@@ -130,13 +130,9 @@ update_repo() {
130
130
  make_dir "${dir_scripts}/${uniq_path}"
131
131
 
132
132
  local formatUrl="$url"
133
- if [[ -d ${repo_path}/.git ]]; then
134
- reset_romote_url ${repo_path} "${formatUrl}" "${branch}"
135
- git_pull_scripts ${repo_path} "${branch}" "${proxy}"
136
- else
137
- rm -rf ${repo_path} &>/dev/null
138
- git_clone_scripts "${formatUrl}" ${repo_path} "${branch}" "${proxy}"
139
- fi
133
+ rm -rf ${repo_path} &>/dev/null
134
+ git_clone_scripts "${formatUrl}" ${repo_path} "${branch}" "${proxy}"
135
+
140
136
  if [[ $exit_status -eq 0 ]]; then
141
137
  echo -e "\n更新${repo_path}成功...\n"
142
138
  diff_scripts "$repo_path" "$author" "$path" "$blackword" "$dependence" "$extensions" "$autoAddCron" "$autoDelCron"
@@ -269,13 +265,9 @@ update_qinglong_static() {
269
265
  local no_restart="$1"
270
266
  local primary_branch="$2"
271
267
  local url="https://${mirror}.com/whyour/qinglong-static.git"
272
- if [[ -d ${ql_static_repo}/.git ]]; then
273
- reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
274
- git_pull_scripts ${ql_static_repo} ${primary_branch}
275
- else
276
- rm -rf ${ql_static_repo} &>/dev/null
277
- git_clone_scripts ${url} ${ql_static_repo} ${primary_branch}
278
- fi
268
+ rm -rf ${ql_static_repo} &>/dev/null
269
+ git_clone_scripts ${url} ${ql_static_repo} ${primary_branch}
270
+
279
271
  if [[ $exit_status -eq 0 ]]; then
280
272
  echo -e "\n更新青龙静态资源成功...\n"
281
273
 
@@ -73,26 +73,27 @@ exports.default = (app) => {
73
73
  return next(e);
74
74
  }
75
75
  });
76
- route.get('/log/remove', async (req, res, next) => {
76
+ route.get('/config', async (req, res, next) => {
77
77
  const logger = typedi_1.Container.get('logger');
78
78
  try {
79
79
  const systemService = typedi_1.Container.get(system_1.default);
80
- const data = await systemService.getLogRemoveFrequency();
80
+ const data = await systemService.getSystemConfig();
81
81
  res.send({ code: 200, data });
82
82
  }
83
83
  catch (e) {
84
84
  return next(e);
85
85
  }
86
86
  });
87
- route.put('/log/remove', (0, celebrate_1.celebrate)({
87
+ route.put('/config', (0, celebrate_1.celebrate)({
88
88
  body: celebrate_1.Joi.object({
89
- frequency: celebrate_1.Joi.number().required(),
89
+ logRemoveFrequency: celebrate_1.Joi.number().optional().allow(null),
90
+ cronConcurrency: celebrate_1.Joi.number().optional().allow(null),
90
91
  }),
91
92
  }), async (req, res, next) => {
92
93
  const logger = typedi_1.Container.get('logger');
93
94
  try {
94
95
  const systemService = typedi_1.Container.get(system_1.default);
95
- const result = await systemService.updateLogRemoveFrequency(req.body.frequency);
96
+ const result = await systemService.updateSystemConfig(req.body);
96
97
  res.send(result);
97
98
  }
98
99
  catch (e) {
@@ -23,6 +23,7 @@ var AuthDataType;
23
23
  AuthDataType["authToken"] = "authToken";
24
24
  AuthDataType["notification"] = "notification";
25
25
  AuthDataType["removeLogFrequency"] = "removeLogFrequency";
26
+ AuthDataType["systemConfig"] = "systemConfig";
26
27
  })(AuthDataType = exports.AuthDataType || (exports.AuthDataType = {}));
27
28
  exports.AuthModel = _1.sequelize.define('Auth', {
28
29
  ip: sequelize_1.DataTypes.STRING,
@@ -30,9 +30,9 @@ exports.Crontab = Crontab;
30
30
  var CrontabStatus;
31
31
  (function (CrontabStatus) {
32
32
  CrontabStatus[CrontabStatus["running"] = 0] = "running";
33
- CrontabStatus[CrontabStatus["idle"] = 1] = "idle";
34
- CrontabStatus[CrontabStatus["disabled"] = 2] = "disabled";
35
- CrontabStatus[CrontabStatus["queued"] = 3] = "queued";
33
+ CrontabStatus[CrontabStatus["queued"] = 1] = "queued";
34
+ CrontabStatus[CrontabStatus["idle"] = 2] = "idle";
35
+ CrontabStatus[CrontabStatus["disabled"] = 3] = "disabled";
36
36
  })(CrontabStatus = exports.CrontabStatus || (exports.CrontabStatus = {}));
37
37
  exports.CrontabModel = _1.sequelize.define('Crontab', {
38
38
  name: {
@@ -32,7 +32,7 @@ exports.default = async () => {
32
32
  }
33
33
  });
34
34
  // 初始化更新所有任务状态为空闲
35
- await cron_1.CrontabModel.update({ status: cron_1.CrontabStatus.idle }, { where: { status: [cron_1.CrontabStatus.running, cron_1.CrontabStatus.queued] } });
35
+ await cron_1.CrontabModel.update({ status: cron_1.CrontabStatus.idle }, { where: { status: { [sequelize_1.Op.ne]: cron_1.CrontabStatus.disabled } } });
36
36
  // 初始化时安装所有处于安装中,安装成功,安装失败的依赖
37
37
  dependence_2.DependenceModel.findAll({
38
38
  where: {},
@@ -25,10 +25,13 @@ const confFile = path_1.default.join(configPath, 'config.sh');
25
25
  const authConfigFile = path_1.default.join(configPath, 'auth.json');
26
26
  const sampleConfigFile = path_1.default.join(samplePath, 'config.sample.sh');
27
27
  const sampleAuthFile = path_1.default.join(samplePath, 'auth.sample.json');
28
+ const sampleTaskShellFile = path_1.default.join(samplePath, 'task.sample.sh');
28
29
  const sampleNotifyJsFile = path_1.default.join(samplePath, 'notify.js');
29
30
  const sampleNotifyPyFile = path_1.default.join(samplePath, 'notify.py');
30
31
  const scriptNotifyJsFile = path_1.default.join(scriptPath, 'sendNotify.js');
31
32
  const scriptNotifyPyFile = path_1.default.join(scriptPath, 'notify.py');
33
+ const TaskBeforeFile = path_1.default.join(configPath, 'task_before.sh');
34
+ const TaskAfterFile = path_1.default.join(configPath, 'task_after.sh');
32
35
  const homedir = os_1.default.homedir();
33
36
  const sshPath = path_1.default.resolve(homedir, '.ssh');
34
37
  const sshdPath = path_1.default.join(dataPath, 'ssh.d');
@@ -45,6 +48,8 @@ exports.default = async () => {
45
48
  const tmpDirExist = await (0, util_1.fileExist)(tmpPath);
46
49
  const scriptNotifyJsFileExist = await (0, util_1.fileExist)(scriptNotifyJsFile);
47
50
  const scriptNotifyPyFileExist = await (0, util_1.fileExist)(scriptNotifyPyFile);
51
+ const TaskBeforeFileExist = await (0, util_1.fileExist)(TaskBeforeFile);
52
+ const TaskAfterFileExist = await (0, util_1.fileExist)(TaskAfterFile);
48
53
  if (!configDirExist) {
49
54
  fs_1.default.mkdirSync(configPath);
50
55
  }
@@ -82,6 +87,12 @@ exports.default = async () => {
82
87
  if (!scriptNotifyPyFileExist) {
83
88
  fs_1.default.writeFileSync(scriptNotifyPyFile, fs_1.default.readFileSync(sampleNotifyPyFile));
84
89
  }
90
+ if (!TaskBeforeFileExist) {
91
+ fs_1.default.writeFileSync(TaskBeforeFile, fs_1.default.readFileSync(sampleTaskShellFile));
92
+ }
93
+ if (!TaskAfterFileExist) {
94
+ fs_1.default.writeFileSync(TaskAfterFile, fs_1.default.readFileSync(sampleTaskShellFile));
95
+ }
85
96
  dotenv_1.default.config({ path: confFile });
86
97
  logger_1.default.info('✌️ Init file down');
87
98
  };
@@ -30,7 +30,7 @@ exports.default = async () => {
30
30
  days: 28,
31
31
  });
32
32
  // 运行删除日志任务
33
- const data = await systemService.getLogRemoveFrequency();
33
+ const data = await systemService.getSystemConfig();
34
34
  if (data && data.info && data.info.frequency) {
35
35
  const rmlogCron = {
36
36
  id: data.id,
@@ -28,7 +28,7 @@ const sequelize_1 = require("sequelize");
28
28
  const path_1 = __importDefault(require("path"));
29
29
  const const_1 = require("../config/const");
30
30
  const client_1 = __importDefault(require("../schedule/client"));
31
- const pLimit_1 = require("../shared/pLimit");
31
+ const pLimit_1 = __importDefault(require("../shared/pLimit"));
32
32
  const cross_spawn_1 = require("cross-spawn");
33
33
  let CronService = class CronService {
34
34
  constructor(logger) {
@@ -336,7 +336,7 @@ let CronService = class CronService {
336
336
  await cron_1.CrontabModel.update({ status: cron_1.CrontabStatus.idle, pid: undefined }, { where: { id: ids } });
337
337
  }
338
338
  async runSingle(cronId) {
339
- return (0, pLimit_1.runWithCpuLimit)(() => {
339
+ return pLimit_1.default.runWithCpuLimit(() => {
340
340
  return new Promise(async (resolve) => {
341
341
  const cron = await this.getDb({ id: cronId });
342
342
  if (cron.status !== cron_1.CrontabStatus.queued) {
@@ -33,7 +33,7 @@ const cross_spawn_1 = require("cross-spawn");
33
33
  const sock_1 = __importDefault(require("./sock"));
34
34
  const sequelize_1 = require("sequelize");
35
35
  const dayjs_1 = __importDefault(require("dayjs"));
36
- const pLimit_1 = require("../shared/pLimit");
36
+ const pLimit_1 = __importDefault(require("../shared/pLimit"));
37
37
  let DependenceService = class DependenceService {
38
38
  constructor(logger, sockService) {
39
39
  this.logger = logger;
@@ -121,7 +121,7 @@ let DependenceService = class DependenceService {
121
121
  await dependence_1.DependenceModel.update({ log: newLog }, { where: { id: ids } });
122
122
  }
123
123
  installOrUninstallDependency(dependency, isInstall = true, force = false) {
124
- return (0, pLimit_1.runOneByOne)(() => {
124
+ return pLimit_1.default.runOneByOne(() => {
125
125
  return new Promise(async (resolve) => {
126
126
  const depIds = [dependency.id];
127
127
  const status = isInstall
@@ -20,7 +20,7 @@ const winston_1 = __importDefault(require("winston"));
20
20
  const node_schedule_1 = __importDefault(require("node-schedule"));
21
21
  const toad_scheduler_1 = require("toad-scheduler");
22
22
  const dayjs_1 = __importDefault(require("dayjs"));
23
- const pLimit_1 = require("../shared/pLimit");
23
+ const pLimit_1 = __importDefault(require("../shared/pLimit"));
24
24
  const cross_spawn_1 = require("cross-spawn");
25
25
  let ScheduleService = class ScheduleService {
26
26
  constructor(logger) {
@@ -30,7 +30,7 @@ let ScheduleService = class ScheduleService {
30
30
  this.maxBuffer = 200 * 1024 * 1024;
31
31
  }
32
32
  async runTask(command, callbacks = {}, completionTime = 'end') {
33
- return (0, pLimit_1.runWithCpuLimit)(() => {
33
+ return pLimit_1.default.runWithCpuLimit(() => {
34
34
  return new Promise(async (resolve, reject) => {
35
35
  var _a, _b, _c;
36
36
  try {
@@ -26,14 +26,15 @@ const sock_1 = __importDefault(require("./sock"));
26
26
  const got_1 = __importDefault(require("got"));
27
27
  const util_1 = require("../config/util");
28
28
  const const_1 = require("../config/const");
29
+ const pLimit_1 = __importDefault(require("../shared/pLimit"));
29
30
  let SystemService = class SystemService {
30
31
  constructor(logger, scheduleService, sockService) {
31
32
  this.logger = logger;
32
33
  this.scheduleService = scheduleService;
33
34
  this.sockService = sockService;
34
35
  }
35
- async getLogRemoveFrequency() {
36
- const doc = await this.getDb({ type: auth_1.AuthDataType.removeLogFrequency });
36
+ async getSystemConfig() {
37
+ const doc = await this.getDb({ type: auth_1.AuthDataType.systemConfig });
37
38
  return doc || {};
38
39
  }
39
40
  async updateAuthDb(payload) {
@@ -59,21 +60,26 @@ let SystemService = class SystemService {
59
60
  return { code: 400, message: '通知发送失败,请检查参数' };
60
61
  }
61
62
  }
62
- async updateLogRemoveFrequency(frequency) {
63
- const oDoc = await this.getLogRemoveFrequency();
64
- const result = await this.updateAuthDb(Object.assign(Object.assign({}, oDoc), { type: auth_1.AuthDataType.removeLogFrequency, info: { frequency } }));
65
- const cron = {
66
- id: result.id,
67
- name: '删除日志',
68
- command: `ql rmlog ${frequency}`,
69
- };
70
- await this.scheduleService.cancelIntervalTask(cron);
71
- if (frequency > 0) {
72
- this.scheduleService.createIntervalTask(cron, {
73
- days: frequency,
74
- });
63
+ async updateSystemConfig(info) {
64
+ const oDoc = await this.getSystemConfig();
65
+ const result = await this.updateAuthDb(Object.assign(Object.assign({}, oDoc), { type: auth_1.AuthDataType.systemConfig, info }));
66
+ if (info.logRemoveFrequency) {
67
+ const cron = {
68
+ id: result.id,
69
+ name: '删除日志',
70
+ command: `ql rmlog ${info.logRemoveFrequency}`,
71
+ };
72
+ await this.scheduleService.cancelIntervalTask(cron);
73
+ if (info.logRemoveFrequency > 0) {
74
+ this.scheduleService.createIntervalTask(cron, {
75
+ days: info.logRemoveFrequency,
76
+ });
77
+ }
78
+ }
79
+ if (info.cronConcurrency) {
80
+ await pLimit_1.default.setCustomLimit(info.cronConcurrency);
75
81
  }
76
- return { code: 200, data: Object.assign({}, cron) };
82
+ return { code: 200, data: info };
77
83
  }
78
84
  async checkUpdate() {
79
85
  try {
@@ -3,21 +3,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runOneByOne = exports.runWithCpuLimit = void 0;
7
6
  const p_limit_1 = __importDefault(require("p-limit"));
8
7
  const os_1 = __importDefault(require("os"));
9
- const cpuLimit = (0, p_limit_1.default)(os_1.default.cpus().length);
10
- const oneLimit = (0, p_limit_1.default)(1);
11
- function runWithCpuLimit(fn) {
12
- return cpuLimit(() => {
13
- return fn();
14
- });
8
+ const auth_1 = require("../data/auth");
9
+ class TaskLimit {
10
+ constructor() {
11
+ this.oneLimit = (0, p_limit_1.default)(1);
12
+ this.cpuLimit = (0, p_limit_1.default)(Math.max(os_1.default.cpus().length, 4));
13
+ this.setCustomLimit();
14
+ }
15
+ async setCustomLimit(limit) {
16
+ var _a, _b;
17
+ if (limit) {
18
+ this.cpuLimit = (0, p_limit_1.default)(limit);
19
+ return;
20
+ }
21
+ const doc = await auth_1.AuthModel.findOne({ where: { type: auth_1.AuthDataType.systemConfig } });
22
+ if ((_a = doc === null || doc === void 0 ? void 0 : doc.info) === null || _a === void 0 ? void 0 : _a.cronConcurrency) {
23
+ this.cpuLimit = (0, p_limit_1.default)((_b = doc === null || doc === void 0 ? void 0 : doc.info) === null || _b === void 0 ? void 0 : _b.cronConcurrency);
24
+ }
25
+ }
26
+ runWithCpuLimit(fn) {
27
+ return this.cpuLimit(() => {
28
+ return fn();
29
+ });
30
+ }
31
+ runOneByOne(fn) {
32
+ return this.oneLimit(() => {
33
+ return fn();
34
+ });
35
+ }
15
36
  }
16
- exports.runWithCpuLimit = runWithCpuLimit;
17
- function runOneByOne(fn) {
18
- return oneLimit(() => {
19
- return fn();
20
- });
21
- }
22
- exports.runOneByOne = runOneByOne;
37
+ exports.default = new TaskLimit();
23
38
  //# sourceMappingURL=pLimit.js.map
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runCron = void 0;
7
7
  const cross_spawn_1 = require("cross-spawn");
8
- const pLimit_1 = require("./pLimit");
8
+ const pLimit_1 = __importDefault(require("./pLimit"));
9
9
  const logger_1 = __importDefault(require("../loaders/logger"));
10
10
  function runCron(cmd) {
11
- return (0, pLimit_1.runWithCpuLimit)(() => {
11
+ return pLimit_1.default.runWithCpuLimit(() => {
12
12
  return new Promise(async (resolve) => {
13
13
  logger_1.default.silly('运行命令: ' + cmd);
14
14
  const cp = (0, cross_spawn_1.spawn)(cmd, { shell: '/bin/bash' });
@@ -0,0 +1,4 @@
1
+ (self.webpackChunk_whyour_qinglong=self.webpackChunk_whyour_qinglong||[]).push([[4491],{3424:function(S,g,e){"use strict";e.r(g);var T=e(54306),c=e.n(T),h=e(63313),x=e.n(h),D=e(89065),f=e(9835),_=e(84163),P=e(24378),E=e(35911),s=e(90717),n=e(11527),O=D.Z.Countdown,y=function(C){var r=C.socketMessage,a=C.systemInfo,m=(0,h.useState)(!1),t=c()(m,2),v=t[0],M=t[1],F=(0,h.useState)(""),o=c()(F,2),A=o[0],I=o[1],U=(0,h.useRef)(),W=function(){v||(M(!0),f.ZP.loading("\u68C0\u67E5\u66F4\u65B0\u4E2D...",0),E.W.put("".concat(s.Z.apiPrefix,"system/update-check")).then(function(u){var B=u.code,i=u.data;f.ZP.destroy(),B===200&&(i.hasNewVersion?K(i):w(i))}).catch(function(u){f.ZP.destroy(),console.log(u)}).finally(function(){M(!1)}))},w=function(u){_.Z.confirm({width:500,title:"\u66F4\u65B0",content:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:"\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\u4E86\uFF01"}),(0,n.jsxs)("div",{style:{fontSize:12,fontWeight:400,marginTop:5},children:["\u9752\u9F99 ",u.lastVersion," \u662F\u76EE\u524D\u68C0\u6D4B\u5230\u7684\u6700\u65B0\u53EF\u7528\u7248\u672C\u4E86\u3002"]})]}),okText:"\u5F3A\u5236\u66F4\u65B0",onOk:function(){d(),E.W.put("".concat(s.Z.apiPrefix,"system/update")).then(function(i){}).catch(function(i){console.log(i)})}})},K=function(u){var B=u.lastVersion,i=u.lastLog;_.Z.confirm({width:500,title:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:"\u66F4\u65B0\u53EF\u7528"}),(0,n.jsxs)("div",{style:{fontSize:12,fontWeight:400,marginTop:5},children:["\u65B0\u7248\u672C ",B," \u53EF\u7528\uFF0C\u4F60\u4F7F\u7528\u7684\u7248\u672C\u4E3A ",a.version,"\u3002"]})]}),content:(0,n.jsx)("pre",{style:{fontSize:12,fontWeight:400},children:i}),okText:"\u66F4\u65B0",cancelText:"\u4EE5\u540E\u518D\u8BF4",onOk:function(){d(),E.W.put("".concat(s.Z.apiPrefix,"system/update")).then(function(j){}).catch(function(j){console.log(j)})}})},d=function(){I(""),U.current=_.Z.info({width:600,maskClosable:!1,closable:!1,keyboard:!1,okButtonProps:{disabled:!0},title:"\u66F4\u65B0\u4E2D...",centered:!0,content:(0,n.jsx)("pre",{style:{fontSize:12,fontWeight:400},children:A})})};return(0,h.useEffect)(function(){if(!(!U.current||!r)){var b=r.type,u=r.message,B=r.references;if(b==="updateSystemVersion"){var i="".concat(A).concat(u),p=i.includes("\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5");U.current.update({maskClosable:p,closable:p,okButtonProps:{disabled:!p},content:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("pre",{style:{fontSize:12,fontWeight:400},children:i}),(0,n.jsx)("div",{id:"log-identifier",style:{paddingBottom:5}})]})}),p&&!A.includes("\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5")&&f.ZP.error("\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u53CA\u65E5\u5FD7\u6216\u7A0D\u540E\u518D\u8BD5"),I(i),document.getElementById("log-identifier")&&document.getElementById("log-identifier").scrollIntoView({behavior:"smooth",block:"nearest"}),u.includes("\u91CD\u542F\u9762\u677F")&&(f.ZP.warning({content:(0,n.jsxs)("span",{children:["\u7CFB\u7EDF\u5C06\u5728",(0,n.jsx)(O,{className:"inline-countdown",format:"ss",value:Date.now()+1e3*30}),"\u79D2\u540E\u81EA\u52A8\u5237\u65B0"]}),duration:30}),setTimeout(function(){window.location.reload()},3e4))}}},[r]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(P.Z,{type:"primary",onClick:W,children:"\u68C0\u67E5\u66F4\u65B0"})})};g.default=y},77386:function(S,g,e){"use strict";e.r(g);var T=e(57213),c=e.n(T),h=e(54306),x=e.n(h),D=e(63313),f=e.n(D),_=e(67393),P=e(9835),E=e(84468),s=e(22159),n=e(55484),O=e(24378),y=e(71571),L=e.n(y),C=e(90717),r=e(35911),a=e(3424),m=e(35716),t=e(11527),v=[{label:"\u4EAE\u8272",value:"light"},{label:"\u6697\u8272",value:"dark"},{label:"\u8DDF\u968F\u7CFB\u7EDF",value:"auto"}],M=function(o){var A=o.systemInfo,I=o.socketMessage,U=o.reloadTheme,W=localStorage.getItem("qinglong_dark_theme")||"auto",w=(0,D.useState)(),K=x()(w,2),d=K[0],b=K[1],u=_.Z.useForm(),B=x()(u,1),i=B[0],p=y||{},j=p.enable,H=p.disable,$=p.exportGeneratedCSS,G=p.setFetchMethod,X=p.auto,Q=function(l){var k=l.target.value;localStorage.setItem("qinglong_dark_theme",l.target.value),G(fetch),k==="dark"?j({}):k==="light"?H():X({}),U()},z=function(){r.W.get("".concat(C.Z.apiPrefix,"system/config")).then(function(l){var k=l.code,Z=l.data;k===200&&Z.info&&b(Z.info)}).catch(function(l){console.log(l)})},q=function(){r.W.put("".concat(C.Z.apiPrefix,"system/config"),{data:c()({},d)}).then(function(l){var k=l.code,Z=l.data;k===200&&P.ZP.success("\u66F4\u65B0\u6210\u529F")}).catch(function(l){console.log(l)})};return(0,D.useEffect)(function(){z()},[]),(0,t.jsxs)(_.Z,{layout:"vertical",form:i,children:[(0,t.jsx)(_.Z.Item,{label:"\u4E3B\u9898\u8BBE\u7F6E",name:"theme",initialValue:W,children:(0,t.jsx)(E.ZP.Group,{options:v,onChange:Q,value:W,optionType:"button",buttonStyle:"solid"})}),(0,t.jsx)(_.Z.Item,{label:"\u65E5\u5FD7\u5220\u9664\u9891\u7387",name:"frequency",tooltip:"\u6BCFx\u5929\u81EA\u52A8\u5220\u9664x\u5929\u4EE5\u524D\u7684\u65E5\u5FD7",children:(0,t.jsxs)(s.Z.Group,{compact:!0,children:[(0,t.jsx)(n.Z,{addonBefore:"\u6BCF",addonAfter:"\u5929",style:{width:142},min:0,value:d==null?void 0:d.logRemoveFrequency,onChange:function(l){b(c()(c()({},d),{},{logRemoveFrequency:l}))}}),(0,t.jsx)(O.Z,{type:"primary",onClick:q,children:"\u786E\u8BA4"})]})}),(0,t.jsx)(_.Z.Item,{label:"\u5B9A\u65F6\u4EFB\u52A1\u5E76\u53D1\u6570",name:"frequency",children:(0,t.jsxs)(s.Z.Group,{compact:!0,children:[(0,t.jsx)(n.Z,{style:{width:142},min:1,value:d==null?void 0:d.cronConcurrency,onChange:function(l){b(c()(c()({},d),{},{cronConcurrency:l}))}}),(0,t.jsx)(O.Z,{type:"primary",onClick:q,children:"\u786E\u8BA4"})]})}),(0,t.jsx)(_.Z.Item,{label:"\u68C0\u67E5\u66F4\u65B0",name:"update",children:(0,t.jsx)(a.default,{systemInfo:A,socketMessage:I})})]})};g.default=M},90717:function(S,g){"use strict";var e=window.__ENV__QlBaseUrl||"/";g.Z={siteName:"\u9752\u9F99",apiPrefix:"".concat(e,"api/"),authKey:"token",layouts:[{name:"primary",include:[/.*/],exclude:[/(\/(en|zh))*\/login/]}],i18n:{languages:[{key:"pt-br",title:"Portugu\xEAs",flag:"/portugal.svg"},{key:"en",title:"English",flag:"/america.svg"},{key:"zh",title:"\u4E2D\u6587",flag:"/china.svg"}],defaultLanguage:"en"},scopes:[{name:"\u5B9A\u65F6\u4EFB\u52A1",value:"crons"},{name:"\u73AF\u5883\u53D8\u91CF",value:"envs"},{name:"\u8BA2\u9605\u7BA1\u7406",value:"subscriptions"},{name:"\u914D\u7F6E\u6587\u4EF6",value:"configs"},{name:"\u811A\u672C\u7BA1\u7406",value:"scripts"},{name:"\u65E5\u5FD7\u7BA1\u7406",value:"logs"},{name:"\u4F9D\u8D56\u7BA1\u7406",value:"dependencies"},{name:"\u7CFB\u7EDF\u4FE1\u606F",value:"system"}],scopesMap:{crons:"\u5B9A\u65F6\u4EFB\u52A1",envs:"\u73AF\u5883\u53D8\u91CF",subscriptions:"\u8BA2\u9605\u7BA1\u7406",configs:"\u914D\u7F6E\u6587\u4EF6",scripts:"\u811A\u672C\u7BA1\u7406",logs:"\u65E5\u5FD7\u7BA1\u7406",dependencies:"\u4F9D\u8D56\u7BA1\u7406",system:"\u7CFB\u7EDF\u4FE1\u606F"},notificationModes:[{value:"gotify",label:"Gotify"},{value:"goCqHttpBot",label:"GoCqHttpBot"},{value:"serverChan",label:"Server\u9171"},{value:"pushDeer",label:"PushDeer"},{value:"bark",label:"Bark"},{value:"telegramBot",label:"Telegram\u673A\u5668\u4EBA"},{value:"dingtalkBot",label:"\u9489\u9489\u673A\u5668\u4EBA"},{value:"weWorkBot",label:"\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA"},{value:"weWorkApp",label:"\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528"},{value:"aibotk",label:"\u667A\u80FD\u5FAE\u79D8\u4E66"},{value:"iGot",label:"IGot"},{value:"pushPlus",label:"PushPlus"},{value:"chat",label:"\u7FA4\u6656chat"},{value:"email",label:"\u90AE\u7BB1"},{value:"lark",label:"\u98DE\u4E66\u673A\u5668\u4EBA"},{value:"webhook",label:"\u81EA\u5B9A\u4E49\u901A\u77E5"},{value:"closed",label:"\u5DF2\u5173\u95ED"}],notificationModeMap:{gotify:[{label:"gotifyUrl",tip:"gotify\u7684url\u5730\u5740,\u4F8B\u5982 https://push.example.de:8080",required:!0},{label:"gotifyToken",tip:"gotify\u7684\u6D88\u606F\u5E94\u7528token\u7801",required:!0},{label:"gotifyPriority",tip:"\u63A8\u9001\u6D88\u606F\u7684\u4F18\u5148\u7EA7"}],chat:[{label:"chatUrl",tip:"chat\u7684url\u5730\u5740",required:!0},{label:"chatToken",tip:"chat\u7684token\u7801",required:!0}],goCqHttpBot:[{label:"goCqHttpBotUrl",tip:"\u63A8\u9001\u5230\u4E2A\u4EBAQQ: http://127.0.0.1/send_private_msg\uFF0C\u7FA4\uFF1Ahttp://127.0.0.1/send_group_msg",required:!0},{label:"goCqHttpBotToken",tip:"\u8BBF\u95EE\u5BC6\u94A5",required:!0},{label:"goCqHttpBotQq",tip:"\u5982\u679CGOBOT_URL\u8BBE\u7F6E /send_private_msg \u5219\u9700\u8981\u586B\u5165 user_id=\u4E2A\u4EBAQQ \u76F8\u53CD\u5982\u679C\u662F /send_group_msg \u5219\u9700\u8981\u586B\u5165 group_id=QQ\u7FA4",required:!0}],serverChan:[{label:"serverChanKey",tip:"Server\u9171SENDKEY",required:!0}],pushDeer:[{label:"pushDeerKey",tip:"PushDeer\u7684Key\uFF0Chttps://github.com/easychen/pushdeer",required:!0},{label:"pushDeerUrl",tip:"PushDeer\u7684\u81EA\u67B6API endpoint\uFF0C\u9ED8\u8BA4\u662F https://api2.pushdeer.com/message/push"}],bark:[{label:"barkPush",tip:"Bark\u7684\u4FE1\u606FIP/\u8BBE\u5907\u7801\uFF0C\u4F8B\u5982\uFF1Ahttps://api.day.app/XXXXXXXX",required:!0},{label:"barkIcon",tip:"BARK\u63A8\u9001\u56FE\u6807,\u81EA\u5B9A\u4E49\u63A8\u9001\u56FE\u6807 (\u9700iOS15\u6216\u4EE5\u4E0A\u624D\u80FD\u663E\u793A)"},{label:"barkSound",tip:"BARK\u63A8\u9001\u94C3\u58F0,\u94C3\u58F0\u5217\u8868\u53BBAPP\u67E5\u770B\u590D\u5236\u586B\u5199"},{label:"barkGroup",tip:"BARK\u63A8\u9001\u6D88\u606F\u7684\u5206\u7EC4, \u9ED8\u8BA4\u4E3Aqinglong"}],telegramBot:[{label:"telegramBotToken",tip:"telegram\u673A\u5668\u4EBA\u7684token\uFF0C\u4F8B\u5982\uFF1A1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw",required:!0},{label:"telegramBotUserId",tip:"telegram\u7528\u6237\u7684id\uFF0C\u4F8B\u5982\uFF1A129xxx206",required:!0},{label:"telegramBotProxyHost",tip:"\u4EE3\u7406IP"},{label:"telegramBotProxyPort",tip:"\u4EE3\u7406\u7AEF\u53E3"},{label:"telegramBotProxyAuth",tip:"telegram\u4EE3\u7406\u914D\u7F6E\u8BA4\u8BC1\u53C2\u6570, \u7528\u6237\u540D\u4E0E\u5BC6\u7801\u7528\u82F1\u6587\u5192\u53F7\u8FDE\u63A5 user:password"},{label:"telegramBotApiHost",tip:"telegram api\u81EA\u5EFA\u7684\u53CD\u5411\u4EE3\u7406\u5730\u5740\uFF0C\u9ED8\u8BA4tg\u5B98\u65B9api"}],dingtalkBot:[{label:"dingtalkBotToken",tip:"\u9489\u9489\u673A\u5668\u4EBAwebhook token\uFF0C\u4F8B\u5982\uFF1A5a544165465465645d0f31dca676e7bd07415asdasd",required:!0},{label:"dingtalkBotSecret",tip:"\u5BC6\u94A5\uFF0C\u673A\u5668\u4EBA\u5B89\u5168\u8BBE\u7F6E\u9875\u9762\uFF0C\u52A0\u7B7E\u4E00\u680F\u4E0B\u9762\u663E\u793A\u7684SEC\u5F00\u5934\u7684\u5B57\u7B26\u4E32"}],weWorkBot:[{label:"weWorkBotKey",tip:"\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u7684 webhook(\u8BE6\u89C1\u6587\u6863 https://work.weixin.qq.com/api/doc/90000/90136/91770)\uFF0C\u4F8B\u5982\uFF1A693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa",required:!0},{label:"weWorkOrigin",tip:"\u4F01\u4E1A\u5FAE\u4FE1\u4EE3\u7406\u5730\u5740"}],weWorkApp:[{label:"weWorkAppKey",tip:"corpid,corpsecret,touser(\u6CE8:\u591A\u4E2A\u6210\u5458ID\u4F7F\u7528|\u9694\u5F00),agentid,\u6D88\u606F\u7C7B\u578B(\u9009\u586B,\u4E0D\u586B\u9ED8\u8BA4\u6587\u672C\u6D88\u606F\u7C7B\u578B) \u6CE8\u610F\u7528,\u53F7\u9694\u5F00(\u82F1\u6587\u8F93\u5165\u6CD5\u7684\u9017\u53F7)\uFF0C\u4F8B\u5982\uFF1Awwcfrs,B-76WERQ,qinglong,1000001,2COat",required:!0},{label:"weWorkOrigin",tip:"\u4F01\u4E1A\u5FAE\u4FE1\u4EE3\u7406\u5730\u5740"}],aibotk:[{label:"aibotkKey",tip:"\u5BC6\u94A5key,\u667A\u80FD\u5FAE\u79D8\u4E66\u4E2A\u4EBA\u4E2D\u5FC3\u83B7\u53D6apikey\uFF0C\u7533\u8BF7\u5730\u5740\uFF1Ahttps://wechat.aibotk.com/signup?from=ql",required:!0},{label:"aibotkType",tip:"\u53D1\u9001\u7684\u76EE\u6807\uFF0C\u7FA4\u7EC4\u6216\u8005\u597D\u53CB",required:!0,placeholder:"\u8BF7\u8F93\u5165\u8981\u53D1\u9001\u7684\u76EE\u6807",items:[{value:"room",label:"\u7FA4\u804A"},{value:"contact",label:"\u597D\u53CB"}]},{label:"aibotkName",tip:"\u8981\u53D1\u9001\u7684\u7528\u6237\u6635\u79F0\u6216\u7FA4\u540D\uFF0C\u5982\u679C\u76EE\u6807\u662F\u7FA4\uFF0C\u9700\u8981\u586B\u7FA4\u540D\uFF0C\u5982\u679C\u76EE\u6807\u662F\u597D\u53CB\uFF0C\u9700\u8981\u586B\u597D\u53CB\u6635\u79F0",required:!0}],iGot:[{label:"iGotPushKey",tip:"iGot\u7684\u4FE1\u606F\u63A8\u9001key\uFF0C\u4F8B\u5982\uFF1Ahttps://push.hellyw.com/XXXXXXXX",required:!0}],pushPlus:[{label:"pushPlusToken",tip:"\u5FAE\u4FE1\u626B\u7801\u767B\u5F55\u540E\u4E00\u5BF9\u4E00\u63A8\u9001\u6216\u4E00\u5BF9\u591A\u63A8\u9001\u4E0B\u9762\u7684token(\u60A8\u7684Token)\uFF0C\u4E0D\u63D0\u4F9BPUSH_PLUS_USER\u5219\u9ED8\u8BA4\u4E3A\u4E00\u5BF9\u4E00\u63A8\u9001\uFF0C\u53C2\u8003 https://www.pushplus.plus/",required:!0},{label:"pushPlusUser",tip:"\u4E00\u5BF9\u591A\u63A8\u9001\u7684\u201C\u7FA4\u7EC4\u7F16\u7801\u201D\uFF08\u4E00\u5BF9\u591A\u63A8\u9001\u4E0B\u9762->\u60A8\u7684\u7FA4\u7EC4(\u5982\u65E0\u5219\u65B0\u5EFA)->\u7FA4\u7EC4\u7F16\u7801\uFF0C\u5982\u679C\u60A8\u662F\u521B\u5EFA\u7FA4\u7EC4\u4EBA\u3002\u4E5F\u9700\u70B9\u51FB\u201C\u67E5\u770B\u4E8C\u7EF4\u7801\u201D\u626B\u63CF\u7ED1\u5B9A\uFF0C\u5426\u5219\u4E0D\u80FD\u63A5\u53D7\u7FA4\u7EC4\u6D88\u606F\u63A8\u9001\uFF09"}],lark:[{label:"larkKey",tip:"\u98DE\u4E66\u7FA4\u7EC4\u673A\u5668\u4EBA\uFF1Ahttps://www.feishu.cn/hc/zh-CN/articles/360024984973",required:!0}],email:[{label:"emailService",tip:"\u90AE\u7BB1\u670D\u52A1\u540D\u79F0\uFF0C\u6BD4\u5982126\u3001163\u3001Gmail\u3001QQ\u7B49\uFF0C\u652F\u6301\u5217\u8868https://nodemailer.com/smtp/well-known/",required:!0},{label:"emailUser",tip:"\u90AE\u7BB1\u5730\u5740",required:!0},{label:"emailPass",tip:"\u90AE\u7BB1SMTP\u6388\u6743\u7801",required:!0}],webhook:[{label:"webhookMethod",tip:"\u8BF7\u6C42\u65B9\u6CD5",required:!0,items:[{value:"GET"},{value:"POST"},{value:"PUT"}]},{label:"webhookContentType",tip:"\u8BF7\u6C42\u5934Content-Type",required:!0,items:[{value:"application/json"},{value:"multipart/form-data"},{value:"application/x-www-form-urlencoded"}]},{label:"webhookUrl",tip:"\u8BF7\u6C42\u94FE\u63A5\u4EE5http\u6216\u8005https\u5F00\u5934\u3002url\u6216\u8005body\u4E2D\u5FC5\u987B\u5305\u542B$title\uFF0C$content\u53EF\u9009\uFF0C\u5BF9\u5E94api\u5185\u5BB9\u7684\u4F4D\u7F6E",required:!0,placeholder:`https://xxx.cn/api?content=$title
2
+ `},{label:"webhookHeaders",tip:"\u8BF7\u6C42\u5934\u683C\u5F0FCustom-Header1: Header1\uFF0C\u591A\u4E2A\u6362\u884C\u5206\u5272",placeholder:`Custom-Header1: Header1
3
+ Custom-Header2: Header2`},{label:"webhookBody",tip:"\u8BF7\u6C42\u4F53\u683C\u5F0Fkey1: value1\uFF0C\u591A\u4E2A\u6362\u884C\u5206\u5272\u3002url\u6216\u8005body\u4E2D\u5FC5\u987B\u5305\u542B$title\uFF0C$content\u53EF\u9009\uFF0C\u5BF9\u5E94api\u5185\u5BB9\u7684\u4F4D\u7F6E",placeholder:`key1: $title
4
+ key2: $content`}]},documentTitleMap:{"/login":"\u767B\u5F55","/initialization":"\u521D\u59CB\u5316","/crontab":"\u5B9A\u65F6\u4EFB\u52A1","/env":"\u73AF\u5883\u53D8\u91CF","/subscription":"\u8BA2\u9605\u7BA1\u7406","/config":"\u914D\u7F6E\u6587\u4EF6","/script":"\u811A\u672C\u7BA1\u7406","/diff":"\u5BF9\u6BD4\u5DE5\u5177","/log":"\u65E5\u5FD7\u7BA1\u7406","/setting":"\u7CFB\u7EDF\u8BBE\u7F6E","/error":"\u9519\u8BEF\u65E5\u5FD7","/dependence":"\u4F9D\u8D56\u7BA1\u7406"},dependenceTypes:["nodejs","python3","linux"]}},35911:function(S,g,e){"use strict";e.d(g,{W:function(){return C}});var T=e(25359),c=e.n(T),h=e(49811),x=e.n(h),D=e(57213),f=e.n(D),_=e(50659),P=e(9835),E=e(90717),s=e(40440);P.ZP.config({duration:2});var n=Date.now(),O=function(a){if(a.response){var m=a.data?a.data.message||a.message||a.data:a.response.statusText,t=a.response.status;[502,504].includes(t)?s.history.push("/error"):t===401?s.history.location.pathname!=="/login"&&(P.ZP.error("\u767B\u5F55\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55"),localStorage.removeItem(E.Z.authKey),s.history.push("/login")):P.ZP.error({content:m,style:{maxWidth:500,margin:"0 auto"}})}else console.log(a.message);throw a},y=(0,_.l7)({timeout:6e4,params:{t:n},errorHandler:O}),L=["/api/user/login","/open/auth/token","/api/user/two-factor/login","/api/system","/api/user/init","/api/user/notification/init"];y.interceptors.request.use(function(r,a){var m=localStorage.getItem(E.Z.authKey);if(m&&!L.includes(r)){var t={Authorization:"Bearer ".concat(m)};return{url:r,options:f()(f()({},a),{},{headers:t})}}return{url:r,options:a}}),y.interceptors.response.use(function(){var r=x()(c()().mark(function a(m){var t,v,M;return c()().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(t=m.status,![502,504].includes(t)){o.next=5;break}s.history.push("/error"),o.next=14;break;case 5:if(t!==401){o.next=9;break}s.history.location.pathname!=="/login"&&(localStorage.removeItem(E.Z.authKey),s.history.push("/login")),o.next=14;break;case 9:return o.next=11,m.clone().json();case 11:return v=o.sent,v.code!==200&&(M=v.message||v.data,M&&P.ZP.error({content:M,style:{maxWidth:500,margin:"0 auto"}})),o.abrupt("return",v);case 14:return o.abrupt("return",m);case 15:case"end":return o.stop()}},a)}));return function(a){return r.apply(this,arguments)}}());var C=y},35716:function(){"use strict"},57002:function(){}}]);
@@ -10,6 +10,6 @@
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
13
- <script src="./umi.8ac0a928.js"></script>
13
+ <script src="./umi.6925882f.js"></script>
14
14
 
15
15
  </body></html>
@@ -1,2 +1,2 @@
1
1
  "use strict";(self.webpackChunk_whyour_qinglong=self.webpackChunk_whyour_qinglong||[]).push([[4473],{535:function(bn,tn,n){var mn=n(54306),m=n.n(mn),F=n(63313),u=n.n(F),y=n(61761),g=n(60001);tn.Z=function(d,I){var D=(0,F.useState)(0),M=m()(D,2),L=M[0],X=M[1];return(0,y.Z)(d,function(Z){var K=Z.target;K.classList.contains("ant-table-wrapper")||(K=Z.target.querySelector(".ant-table-wrapper")),X((0,g.W9)({extraHeight:I,target:K}))}),L}},73143:function(bn,tn,n){n.r(tn);var mn=n(57213),m=n.n(mn),F=n(54306),u=n.n(F),y=n(63313),g=n.n(y),d=n(92260),I=n(64865),D=n(84163),M=n(9835),L=n(394),X=n(51704),Z=n(15367),K=n(24378),O=n(1953),V=n(25265),yn=n(44968),Pn=n(69685),Y=n(20209),dn=n(65601),an=n(7688),Mn=n(76657),xn=n(3563),r=n(18197),Dn=n(93164),ln=n(35911),q=n(90717),Sn=n(60402),Cn=n(82755),J=n(44639),A=n(60001),a=n(11527),k=d.Z.Text,fn=[{key:"log",tab:"\u65E5\u5FD7"},{key:"script",tab:"\u811A\u672C"}],nn={".py":"python",".js":"javascript",".sh":"shell",".ts":"typescript"},N=navigator.language||navigator.languages[0],R=function(x){var W,rn,_,p=x.cron,S=p===void 0?{}:p,z=x.handleCancel,vn=x.visible,on=x.theme,B=x.isPhone,Q=(0,y.useState)("log"),t=u()(Q,2),C=t[0],en=t[1],$=(0,y.useState)(!0),P=u()($,2),le=P[0],w=P[1],In=(0,y.useState)([]),Jn=u()(In,2),oe=Jn[0],f=Jn[1],Ln=(0,y.useState)(""),Qn=u()(Ln,2),Rn=Qn[0],se=Qn[1],re=(0,y.useState)(""),Xn=u()(re,2),_n=Xn[0],gn=Xn[1],jn=(0,y.useState)(!1),Yn=u()(jn,2),qn=Yn[0],Wn=Yn[1],hn=(0,y.useRef)(null),ue=(0,y.useState)({}),Un=u()(ue,2),On=Un[0],Kn=Un[1],ce=(0,y.useState)(""),Vn=u()(ce,2),de=Vn[0],ne=Vn[1],fe=(0,y.useState)(fn),kn=u()(fe,2),Nn=kn[0],zn=kn[1],ve=(0,y.useState)({}),$n=u()(ve,2),s=$n[0],Bn=$n[1],me={log:(0,a.jsx)(I.ZP,{dataSource:oe,loading:le,renderItem:function(c){return(0,a.jsxs)(I.ZP.Item,{className:"log-item",onClick:function(){return ee(c)},children:[(0,a.jsx)(V.Z,{style:{marginRight:10}}),c.directory,"/",c.filename]})}}),script:On.filename&&(0,a.jsx)(Cn.ZP,{language:nn[On.filename.slice(-3)]||"",theme:on,value:_n,options:{fontSize:12,lineNumbersMinChars:3,fontFamily:"Source Code Pro",glyphMargin:!1,wordWrap:"on"},onMount:function(c,E){hn.current=c}})},ee=function(c){localStorage.setItem("logCron",s.id),ne("".concat(q.Z.apiPrefix,"logs/").concat(c.filename,"?path=").concat(c.directory||"")),ln.W.get("".concat(q.Z.apiPrefix,"logs/").concat(c.filename,"?path=").concat(c.directory||"")).then(function(E){var j=E.code,sn=E.data;j===200&&(se(sn),Wn(!0))})},ge=function(c){en(c)},wn=function(){w(!0),ln.W.get("".concat(q.Z.apiPrefix,"crons/").concat(S.id,"/logs")).then(function(c){var E=c.code,j=c.data;E===200&&f(j)}).finally(function(){return w(!1)})},Ce=function(){var c=(0,A.FA)(S.command);if(Array.isArray(c)){zn(Nn);var E=u()(c,2),j=E[0],sn=E[1];Kn({parent:sn,filename:j}),ln.W.get("".concat(q.Z.apiPrefix,"scripts/").concat(j,"?path=").concat(sn||"")).then(function(pn){var An=pn.code,G=pn.data;An===200&&gn(G)})}else c&&zn([Nn[0]])},te=function(){D.Z.confirm({title:"\u786E\u8BA4\u4FDD\u5B58",content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4\u4FDD\u5B58\u6587\u4EF6",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:On.filename})," ","\uFF0C\u4FDD\u5B58\u540E\u4E0D\u53EF\u6062\u590D"]}),onOk:function(){var E=hn.current?hn.current.getValue().replace(/\r\n/g,`
2
- `):_n;return new Promise(function(j,sn){ln.W.put("".concat(q.Z.apiPrefix,"scripts"),{data:{filename:On.filename,path:On.parent||"",content:E}}).then(function(pn){var An=pn.code,G=pn.data;An===200&&(gn(E),M.ZP.success("\u4FDD\u5B58\u6210\u529F")),j(null)}).catch(function(pn){return sn(pn)})})},onCancel:function(){console.log("Cancel")}})},Fn=function(){D.Z.confirm({title:"\u786E\u8BA4\u8FD0\u884C",content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4\u8FD0\u884C\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/run"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&(Bn(m()(m()({},s),{},{status:r.CrontabStatus.running})),setTimeout(function(){wn()},1e3))})},onCancel:function(){console.log("Cancel")}})},he=function(){D.Z.confirm({title:"\u786E\u8BA4\u505C\u6B62",content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4\u505C\u6B62\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/stop"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&Bn(m()(m()({},s),{},{status:r.CrontabStatus.idle}))})},onCancel:function(){console.log("Cancel")}})},Ee=function(){D.Z.confirm({title:"\u786E\u8BA4".concat(s.isDisabled===1?"\u542F\u7528":"\u7981\u7528"),content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4",s.isDisabled===1?"\u542F\u7528":"\u7981\u7528","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/").concat(s.isDisabled===1?"enable":"disable"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&Bn(m()(m()({},s),{},{isDisabled:s.isDisabled===1?0:1}))})},onCancel:function(){console.log("Cancel")}})},ae=function(){D.Z.confirm({title:"\u786E\u8BA4".concat(s.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"),content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4",s.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/").concat(s.isPinned===1?"unpin":"pin"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&Bn(m()(m()({},s),{},{isPinned:s.isPinned===1?0:1}))})},onCancel:function(){console.log("Cancel")}})},En=function(){var c,E=hn.current._domElement;(c=E.parentElement)===null||c===void 0||c.requestFullscreen()};return(0,y.useEffect)(function(){S&&S.id&&(Bn(S),wn(),Ce())},[S]),(0,a.jsxs)(D.Z,{title:(0,a.jsxs)("div",{className:"crontab-title-wrapper",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:s.name}),((W=s.labels)===null||W===void 0?void 0:W.length)>0&&s.labels[0]!==""&&(0,a.jsx)(L.Z,{type:"vertical"}),((rn=s.labels)===null||rn===void 0?void 0:rn.length)>0&&s.labels[0]!==""&&((_=s.labels)===null||_===void 0?void 0:_.map(function(T,c){return(0,a.jsx)(X.Z,{color:"blue",style:{marginRight:5},children:T},T)}))]}),(0,a.jsxs)("div",{className:"operations",children:[(0,a.jsx)(Z.Z,{title:s.status===r.CrontabStatus.idle?"\u8FD0\u884C":"\u505C\u6B62",children:(0,a.jsx)(K.Z,{type:"link",icon:s.status===r.CrontabStatus.idle?(0,a.jsx)(yn.Z,{}):(0,a.jsx)(Pn.Z,{}),size:"small",onClick:s.status===r.CrontabStatus.idle?Fn:he})}),(0,a.jsx)(Z.Z,{title:s.isDisabled===1?"\u542F\u7528":"\u7981\u7528",children:(0,a.jsx)(K.Z,{type:"link",icon:(0,a.jsx)(J.Z,{type:s.isDisabled===1?"ql-icon-enable":"ql-icon-disable"}),size:"small",onClick:Ee})}),(0,a.jsx)(Z.Z,{title:s.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876",children:(0,a.jsx)(K.Z,{type:"link",icon:(0,a.jsx)(J.Z,{type:s.isPinned===1?"ql-icon-untop":"ql-icon-top"}),size:"small",onClick:ae})})]})]}),centered:!0,open:vn,forceRender:!0,footer:!1,onCancel:function(){return z()},wrapClassName:"crontab-detail",width:B?"":"80vw",children:[(0,a.jsxs)("div",{className:"card-wrapper",children:[(0,a.jsx)(O.Z,{children:(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u4EFB\u52A1"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.command})]})}),(0,a.jsxs)(O.Z,{style:{marginTop:10},children:[(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u72B6\u6001"}),(0,a.jsxs)("div",{className:"cron-detail-info-value",children:[(!s.isDisabled||s.status!==r.CrontabStatus.idle)&&(0,a.jsxs)(a.Fragment,{children:[s.status===r.CrontabStatus.idle&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(Y.Z,{}),color:"default",children:"\u7A7A\u95F2\u4E2D"}),s.status===r.CrontabStatus.running&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(dn.Z,{spin:!0}),color:"processing",children:"\u8FD0\u884C\u4E2D"}),s.status===r.CrontabStatus.queued&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(an.Z,{}),color:"default",children:"\u961F\u5217\u4E2D"})]}),s.isDisabled===1&&s.status===r.CrontabStatus.idle&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(Mn.Z,{}),color:"error",children:"\u5DF2\u7981\u7528"})]})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u5B9A\u65F6"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.schedule})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u6700\u540E\u8FD0\u884C\u65F6\u95F4"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.last_execution_time?new Date(s.last_execution_time*1e3).toLocaleString(N,{hour12:!1}).replace(" 24:"," 00:"):"-"})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u6700\u540E\u8FD0\u884C\u65F6\u957F"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.last_running_time?(0,Dn.E)(s.last_running_time):"-"})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u4E0B\u6B21\u8FD0\u884C\u65F6\u95F4"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.nextRunTime&&s.nextRunTime.toLocaleString(N,{hour12:!1}).replace(" 24:"," 00:")})]})]}),(0,a.jsx)(O.Z,{style:{marginTop:10},tabList:Nn,activeTabKey:C,onTabChange:function(c){ge(c)},tabBarExtraContent:C==="script"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K.Z,{type:"primary",style:{marginRight:8},onClick:te,children:"\u4FDD\u5B58"}),(0,a.jsx)(K.Z,{type:"primary",icon:(0,a.jsx)(xn.Z,{}),onClick:En})]}),children:me[C]})]}),(0,a.jsx)(Sn.default,{visible:qn,handleCancel:function(){Wn(!1)},cron:S,data:Rn,logUrl:de})]})};tn.default=R},18197:function(bn,tn,n){n.r(tn),n.d(tn,{CrontabStatus:function(){return P},default:function(){return oe}});var mn=n(93525),m=n.n(mn),F=n(54306),u=n.n(F),y=n(57213),g=n.n(y),d=n(63313),I=n(92260),D=n(22159),M=n(51704),L=n(2947),X=n(15367),Z=n(84163),K=n(9835),O=n(34133),V=n(24378),yn=n(86986),Pn=n(60986),Y=n(43114),dn=n(20209),an=n(65601),Mn=n(7688),xn=n(76657),r=n(44968),Dn=n(69685),ln=n(97674),q=n(32132),Sn=n(38101),Cn=n(23421),J=n(13740),A=n(23831),a=n(59673),k=n(61327),fn=n(26839),nn=n(68834),N=n(99604),R=n(90717),un=n(38612),x=n(35911),W=n(13515),rn=n(60402),_=n(73143),p=n(93164),S=n(40440),z=n(77853),vn=n(15969),on=n(535),B=n(60001),Q=n(33503),t=n(11527),C=I.Z.Text,en=I.Z.Paragraph,$=D.Z.Search,P;(function(f){f[f.running=0]="running",f[f.idle=1]="idle",f[f.disabled=2]="disabled",f[f.queued=3]="queued"})(P||(P={}));var le={0:0,5:1,3:2,1:3,4:4},w;(function(f){f[f.\u542F\u7528=0]="\u542F\u7528",f[f.\u7981\u7528=1]="\u7981\u7528",f[f.\u8FD0\u884C=2]="\u8FD0\u884C",f[f.\u505C\u6B62=3]="\u505C\u6B62",f[f.\u7F6E\u9876=4]="\u7F6E\u9876",f[f.\u53D6\u6D88\u7F6E\u9876=5]="\u53D6\u6D88\u7F6E\u9876"})(w||(w={}));var In;(function(f){f[f.enable=0]="enable",f[f.disable=1]="disable",f[f.run=2]="run",f[f.stop=3]="stop",f[f.pin=4]="pin",f[f.unpin=5]="unpin"})(In||(In={}));var Jn=function(){var Ln=(0,S.useOutletContext)(),Qn=Ln.headerStyle,Rn=Ln.isPhone,se=Ln.theme,re=[{title:"\u540D\u79F0",dataIndex:"name",key:"name",width:150,render:function(e,i){var o,v;return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("a",{onClick:function(){ke(i),De(!0)},children:[(((o=i.labels)===null||o===void 0?void 0:o.length)>0&&i.labels[0],i.name||"-"),i.isPinned?(0,t.jsx)("span",{children:(0,t.jsx)(Y.Z,{})}):""]})})},sorter:{compare:function(e,i){var o;return e==null||(o=e.name)===null||o===void 0?void 0:o.localeCompare(i==null?void 0:i.name)}}},{title:"\u547D\u4EE4/\u811A\u672C",dataIndex:"command",key:"command",width:300,render:function(e,i){return(0,t.jsx)(en,{style:{wordBreak:"break-all",marginBottom:0},ellipsis:{tooltip:e,rows:2},children:(0,t.jsx)("a",{onClick:function(){lt(i)},children:e})})},sorter:{compare:function(e,i){return e.command.localeCompare(i.command)}}},{title:"\u5B9A\u65F6\u89C4\u5219",dataIndex:"schedule",key:"schedule",width:110,sorter:{compare:function(e,i){return e.schedule.localeCompare(i.schedule)}}},{title:"\u6700\u540E\u8FD0\u884C\u65F6\u95F4",dataIndex:"last_execution_time",key:"last_execution_time",width:150,sorter:{compare:function(e,i){return(e.last_execution_time||0)-(i.last_execution_time||0)}},render:function(e,i){var o=navigator.language||navigator.languages[0];return(0,t.jsx)("span",{style:{display:"block"},children:i.last_execution_time?new Date(i.last_execution_time*1e3).toLocaleString(o,{hour12:!1}).replace(" 24:"," 00:"):"-"})}},{title:"\u6700\u540E\u8FD0\u884C\u65F6\u957F",width:120,dataIndex:"last_running_time",key:"last_running_time",sorter:{compare:function(e,i){return e.last_running_time-i.last_running_time}},render:function(e,i){return i.last_running_time?(0,p.E)(i.last_running_time):"-"}},{title:"\u4E0B\u6B21\u8FD0\u884C\u65F6\u95F4",width:150,sorter:{compare:function(e,i){return e.nextRunTime-i.nextRunTime}},render:function(e,i){var o=navigator.language||navigator.languages[0];return i.nextRunTime.toLocaleString(o,{hour12:!1}).replace(" 24:"," 00:")}},{title:"\u72B6\u6001",key:"status",dataIndex:"status",width:88,filters:[{text:"\u8FD0\u884C\u4E2D",value:0},{text:"\u7A7A\u95F2\u4E2D",value:1},{text:"\u5DF2\u7981\u7528",value:2},{text:"\u961F\u5217\u4E2D",value:3}],render:function(e,i){return(0,t.jsxs)(t.Fragment,{children:[(!i.isDisabled||i.status!==P.idle)&&(0,t.jsxs)(t.Fragment,{children:[i.status===P.idle&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(dn.Z,{}),color:"default",children:"\u7A7A\u95F2\u4E2D"}),i.status===P.running&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(an.Z,{spin:!0}),color:"processing",children:"\u8FD0\u884C\u4E2D"}),i.status===P.queued&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(Mn.Z,{}),color:"default",children:"\u961F\u5217\u4E2D"})]}),i.isDisabled===1&&i.status===P.idle&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(xn.Z,{}),color:"error",children:"\u5DF2\u7981\u7528"})]})}},{title:"\u64CD\u4F5C",key:"action",width:130,render:function(e,i,o){var v=!Rn;return(0,t.jsxs)(L.Z,{size:"middle",children:[i.status===P.idle&&(0,t.jsx)(X.Z,{title:v?"\u8FD0\u884C":"",children:(0,t.jsx)("a",{onClick:function(H){H.stopPropagation(),ut(i,o)},children:(0,t.jsx)(r.Z,{})})}),i.status!==P.idle&&(0,t.jsx)(X.Z,{title:v?"\u505C\u6B62":"",children:(0,t.jsx)("a",{onClick:function(H){H.stopPropagation(),ct(i,o)},children:(0,t.jsx)(Dn.Z,{})})}),(0,t.jsx)(X.Z,{title:v?"\u65E5\u5FD7":"",children:(0,t.jsx)("a",{onClick:function(H){H.stopPropagation(),he(g()(g()({},i),{},{timestamp:Date.now()}))},children:(0,t.jsx)(ln.Z,{})})}),(0,t.jsx)(mt,{record:i,index:o},"more")]})}}],Xn=(0,d.useState)([]),_n=u()(Xn,2),gn=_n[0],jn=_n[1],Yn=(0,d.useState)(!0),qn=u()(Yn,2),Wn=qn[0],hn=qn[1],ue=(0,d.useState)(!1),Un=u()(ue,2),On=Un[0],Kn=Un[1],ce=(0,d.useState)(!1),Vn=u()(ce,2),de=Vn[0],ne=Vn[1],fe=(0,d.useState)(),kn=u()(fe,2),Nn=kn[0],zn=kn[1],ve=(0,d.useState)(""),$n=u()(ve,2),s=$n[0],Bn=$n[1],me=(0,d.useState)(!1),ee=u()(me,2),ge=ee[0],wn=ee[1],Ce=(0,d.useState)(),te=u()(Ce,2),Fn=te[0],he=te[1],Ee=(0,d.useState)([]),ae=u()(Ee,2),En=ae[0],T=ae[1],c=(0,d.useState)({}),E=u()(c,2),j=E[0],sn=E[1],pn=(0,d.useState)(),An=u()(pn,2),G=An[0],ie=An[1],We=(0,d.useState)(!1),pe=u()(We,2),Ue=pe[0],De=pe[1],Ke=(0,d.useState)(),Se=u()(Ke,2),Ve=Se[0],ke=Se[1],Ne=(0,d.useState)(""),ye=u()(Ne,2),ze=ye[0],$e=ye[1],we=(0,d.useState)(),Pe=u()(we,2),Me=Pe[0],Ge=Pe[1],He=(0,d.useState)(!1),Oe=u()(He,2),Je=Oe[0],Be=Oe[1],Qe=(0,d.useState)(!1),Fe=u()(Qe,2),Xe=Fe[0],Ze=Fe[1],Ye=(0,d.useState)([]),Ae=u()(Ye,2),qe=Ae[0],nt=Ae[1],et=(0,d.useState)([]),Te=u()(et,2),Zn=Te[0],tt=Te[1],at=(0,d.useState)(!1),be=u()(at,2),Ie=be[0],it=be[1],Le=(0,d.useRef)(),xe=(0,on.Z)(Le),lt=function(e){var i=(0,B.FA)(e.command);if(Array.isArray(i)){var o=u()(i,2),v=o[0],h=o[1];S.history.push("/script?p=".concat(h,"&s=").concat(v))}else i&&(location.href=i)},Gn=function(){hn(!0);var e=j.page,i=j.size,o=j.sorter,v=j.filters,h="".concat(R.Z.apiPrefix,"crons?searchValue=").concat(s,"&page=").concat(e,"&size=").concat(i,"&filters=").concat(JSON.stringify(v));o&&o.column&&o.order&&(h+="&sorter=".concat(JSON.stringify({field:o.column.key,type:o.order==="ascend"?"ASC":"DESC"}))),G&&(h+="&queryString=".concat(JSON.stringify({filters:G.filters,sorts:G.sorts,filterRelation:G.filterRelation||"and"}))),x.W.get(h).then(function(H){var b=H.code,U=H.data;if(b===200){var cn=U.data,Hn=U.total;jn(cn.map(function(_e){return g()(g()({},_e),{},{nextRunTime:(0,B.n$)(_e.schedule)})})),Ge(Hn)}}).finally(function(){return hn(!1)})},ot=function(){zn(null),Kn(!0)},st=function(e,i){zn(e),Kn(!0)},rt=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4\u5220\u9664",content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4\u5220\u9664\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.delete("".concat(R.Z.apiPrefix,"crons"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){K.ZP.success("\u5220\u9664\u6210\u529F");var b=m()(gn),U=b.findIndex(function(cn){return cn.id===e.id});U!==-1&&(b.splice(U,1),jn(b))}})},onCancel:function(){console.log("Cancel")}})},ut=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4\u8FD0\u884C",content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4\u8FD0\u884C\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/run"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=m()(gn),U=b.findIndex(function(cn){return cn.id===e.id});U!==-1&&(b.splice(U,1,g()(g()({},e),{},{status:P.running})),jn(b))}})},onCancel:function(){console.log("Cancel")}})},ct=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4\u505C\u6B62",content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4\u505C\u6B62\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/stop"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=m()(gn),U=b.findIndex(function(cn){return cn.id===e.id});U!==-1&&(b.splice(U,1,g()(g()({},e),{},{pid:null,status:P.idle})),jn(b))}})},onCancel:function(){console.log("Cancel")}})},dt=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4".concat(e.isDisabled===1?"\u542F\u7528":"\u7981\u7528"),content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4",e.isDisabled===1?"\u542F\u7528":"\u7981\u7528","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/").concat(e.isDisabled===1?"enable":"disable"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=e.isDisabled===1?0:1,U=m()(gn),cn=U.findIndex(function(Hn){return Hn.id===e.id});cn!==-1&&(U.splice(cn,1,g()(g()({},e),{},{isDisabled:b})),jn(U))}})},onCancel:function(){console.log("Cancel")}})},ft=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4".concat(e.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"),content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4",e.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/").concat(e.isPinned===1?"unpin":"pin"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=e.isPinned===1?0:1,U=m()(gn),cn=U.findIndex(function(Hn){return Hn.id===e.id});cn!==-1&&(U.splice(cn,1,g()(g()({},e),{},{isPinned:b})),jn(U))}})},onCancel:function(){console.log("Cancel")}})},vt=function(e){return[{label:"\u7F16\u8F91",key:"edit",icon:(0,t.jsx)(q.Z,{})},{label:e.isDisabled===1?"\u542F\u7528":"\u7981\u7528",key:"enableOrDisable",icon:e.isDisabled===1?(0,t.jsx)(Sn.Z,{}):(0,t.jsx)(Cn.Z,{})},{label:"\u5220\u9664",key:"delete",icon:(0,t.jsx)(J.Z,{})},{label:e.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876",key:"pinOrUnPin",icon:e.isPinned===1?(0,t.jsx)(Cn.Z,{}):(0,t.jsx)(Y.Z,{})}]},mt=function(e){var i=e.record,o=e.index;return(0,t.jsx)(O.Z,{placement:"bottomRight",trigger:["click"],menu:{items:vt(i),onClick:function(h){var H=h.key,b=h.domEvent;b.stopPropagation(),gt(H,i,o)}},children:(0,t.jsx)("a",{onClick:function(h){return h.stopPropagation()},children:(0,t.jsx)(A.Z,{})})})},gt=function(e,i,o){switch(e){case"edit":st(i,o);break;case"enableOrDisable":dt(i,o);break;case"delete":rt(i,o);break;case"pinOrUnPin":ft(i,o);break;default:break}},Ct=function(){Kn(!1),Gn()},ht=function(e){Bn(e.trim())},Et=function(e){x.W.get("".concat(R.Z.apiPrefix,"crons/").concat(e.id)).then(function(i){var o=i.code,v=i.data;if(o===200){var h=gn.findIndex(function(b){return b.id===e.id}),H=m()(gn);v.nextRunTime=(0,B.n$)(v.schedule),h!==-1&&(H.splice(h,1,g()(g()({},e),v)),jn(H))}}).finally(function(){return hn(!1)})},xt=function(e){T(e)},jt={selectedRowKeys:En,onChange:xt},pt=function(){Z.Z.confirm({title:"\u786E\u8BA4\u5220\u9664",content:(0,t.jsx)(t.Fragment,{children:"\u786E\u8BA4\u5220\u9664\u9009\u4E2D\u7684\u5B9A\u65F6\u4EFB\u52A1\u5417"}),onOk:function(){x.W.delete("".concat(R.Z.apiPrefix,"crons"),{data:En}).then(function(i){var o=i.code,v=i.data;o===200&&(K.ZP.success("\u6279\u91CF\u5220\u9664\u6210\u529F"),T([]),Gn())})},onCancel:function(){console.log("Cancel")}})},Tn=function(e){Z.Z.confirm({title:"\u786E\u8BA4".concat(w[e]),content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4",w[e],"\u9009\u4E2D\u7684\u5B9A\u65F6\u4EFB\u52A1\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/").concat(In[e]),{data:En}).then(function(o){var v=o.code,h=o.data;v===200&&Gn()})},onCancel:function(){console.log("Cancel")}})},Dt=function(e,i,o){var v=e.current,h=e.pageSize;sn({page:v,size:h,sorter:o,filters:i}),localStorage.setItem("pageSize",String(h))},St=function(e,i){return e.isPinned?"pinned-cron cron":"cron"};(0,d.useEffect)(function(){Fn&&(localStorage.setItem("logCron",Fn.id),wn(!0))},[Fn]),(0,d.useEffect)(function(){sn(g()(g()({},j),{},{page:1}))},[s]),(0,d.useEffect)(function(){j.page&&j.size&&Gn()},[j,G]),(0,d.useEffect)(function(){if(G&&Zn&&Zn.length>0){var l=Zn.slice(4).find(function(e){return e.id===G.id});it(!!l)}},[G,Zn]),(0,d.useEffect)(function(){je()},[]);var yt=function(e){switch(e){case"new":Be(!0);break;case"manage":Ze(!0);break;default:Re(e);break}},Pt={onClick:function(e){var i=e.key,o=e.domEvent;o.stopPropagation(),yt(i)},items:[].concat(m()(m()(Zn).slice(4).map(function(l){return{label:(0,t.jsxs)(L.Z,{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:l.name}),(G==null?void 0:G.id)===l.id&&(0,t.jsx)(a.Z,{style:{color:"#1890ff"}})]}),key:l.id,icon:(0,t.jsx)(k.Z,{})}})),[{type:"divider"},{label:"\u65B0\u5EFA\u89C6\u56FE",key:"new",icon:(0,t.jsx)(fn.Z,{})},{label:"\u89C6\u56FE\u7BA1\u7406",key:"manage",icon:(0,t.jsx)(nn.Z,{})}])},je=function(){hn(!0),x.W.get("".concat(R.Z.apiPrefix,"crons/views")).then(function(e){var i=e.code,o=e.data;if(i===200){nt(o);var v=o.filter(function(h){return!h.isDisabled});tt(v),sn({page:1,size:parseInt(localStorage.getItem("pageSize")||"20"),sorter:{},filters:{}}),ie(g()({},v[0]))}}).finally(function(){hn(!1)})},Re=function(e){var i=Zn.find(function(o){return o.id==e});T([]),sn(g()(g()({},j),{},{page:1})),ie(i||null)},Mt=(0,Q.u)(function(){return{scroll:{y:xe}}},[xe]),Ot=u()(Mt,1),Bt=Ot[0];return(0,t.jsxs)(un.ZP,{className:"ql-container-wrapper crontab-wrapper ql-container-wrapper-has-tab",title:"\u5B9A\u65F6\u4EFB\u52A1",extra:[(0,t.jsx)($,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\u6216\u8005\u5173\u952E\u8BCD",style:{width:"auto"},enterButton:!0,allowClear:!0,loading:Wn,value:ze,onChange:function(e){return $e(e.target.value)},onSearch:ht}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return ot()},children:"\u65B0\u5EFA\u4EFB\u52A1"},"2")],header:{style:Qn},children:[(0,t.jsx)(yn.Z,{defaultActiveKey:"all",size:"small",tabPosition:"top",className:"crontab-view ".concat(Ie?"more-active":""),tabBarExtraContent:(0,t.jsx)(O.Z,{menu:Pt,trigger:["click"],overlayStyle:{minWidth:200},children:(0,t.jsxs)("div",{className:"view-more ".concat(Ie?"active":""),children:[(0,t.jsxs)(L.Z,{children:["\u66F4\u591A",(0,t.jsx)(N.Z,{})]}),(0,t.jsx)("div",{className:"ant-tabs-ink-bar ant-tabs-ink-bar-animated"})]})}),onTabClick:Re,items:m()(m()(Zn).slice(0,4).map(function(l){return{key:l.id,label:l.name}}))}),(0,t.jsxs)("div",{ref:Le,children:[En.length>0&&(0,t.jsxs)("div",{style:{marginBottom:16},children:[(0,t.jsx)(V.Z,{type:"primary",style:{marginBottom:5},onClick:pt,children:"\u6279\u91CF\u5220\u9664"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(0)},style:{marginLeft:8,marginBottom:5},children:"\u6279\u91CF\u542F\u7528"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(1)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u7981\u7528"}),(0,t.jsx)(V.Z,{type:"primary",style:{marginRight:8},onClick:function(){return Tn(2)},children:"\u6279\u91CF\u8FD0\u884C"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(3)},children:"\u6279\u91CF\u505C\u6B62"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(4)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u7F6E\u9876"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(5)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u53D6\u6D88\u7F6E\u9876"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return ne(!0)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u4FEE\u6539\u6807\u7B7E"}),(0,t.jsxs)("span",{style:{marginLeft:8},children:["\u5DF2\u9009\u62E9",(0,t.jsx)("a",{children:En==null?void 0:En.length}),"\u9879"]})]}),(0,t.jsx)(Pn.Z,{columns:re,pagination:{current:j.page,pageSize:j.size,showSizeChanger:!0,simple:Rn,total:Me,showTotal:function(e,i){return"\u7B2C ".concat(i[0],"-").concat(i[1]," \u6761/\u603B\u5171 ").concat(e," \u6761")},pageSizeOptions:[10,20,50,100,200,500,Me||1e4].sort(function(l,e){return l-e})},dataSource:gn,rowKey:"id",size:"middle",scroll:{x:1e3,y:xe},loading:Wn,rowSelection:jt,rowClassName:St,onChange:Dt})]}),(0,t.jsx)(rn.default,{visible:ge,handleCancel:function(){Et(Fn),wn(!1)},cron:Fn}),(0,t.jsx)(W.default,{visible:On,handleCancel:Ct,cron:Nn}),(0,t.jsx)(W.CronLabelModal,{visible:de,handleCancel:function(e){ne(!1),e&&Gn()},ids:En}),(0,t.jsx)(_.default,{visible:Ue,handleCancel:function(){De(!1)},cron:Ve,theme:se,isPhone:Rn}),(0,t.jsx)(z.default,{visible:Je,handleCancel:function(e){Be(!1),je(),e&&e.id===G.id&&ie(g()(g()({},G),e))}}),(0,t.jsx)(vn.default,{cronViews:qe,visible:Xe,handleCancel:function(){Ze(!1)},cronViewChange:function(e){je(),e&&e.id===G.id&&ie(g()(g()({},G),e))}})]})},oe=Jn},60402:function(bn,tn,n){n.r(tn);var mn=n(54306),m=n.n(mn),F=n(63313),u=n.n(F),y=n(89065),g=n(9835),d=n(84163),I=n(24378),D=n(35911),M=n(90717),L=n(65601),X=n(38101),Z=n(55974),K=n(60001),O=n(11527),V;(function(Y){Y[Y.running=0]="running",Y[Y.idle=1]="idle",Y[Y.disabled=2]="disabled",Y[Y.queued=3]="queued"})(V||(V={}));var yn=y.Z.Countdown,Pn=function(dn){var an=dn.cron,Mn=dn.handleCancel,xn=dn.visible,r=dn.data,Dn=dn.logUrl,ln=(0,F.useState)("\u542F\u52A8\u4E2D..."),q=m()(ln,2),Sn=q[0],Cn=q[1],J=(0,F.useState)(!0),A=m()(J,2),a=A[0],k=A[1],fn=(0,F.useState)(!0),nn=m()(fn,2),N=nn[0],R=nn[1],un=(0,F.useState)(!1),x=m()(un,2),W=x[0],rn=x[1],_=(0,F.useRef)({value:0,down:!0}),p=function B(Q){Q&&k(!0),D.W.get(Dn||"".concat(M.Z.apiPrefix,"crons/").concat(an.id,"/log")).then(function(t){var C=t.code,en=t.data;if(C===200&&localStorage.getItem("logCron")===String(an.id)&&en!==Sn){var $=en;Cn($||"\u6682\u65E0\u65E5\u5FD7");var P=!!($&&!(0,K.x$)($)&&!$.includes("\u91CD\u542F\u9762\u677F")&&!$.includes("\u4EFB\u52A1\u672A\u8FD0\u884C"));R(P),S(),P&&setTimeout(function(){B()},2e3),$&&$.includes("\u91CD\u542F\u9762\u677F")&&an.status===V.running&&(g.ZP.warning({content:(0,O.jsxs)("span",{children:["\u7CFB\u7EDF\u5C06\u5728",(0,O.jsx)(yn,{className:"inline-countdown",format:"ss",value:Date.now()+1e3*30}),"\u79D2\u540E\u81EA\u52A8\u5237\u65B0"]}),duration:10}),setTimeout(function(){window.location.reload()},3e4))}}).finally(function(){Q&&k(!1)})},S=function(){_.current.down&&setTimeout(function(){document.querySelector("#log-flag").scrollIntoView({behavior:"smooth"})},1e3)},z=function(){localStorage.removeItem("logCron"),Mn()},vn=function(Q){var t=Q.target.scrollTop;_.current.down&&(_.current={value:t,down:t>_.current.value})},on=function(){return(0,O.jsxs)(O.Fragment,{children:[(N||a)&&(0,O.jsx)(L.Z,{spin:!0}),!N&&!a&&(0,O.jsx)(X.Z,{}),(0,O.jsx)("span",{style:{marginLeft:5},children:an&&an.name})]})};return(0,F.useEffect)(function(){an&&an.id&&xn&&p(!0)},[an,xn]),(0,F.useEffect)(function(){r&&Cn(r)},[r]),(0,F.useEffect)(function(){rn(document.body.clientWidth<768)},[]),(0,O.jsx)(d.Z,{title:on(),open:xn,centered:!0,className:"log-modal",bodyStyle:{minHeight:"300px"},forceRender:!0,onOk:function(){return z()},onCancel:function(){return z()},footer:[(0,O.jsx)(I.Z,{type:"primary",onClick:function(){return z()},children:"\u77E5\u9053\u4E86"})],children:(0,O.jsxs)("div",{onScroll:vn,className:"log-container",children:[a?(0,O.jsx)(Z.Z,{}):(0,O.jsx)("pre",{style:W?{fontFamily:"Source Code Pro",width:375,zoom:.83}:{},children:Sn}),(0,O.jsx)("div",{id:"log-flag"})]})})};tn.default=Pn},13515:function(bn,tn,n){n.r(tn),n.d(tn,{CronLabelModal:function(){return Sn},default:function(){return q}});var mn=n(25359),m=n.n(mn),F=n(57213),u=n.n(F),y=n(49811),g=n.n(y),d=n(54306),I=n.n(d),D=n(63313),M=n(67393),L=n(9835),X=n(84163),Z=n(22159),K=n(24378),O=n(35911),V=n(90717),yn=n(11186),Pn=n.n(yn),Y=n(93525),dn=n.n(Y),an=n(51704),Mn=n(8297),xn=n(26839),r=n(11527),Dn=function(J){var A=J.value,a=J.onChange,k=(0,D.useState)(""),fn=I()(k,2),nn=fn[0],N=fn[1],R=(0,D.useState)(!1),un=I()(R,2),x=un[0],W=un[1],rn=(0,D.useState)([]),_=I()(rn,2),p=_[0],S=_[1],z=(0,D.useRef)(),vn=function(en){var $=p.filter(function(P){return P!==en});S($),a==null||a($)},on=function(){W(!0)},B=function(en){N(en.target.value)},Q=function(){nn&&!p.includes(nn)&&(S([].concat(dn()(p),[nn])),a==null||a([].concat(dn()(p),[nn]))),W(!1),N("")},t=p.map(function(C){var en=(0,r.jsx)(an.Z,{closable:!0,onClose:function(P){P.preventDefault(),vn(C)},children:C});return(0,r.jsx)("span",{style:{display:"inline-block",marginBottom:8},children:en},C)});return(0,D.useEffect)(function(){x&&z&&z.current.focus()},[x]),(0,D.useEffect)(function(){A&&S(A)},[A]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Mn.Z,{enter:{scale:.8,opacity:0,type:"from",duration:100},leave:{opacity:0,width:0,scale:0,duration:200},appear:!1,children:t}),x&&(0,r.jsx)(Z.Z,{ref:z,type:"text",size:"small",style:{width:78},value:nn,onChange:B,onBlur:Q,onPressEnter:Q}),!x&&(0,r.jsxs)(an.Z,{onClick:on,style:{borderStyle:"dashed",cursor:"pointer"},children:[(0,r.jsx)(xn.Z,{})," \u65B0\u5EFA"]})]})},ln=Dn,q=function(J){var A=J.cron,a=J.handleCancel,k=J.visible,fn=M.Z.useForm(),nn=I()(fn,1),N=nn[0],R=(0,D.useState)(!1),un=I()(R,2),x=un[0],W=un[1],rn=function(){var _=g()(m()().mark(function p(S){var z,vn,on,B,Q;return m()().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return W(!0),z=A?"put":"post",vn=u()({},S),A&&(vn.id=A.id),C.prev=4,C.next=7,O.W[z]("".concat(V.Z.apiPrefix,"crons"),{data:vn});case 7:on=C.sent,B=on.code,Q=on.data,B===200&&(L.ZP.success(A?"\u66F4\u65B0Cron\u6210\u529F":"\u65B0\u5EFACron\u6210\u529F"),a(Q)),W(!1),C.next=17;break;case 14:C.prev=14,C.t0=C.catch(4),W(!1);case 17:case"end":return C.stop()}},p,null,[[4,14]])}));return function(S){return _.apply(this,arguments)}}();return(0,D.useEffect)(function(){N.resetFields()},[A,k]),(0,r.jsx)(X.Z,{title:A?"\u7F16\u8F91\u4EFB\u52A1":"\u65B0\u5EFA\u4EFB\u52A1",open:k,forceRender:!0,centered:!0,maskClosable:!1,onOk:function(){N.validateFields().then(function(p){rn(p)}).catch(function(p){console.log("Validate Failed:",p)})},onCancel:function(){return a()},confirmLoading:x,children:(0,r.jsxs)(M.Z,{form:N,layout:"vertical",name:"form_in_modal",initialValues:A,children:[(0,r.jsx)(M.Z.Item,{name:"name",label:"\u540D\u79F0",children:(0,r.jsx)(Z.Z,{placeholder:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"})}),(0,r.jsx)(M.Z.Item,{name:"command",label:"\u547D\u4EE4/\u811A\u672C",rules:[{required:!0,whitespace:!0}],children:(0,r.jsx)(Z.Z.TextArea,{rows:4,autoSize:!0,placeholder:"\u652F\u6301\u8F93\u5165\u811A\u672C\u8DEF\u5F84/\u4EFB\u610F\u7CFB\u7EDF\u53EF\u6267\u884C\u547D\u4EE4/task \u811A\u672C\u8DEF\u5F84"})}),(0,r.jsx)(M.Z.Item,{name:"schedule",label:"\u5B9A\u65F6\u89C4\u5219",rules:[{required:!0},{validator:function(p,S){return!S||Pn().parseExpression(S).hasNext()?Promise.resolve():Promise.reject("Cron\u8868\u8FBE\u5F0F\u683C\u5F0F\u6709\u8BEF")}}],children:(0,r.jsx)(Z.Z,{placeholder:"\u79D2(\u53EF\u9009) \u5206 \u65F6 \u5929 \u6708 \u5468"})}),(0,r.jsx)(M.Z.Item,{name:"labels",label:"\u6807\u7B7E",children:(0,r.jsx)(ln,{})})]})})},Sn=function(J){var A=J.ids,a=J.handleCancel,k=J.visible,fn=M.Z.useForm(),nn=I()(fn,1),N=nn[0],R=(0,D.useState)(!1),un=I()(R,2),x=un[0],W=un[1],rn=function(){var p=g()(m()().mark(function S(z){return m()().wrap(function(on){for(;;)switch(on.prev=on.next){case 0:N.validateFields().then(function(){var B=g()(m()().mark(function Q(t){var C,en,$,P;return m()().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return W(!0),C={ids:A,labels:t.labels},w.prev=2,w.next=5,O.W[z]("".concat(V.Z.apiPrefix,"crons/labels"),{data:C});case 5:en=w.sent,$=en.code,P=en.data,$===200&&(L.ZP.success(z==="post"?"\u6DFB\u52A0Labels\u6210\u529F":"\u5220\u9664Labels\u6210\u529F"),a(!0)),W(!1),w.next=15;break;case 12:w.prev=12,w.t0=w.catch(2),W(!1);case 15:case"end":return w.stop()}},Q,null,[[2,12]])}));return function(Q){return B.apply(this,arguments)}}()).catch(function(B){console.log("Validate Failed:",B)});case 1:case"end":return on.stop()}},S)}));return function(z){return p.apply(this,arguments)}}();(0,D.useEffect)(function(){N.resetFields()},[A,k]);var _=[(0,r.jsx)(K.Z,{onClick:function(){return a(!1)},children:"\u53D6\u6D88"}),(0,r.jsx)(K.Z,{type:"primary",danger:!0,onClick:function(){return rn("delete")},children:"\u5220\u9664"}),(0,r.jsx)(K.Z,{type:"primary",onClick:function(){return rn("post")},children:"\u6DFB\u52A0"})];return(0,r.jsx)(X.Z,{title:"\u6279\u91CF\u4FEE\u6539\u6807\u7B7E",open:k,footer:_,centered:!0,maskClosable:!1,forceRender:!0,onCancel:function(){return a(!1)},confirmLoading:x,children:(0,r.jsx)(M.Z,{form:N,layout:"vertical",name:"form_in_label_modal",children:(0,r.jsx)(M.Z.Item,{name:"labels",label:"\u6807\u7B7E",children:(0,r.jsx)(ln,{})})})})}},93164:function(bn,tn,n){n.d(tn,{E:function(){return mn}});function mn(m){var F=m*1e3,u=Math.floor(F/(24*3600*1e3)),y=F%(24*3600*1e3),g=Math.floor(y/(3600*1e3)),d=y%(3600*1e3),I=Math.floor(d/(60*1e3)),D=d%(60*1e3),M=Math.round(D/1e3),L=M+"\u79D2";return I>0&&(L=I+"\u5206"+L),g>0&&(L=g+"\u5C0F\u65F6"+L),u>0&&(L=u+"\u5929"+L),L}}}]);
2
+ `):_n;return new Promise(function(j,sn){ln.W.put("".concat(q.Z.apiPrefix,"scripts"),{data:{filename:On.filename,path:On.parent||"",content:E}}).then(function(pn){var An=pn.code,G=pn.data;An===200&&(gn(E),M.ZP.success("\u4FDD\u5B58\u6210\u529F")),j(null)}).catch(function(pn){return sn(pn)})})},onCancel:function(){console.log("Cancel")}})},Fn=function(){D.Z.confirm({title:"\u786E\u8BA4\u8FD0\u884C",content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4\u8FD0\u884C\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/run"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&(Bn(m()(m()({},s),{},{status:r.CrontabStatus.running})),setTimeout(function(){wn()},1e3))})},onCancel:function(){console.log("Cancel")}})},he=function(){D.Z.confirm({title:"\u786E\u8BA4\u505C\u6B62",content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4\u505C\u6B62\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/stop"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&Bn(m()(m()({},s),{},{status:r.CrontabStatus.idle}))})},onCancel:function(){console.log("Cancel")}})},Ee=function(){D.Z.confirm({title:"\u786E\u8BA4".concat(s.isDisabled===1?"\u542F\u7528":"\u7981\u7528"),content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4",s.isDisabled===1?"\u542F\u7528":"\u7981\u7528","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/").concat(s.isDisabled===1?"enable":"disable"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&Bn(m()(m()({},s),{},{isDisabled:s.isDisabled===1?0:1}))})},onCancel:function(){console.log("Cancel")}})},ae=function(){D.Z.confirm({title:"\u786E\u8BA4".concat(s.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"),content:(0,a.jsxs)(a.Fragment,{children:["\u786E\u8BA4",s.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,a.jsx)(k,{style:{wordBreak:"break-all"},type:"warning",children:s.name})," ","\u5417"]}),onOk:function(){ln.W.put("".concat(q.Z.apiPrefix,"crons/").concat(s.isPinned===1?"unpin":"pin"),{data:[s.id]}).then(function(E){var j=E.code,sn=E.data;j===200&&Bn(m()(m()({},s),{},{isPinned:s.isPinned===1?0:1}))})},onCancel:function(){console.log("Cancel")}})},En=function(){var c,E=hn.current._domElement;(c=E.parentElement)===null||c===void 0||c.requestFullscreen()};return(0,y.useEffect)(function(){S&&S.id&&(Bn(S),wn(),Ce())},[S]),(0,a.jsxs)(D.Z,{title:(0,a.jsxs)("div",{className:"crontab-title-wrapper",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{children:s.name}),((W=s.labels)===null||W===void 0?void 0:W.length)>0&&s.labels[0]!==""&&(0,a.jsx)(L.Z,{type:"vertical"}),((rn=s.labels)===null||rn===void 0?void 0:rn.length)>0&&s.labels[0]!==""&&((_=s.labels)===null||_===void 0?void 0:_.map(function(T,c){return(0,a.jsx)(X.Z,{color:"blue",style:{marginRight:5},children:T},T)}))]}),(0,a.jsxs)("div",{className:"operations",children:[(0,a.jsx)(Z.Z,{title:s.status===r.CrontabStatus.idle?"\u8FD0\u884C":"\u505C\u6B62",children:(0,a.jsx)(K.Z,{type:"link",icon:s.status===r.CrontabStatus.idle?(0,a.jsx)(yn.Z,{}):(0,a.jsx)(Pn.Z,{}),size:"small",onClick:s.status===r.CrontabStatus.idle?Fn:he})}),(0,a.jsx)(Z.Z,{title:s.isDisabled===1?"\u542F\u7528":"\u7981\u7528",children:(0,a.jsx)(K.Z,{type:"link",icon:(0,a.jsx)(J.Z,{type:s.isDisabled===1?"ql-icon-enable":"ql-icon-disable"}),size:"small",onClick:Ee})}),(0,a.jsx)(Z.Z,{title:s.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876",children:(0,a.jsx)(K.Z,{type:"link",icon:(0,a.jsx)(J.Z,{type:s.isPinned===1?"ql-icon-untop":"ql-icon-top"}),size:"small",onClick:ae})})]})]}),centered:!0,open:vn,forceRender:!0,footer:!1,onCancel:function(){return z()},wrapClassName:"crontab-detail",width:B?"":"80vw",children:[(0,a.jsxs)("div",{className:"card-wrapper",children:[(0,a.jsx)(O.Z,{children:(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u4EFB\u52A1"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.command})]})}),(0,a.jsxs)(O.Z,{style:{marginTop:10},children:[(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u72B6\u6001"}),(0,a.jsxs)("div",{className:"cron-detail-info-value",children:[(!s.isDisabled||s.status!==r.CrontabStatus.idle)&&(0,a.jsxs)(a.Fragment,{children:[s.status===r.CrontabStatus.idle&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(Y.Z,{}),color:"default",children:"\u7A7A\u95F2\u4E2D"}),s.status===r.CrontabStatus.running&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(dn.Z,{spin:!0}),color:"processing",children:"\u8FD0\u884C\u4E2D"}),s.status===r.CrontabStatus.queued&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(an.Z,{}),color:"default",children:"\u961F\u5217\u4E2D"})]}),s.isDisabled===1&&s.status===r.CrontabStatus.idle&&(0,a.jsx)(X.Z,{icon:(0,a.jsx)(Mn.Z,{}),color:"error",children:"\u5DF2\u7981\u7528"})]})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u5B9A\u65F6"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.schedule})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u6700\u540E\u8FD0\u884C\u65F6\u95F4"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.last_execution_time?new Date(s.last_execution_time*1e3).toLocaleString(N,{hour12:!1}).replace(" 24:"," 00:"):"-"})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u6700\u540E\u8FD0\u884C\u65F6\u957F"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.last_running_time?(0,Dn.E)(s.last_running_time):"-"})]}),(0,a.jsxs)("div",{className:"cron-detail-info-item",children:[(0,a.jsx)("div",{className:"cron-detail-info-title",children:"\u4E0B\u6B21\u8FD0\u884C\u65F6\u95F4"}),(0,a.jsx)("div",{className:"cron-detail-info-value",children:s.nextRunTime&&s.nextRunTime.toLocaleString(N,{hour12:!1}).replace(" 24:"," 00:")})]})]}),(0,a.jsx)(O.Z,{style:{marginTop:10},tabList:Nn,activeTabKey:C,onTabChange:function(c){ge(c)},tabBarExtraContent:C==="script"&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K.Z,{type:"primary",style:{marginRight:8},onClick:te,children:"\u4FDD\u5B58"}),(0,a.jsx)(K.Z,{type:"primary",icon:(0,a.jsx)(xn.Z,{}),onClick:En})]}),children:me[C]})]}),(0,a.jsx)(Sn.default,{visible:qn,handleCancel:function(){Wn(!1)},cron:S,data:Rn,logUrl:de})]})};tn.default=R},18197:function(bn,tn,n){n.r(tn),n.d(tn,{CrontabStatus:function(){return P},default:function(){return oe}});var mn=n(93525),m=n.n(mn),F=n(54306),u=n.n(F),y=n(57213),g=n.n(y),d=n(63313),I=n(92260),D=n(22159),M=n(51704),L=n(2947),X=n(15367),Z=n(84163),K=n(9835),O=n(34133),V=n(24378),yn=n(86986),Pn=n(60986),Y=n(43114),dn=n(20209),an=n(65601),Mn=n(7688),xn=n(76657),r=n(44968),Dn=n(69685),ln=n(97674),q=n(32132),Sn=n(38101),Cn=n(23421),J=n(13740),A=n(23831),a=n(59673),k=n(61327),fn=n(26839),nn=n(68834),N=n(99604),R=n(90717),un=n(38612),x=n(35911),W=n(13515),rn=n(60402),_=n(73143),p=n(93164),S=n(40440),z=n(77853),vn=n(15969),on=n(535),B=n(60001),Q=n(33503),t=n(11527),C=I.Z.Text,en=I.Z.Paragraph,$=D.Z.Search,P;(function(f){f[f.running=0]="running",f[f.queued=1]="queued",f[f.idle=2]="idle",f[f.disabled=3]="disabled"})(P||(P={}));var le={0:0,5:1,3:2,1:3,4:4},w;(function(f){f[f.\u542F\u7528=0]="\u542F\u7528",f[f.\u7981\u7528=1]="\u7981\u7528",f[f.\u8FD0\u884C=2]="\u8FD0\u884C",f[f.\u505C\u6B62=3]="\u505C\u6B62",f[f.\u7F6E\u9876=4]="\u7F6E\u9876",f[f.\u53D6\u6D88\u7F6E\u9876=5]="\u53D6\u6D88\u7F6E\u9876"})(w||(w={}));var In;(function(f){f[f.enable=0]="enable",f[f.disable=1]="disable",f[f.run=2]="run",f[f.stop=3]="stop",f[f.pin=4]="pin",f[f.unpin=5]="unpin"})(In||(In={}));var Jn=function(){var Ln=(0,S.useOutletContext)(),Qn=Ln.headerStyle,Rn=Ln.isPhone,se=Ln.theme,re=[{title:"\u540D\u79F0",dataIndex:"name",key:"name",width:150,render:function(e,i){var o,v;return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("a",{onClick:function(){ke(i),De(!0)},children:[(((o=i.labels)===null||o===void 0?void 0:o.length)>0&&i.labels[0],i.name||"-"),i.isPinned?(0,t.jsx)("span",{children:(0,t.jsx)(Y.Z,{})}):""]})})},sorter:{compare:function(e,i){var o;return e==null||(o=e.name)===null||o===void 0?void 0:o.localeCompare(i==null?void 0:i.name)}}},{title:"\u547D\u4EE4/\u811A\u672C",dataIndex:"command",key:"command",width:300,render:function(e,i){return(0,t.jsx)(en,{style:{wordBreak:"break-all",marginBottom:0},ellipsis:{tooltip:e,rows:2},children:(0,t.jsx)("a",{onClick:function(){lt(i)},children:e})})},sorter:{compare:function(e,i){return e.command.localeCompare(i.command)}}},{title:"\u5B9A\u65F6\u89C4\u5219",dataIndex:"schedule",key:"schedule",width:110,sorter:{compare:function(e,i){return e.schedule.localeCompare(i.schedule)}}},{title:"\u6700\u540E\u8FD0\u884C\u65F6\u95F4",dataIndex:"last_execution_time",key:"last_execution_time",width:150,sorter:{compare:function(e,i){return(e.last_execution_time||0)-(i.last_execution_time||0)}},render:function(e,i){var o=navigator.language||navigator.languages[0];return(0,t.jsx)("span",{style:{display:"block"},children:i.last_execution_time?new Date(i.last_execution_time*1e3).toLocaleString(o,{hour12:!1}).replace(" 24:"," 00:"):"-"})}},{title:"\u6700\u540E\u8FD0\u884C\u65F6\u957F",width:120,dataIndex:"last_running_time",key:"last_running_time",sorter:{compare:function(e,i){return e.last_running_time-i.last_running_time}},render:function(e,i){return i.last_running_time?(0,p.E)(i.last_running_time):"-"}},{title:"\u4E0B\u6B21\u8FD0\u884C\u65F6\u95F4",width:150,sorter:{compare:function(e,i){return e.nextRunTime-i.nextRunTime}},render:function(e,i){var o=navigator.language||navigator.languages[0];return i.nextRunTime.toLocaleString(o,{hour12:!1}).replace(" 24:"," 00:")}},{title:"\u72B6\u6001",key:"status",dataIndex:"status",width:88,filters:[{text:"\u8FD0\u884C\u4E2D",value:0},{text:"\u7A7A\u95F2\u4E2D",value:1},{text:"\u5DF2\u7981\u7528",value:2},{text:"\u961F\u5217\u4E2D",value:3}],render:function(e,i){return(0,t.jsxs)(t.Fragment,{children:[(!i.isDisabled||i.status!==P.idle)&&(0,t.jsxs)(t.Fragment,{children:[i.status===P.idle&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(dn.Z,{}),color:"default",children:"\u7A7A\u95F2\u4E2D"}),i.status===P.running&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(an.Z,{spin:!0}),color:"processing",children:"\u8FD0\u884C\u4E2D"}),i.status===P.queued&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(Mn.Z,{}),color:"default",children:"\u961F\u5217\u4E2D"})]}),i.isDisabled===1&&i.status===P.idle&&(0,t.jsx)(M.Z,{icon:(0,t.jsx)(xn.Z,{}),color:"error",children:"\u5DF2\u7981\u7528"})]})}},{title:"\u64CD\u4F5C",key:"action",width:130,render:function(e,i,o){var v=!Rn;return(0,t.jsxs)(L.Z,{size:"middle",children:[i.status===P.idle&&(0,t.jsx)(X.Z,{title:v?"\u8FD0\u884C":"",children:(0,t.jsx)("a",{onClick:function(H){H.stopPropagation(),ut(i,o)},children:(0,t.jsx)(r.Z,{})})}),i.status!==P.idle&&(0,t.jsx)(X.Z,{title:v?"\u505C\u6B62":"",children:(0,t.jsx)("a",{onClick:function(H){H.stopPropagation(),ct(i,o)},children:(0,t.jsx)(Dn.Z,{})})}),(0,t.jsx)(X.Z,{title:v?"\u65E5\u5FD7":"",children:(0,t.jsx)("a",{onClick:function(H){H.stopPropagation(),he(g()(g()({},i),{},{timestamp:Date.now()}))},children:(0,t.jsx)(ln.Z,{})})}),(0,t.jsx)(mt,{record:i,index:o},"more")]})}}],Xn=(0,d.useState)([]),_n=u()(Xn,2),gn=_n[0],jn=_n[1],Yn=(0,d.useState)(!0),qn=u()(Yn,2),Wn=qn[0],hn=qn[1],ue=(0,d.useState)(!1),Un=u()(ue,2),On=Un[0],Kn=Un[1],ce=(0,d.useState)(!1),Vn=u()(ce,2),de=Vn[0],ne=Vn[1],fe=(0,d.useState)(),kn=u()(fe,2),Nn=kn[0],zn=kn[1],ve=(0,d.useState)(""),$n=u()(ve,2),s=$n[0],Bn=$n[1],me=(0,d.useState)(!1),ee=u()(me,2),ge=ee[0],wn=ee[1],Ce=(0,d.useState)(),te=u()(Ce,2),Fn=te[0],he=te[1],Ee=(0,d.useState)([]),ae=u()(Ee,2),En=ae[0],T=ae[1],c=(0,d.useState)({}),E=u()(c,2),j=E[0],sn=E[1],pn=(0,d.useState)(),An=u()(pn,2),G=An[0],ie=An[1],We=(0,d.useState)(!1),pe=u()(We,2),Ue=pe[0],De=pe[1],Ke=(0,d.useState)(),Se=u()(Ke,2),Ve=Se[0],ke=Se[1],Ne=(0,d.useState)(""),ye=u()(Ne,2),ze=ye[0],$e=ye[1],we=(0,d.useState)(),Pe=u()(we,2),Me=Pe[0],Ge=Pe[1],He=(0,d.useState)(!1),Oe=u()(He,2),Je=Oe[0],Be=Oe[1],Qe=(0,d.useState)(!1),Fe=u()(Qe,2),Xe=Fe[0],Ze=Fe[1],Ye=(0,d.useState)([]),Ae=u()(Ye,2),qe=Ae[0],nt=Ae[1],et=(0,d.useState)([]),Te=u()(et,2),Zn=Te[0],tt=Te[1],at=(0,d.useState)(!1),be=u()(at,2),Ie=be[0],it=be[1],Le=(0,d.useRef)(),xe=(0,on.Z)(Le),lt=function(e){var i=(0,B.FA)(e.command);if(Array.isArray(i)){var o=u()(i,2),v=o[0],h=o[1];S.history.push("/script?p=".concat(h,"&s=").concat(v))}else i&&(location.href=i)},Gn=function(){hn(!0);var e=j.page,i=j.size,o=j.sorter,v=j.filters,h="".concat(R.Z.apiPrefix,"crons?searchValue=").concat(s,"&page=").concat(e,"&size=").concat(i,"&filters=").concat(JSON.stringify(v));o&&o.column&&o.order&&(h+="&sorter=".concat(JSON.stringify({field:o.column.key,type:o.order==="ascend"?"ASC":"DESC"}))),G&&(h+="&queryString=".concat(JSON.stringify({filters:G.filters,sorts:G.sorts,filterRelation:G.filterRelation||"and"}))),x.W.get(h).then(function(H){var b=H.code,U=H.data;if(b===200){var cn=U.data,Hn=U.total;jn(cn.map(function(_e){return g()(g()({},_e),{},{nextRunTime:(0,B.n$)(_e.schedule)})})),Ge(Hn)}}).finally(function(){return hn(!1)})},ot=function(){zn(null),Kn(!0)},st=function(e,i){zn(e),Kn(!0)},rt=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4\u5220\u9664",content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4\u5220\u9664\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.delete("".concat(R.Z.apiPrefix,"crons"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){K.ZP.success("\u5220\u9664\u6210\u529F");var b=m()(gn),U=b.findIndex(function(cn){return cn.id===e.id});U!==-1&&(b.splice(U,1),jn(b))}})},onCancel:function(){console.log("Cancel")}})},ut=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4\u8FD0\u884C",content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4\u8FD0\u884C\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/run"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=m()(gn),U=b.findIndex(function(cn){return cn.id===e.id});U!==-1&&(b.splice(U,1,g()(g()({},e),{},{status:P.running})),jn(b))}})},onCancel:function(){console.log("Cancel")}})},ct=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4\u505C\u6B62",content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4\u505C\u6B62\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/stop"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=m()(gn),U=b.findIndex(function(cn){return cn.id===e.id});U!==-1&&(b.splice(U,1,g()(g()({},e),{},{pid:null,status:P.idle})),jn(b))}})},onCancel:function(){console.log("Cancel")}})},dt=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4".concat(e.isDisabled===1?"\u542F\u7528":"\u7981\u7528"),content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4",e.isDisabled===1?"\u542F\u7528":"\u7981\u7528","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/").concat(e.isDisabled===1?"enable":"disable"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=e.isDisabled===1?0:1,U=m()(gn),cn=U.findIndex(function(Hn){return Hn.id===e.id});cn!==-1&&(U.splice(cn,1,g()(g()({},e),{},{isDisabled:b})),jn(U))}})},onCancel:function(){console.log("Cancel")}})},ft=function(e,i){Z.Z.confirm({title:"\u786E\u8BA4".concat(e.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"),content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4",e.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876","\u5B9A\u65F6\u4EFB\u52A1"," ",(0,t.jsx)(C,{style:{wordBreak:"break-all"},type:"warning",children:e.name})," ","\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/").concat(e.isPinned===1?"unpin":"pin"),{data:[e.id]}).then(function(v){var h=v.code,H=v.data;if(h===200){var b=e.isPinned===1?0:1,U=m()(gn),cn=U.findIndex(function(Hn){return Hn.id===e.id});cn!==-1&&(U.splice(cn,1,g()(g()({},e),{},{isPinned:b})),jn(U))}})},onCancel:function(){console.log("Cancel")}})},vt=function(e){return[{label:"\u7F16\u8F91",key:"edit",icon:(0,t.jsx)(q.Z,{})},{label:e.isDisabled===1?"\u542F\u7528":"\u7981\u7528",key:"enableOrDisable",icon:e.isDisabled===1?(0,t.jsx)(Sn.Z,{}):(0,t.jsx)(Cn.Z,{})},{label:"\u5220\u9664",key:"delete",icon:(0,t.jsx)(J.Z,{})},{label:e.isPinned===1?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876",key:"pinOrUnPin",icon:e.isPinned===1?(0,t.jsx)(Cn.Z,{}):(0,t.jsx)(Y.Z,{})}]},mt=function(e){var i=e.record,o=e.index;return(0,t.jsx)(O.Z,{placement:"bottomRight",trigger:["click"],menu:{items:vt(i),onClick:function(h){var H=h.key,b=h.domEvent;b.stopPropagation(),gt(H,i,o)}},children:(0,t.jsx)("a",{onClick:function(h){return h.stopPropagation()},children:(0,t.jsx)(A.Z,{})})})},gt=function(e,i,o){switch(e){case"edit":st(i,o);break;case"enableOrDisable":dt(i,o);break;case"delete":rt(i,o);break;case"pinOrUnPin":ft(i,o);break;default:break}},Ct=function(){Kn(!1),Gn()},ht=function(e){Bn(e.trim())},Et=function(e){x.W.get("".concat(R.Z.apiPrefix,"crons/").concat(e.id)).then(function(i){var o=i.code,v=i.data;if(o===200){var h=gn.findIndex(function(b){return b.id===e.id}),H=m()(gn);v.nextRunTime=(0,B.n$)(v.schedule),h!==-1&&(H.splice(h,1,g()(g()({},e),v)),jn(H))}}).finally(function(){return hn(!1)})},xt=function(e){T(e)},jt={selectedRowKeys:En,onChange:xt},pt=function(){Z.Z.confirm({title:"\u786E\u8BA4\u5220\u9664",content:(0,t.jsx)(t.Fragment,{children:"\u786E\u8BA4\u5220\u9664\u9009\u4E2D\u7684\u5B9A\u65F6\u4EFB\u52A1\u5417"}),onOk:function(){x.W.delete("".concat(R.Z.apiPrefix,"crons"),{data:En}).then(function(i){var o=i.code,v=i.data;o===200&&(K.ZP.success("\u6279\u91CF\u5220\u9664\u6210\u529F"),T([]),Gn())})},onCancel:function(){console.log("Cancel")}})},Tn=function(e){Z.Z.confirm({title:"\u786E\u8BA4".concat(w[e]),content:(0,t.jsxs)(t.Fragment,{children:["\u786E\u8BA4",w[e],"\u9009\u4E2D\u7684\u5B9A\u65F6\u4EFB\u52A1\u5417"]}),onOk:function(){x.W.put("".concat(R.Z.apiPrefix,"crons/").concat(In[e]),{data:En}).then(function(o){var v=o.code,h=o.data;v===200&&Gn()})},onCancel:function(){console.log("Cancel")}})},Dt=function(e,i,o){var v=e.current,h=e.pageSize;sn({page:v,size:h,sorter:o,filters:i}),localStorage.setItem("pageSize",String(h))},St=function(e,i){return e.isPinned?"pinned-cron cron":"cron"};(0,d.useEffect)(function(){Fn&&(localStorage.setItem("logCron",Fn.id),wn(!0))},[Fn]),(0,d.useEffect)(function(){sn(g()(g()({},j),{},{page:1}))},[s]),(0,d.useEffect)(function(){j.page&&j.size&&Gn()},[j,G]),(0,d.useEffect)(function(){if(G&&Zn&&Zn.length>0){var l=Zn.slice(4).find(function(e){return e.id===G.id});it(!!l)}},[G,Zn]),(0,d.useEffect)(function(){je()},[]);var yt=function(e){switch(e){case"new":Be(!0);break;case"manage":Ze(!0);break;default:Re(e);break}},Pt={onClick:function(e){var i=e.key,o=e.domEvent;o.stopPropagation(),yt(i)},items:[].concat(m()(m()(Zn).slice(4).map(function(l){return{label:(0,t.jsxs)(L.Z,{style:{display:"flex",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:l.name}),(G==null?void 0:G.id)===l.id&&(0,t.jsx)(a.Z,{style:{color:"#1890ff"}})]}),key:l.id,icon:(0,t.jsx)(k.Z,{})}})),[{type:"divider"},{label:"\u65B0\u5EFA\u89C6\u56FE",key:"new",icon:(0,t.jsx)(fn.Z,{})},{label:"\u89C6\u56FE\u7BA1\u7406",key:"manage",icon:(0,t.jsx)(nn.Z,{})}])},je=function(){hn(!0),x.W.get("".concat(R.Z.apiPrefix,"crons/views")).then(function(e){var i=e.code,o=e.data;if(i===200){nt(o);var v=o.filter(function(h){return!h.isDisabled});tt(v),sn({page:1,size:parseInt(localStorage.getItem("pageSize")||"20"),sorter:{},filters:{}}),ie(g()({},v[0]))}}).finally(function(){hn(!1)})},Re=function(e){var i=Zn.find(function(o){return o.id==e});T([]),sn(g()(g()({},j),{},{page:1})),ie(i||null)},Mt=(0,Q.u)(function(){return{scroll:{y:xe}}},[xe]),Ot=u()(Mt,1),Bt=Ot[0];return(0,t.jsxs)(un.ZP,{className:"ql-container-wrapper crontab-wrapper ql-container-wrapper-has-tab",title:"\u5B9A\u65F6\u4EFB\u52A1",extra:[(0,t.jsx)($,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\u6216\u8005\u5173\u952E\u8BCD",style:{width:"auto"},enterButton:!0,allowClear:!0,loading:Wn,value:ze,onChange:function(e){return $e(e.target.value)},onSearch:ht}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return ot()},children:"\u65B0\u5EFA\u4EFB\u52A1"},"2")],header:{style:Qn},children:[(0,t.jsx)(yn.Z,{defaultActiveKey:"all",size:"small",tabPosition:"top",className:"crontab-view ".concat(Ie?"more-active":""),tabBarExtraContent:(0,t.jsx)(O.Z,{menu:Pt,trigger:["click"],overlayStyle:{minWidth:200},children:(0,t.jsxs)("div",{className:"view-more ".concat(Ie?"active":""),children:[(0,t.jsxs)(L.Z,{children:["\u66F4\u591A",(0,t.jsx)(N.Z,{})]}),(0,t.jsx)("div",{className:"ant-tabs-ink-bar ant-tabs-ink-bar-animated"})]})}),onTabClick:Re,items:m()(m()(Zn).slice(0,4).map(function(l){return{key:l.id,label:l.name}}))}),(0,t.jsxs)("div",{ref:Le,children:[En.length>0&&(0,t.jsxs)("div",{style:{marginBottom:16},children:[(0,t.jsx)(V.Z,{type:"primary",style:{marginBottom:5},onClick:pt,children:"\u6279\u91CF\u5220\u9664"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(0)},style:{marginLeft:8,marginBottom:5},children:"\u6279\u91CF\u542F\u7528"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(1)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u7981\u7528"}),(0,t.jsx)(V.Z,{type:"primary",style:{marginRight:8},onClick:function(){return Tn(2)},children:"\u6279\u91CF\u8FD0\u884C"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(3)},children:"\u6279\u91CF\u505C\u6B62"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(4)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u7F6E\u9876"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return Tn(5)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u53D6\u6D88\u7F6E\u9876"}),(0,t.jsx)(V.Z,{type:"primary",onClick:function(){return ne(!0)},style:{marginLeft:8,marginRight:8},children:"\u6279\u91CF\u4FEE\u6539\u6807\u7B7E"}),(0,t.jsxs)("span",{style:{marginLeft:8},children:["\u5DF2\u9009\u62E9",(0,t.jsx)("a",{children:En==null?void 0:En.length}),"\u9879"]})]}),(0,t.jsx)(Pn.Z,{columns:re,pagination:{current:j.page,pageSize:j.size,showSizeChanger:!0,simple:Rn,total:Me,showTotal:function(e,i){return"\u7B2C ".concat(i[0],"-").concat(i[1]," \u6761/\u603B\u5171 ").concat(e," \u6761")},pageSizeOptions:[10,20,50,100,200,500,Me||1e4].sort(function(l,e){return l-e})},dataSource:gn,rowKey:"id",size:"middle",scroll:{x:1e3,y:xe},loading:Wn,rowSelection:jt,rowClassName:St,onChange:Dt})]}),(0,t.jsx)(rn.default,{visible:ge,handleCancel:function(){Et(Fn),wn(!1)},cron:Fn}),(0,t.jsx)(W.default,{visible:On,handleCancel:Ct,cron:Nn}),(0,t.jsx)(W.CronLabelModal,{visible:de,handleCancel:function(e){ne(!1),e&&Gn()},ids:En}),(0,t.jsx)(_.default,{visible:Ue,handleCancel:function(){De(!1)},cron:Ve,theme:se,isPhone:Rn}),(0,t.jsx)(z.default,{visible:Je,handleCancel:function(e){Be(!1),je(),e&&e.id===G.id&&ie(g()(g()({},G),e))}}),(0,t.jsx)(vn.default,{cronViews:qe,visible:Xe,handleCancel:function(){Ze(!1)},cronViewChange:function(e){je(),e&&e.id===G.id&&ie(g()(g()({},G),e))}})]})},oe=Jn},60402:function(bn,tn,n){n.r(tn);var mn=n(54306),m=n.n(mn),F=n(63313),u=n.n(F),y=n(89065),g=n(9835),d=n(84163),I=n(24378),D=n(35911),M=n(90717),L=n(65601),X=n(38101),Z=n(55974),K=n(60001),O=n(11527),V;(function(Y){Y[Y.running=0]="running",Y[Y.idle=1]="idle",Y[Y.disabled=2]="disabled",Y[Y.queued=3]="queued"})(V||(V={}));var yn=y.Z.Countdown,Pn=function(dn){var an=dn.cron,Mn=dn.handleCancel,xn=dn.visible,r=dn.data,Dn=dn.logUrl,ln=(0,F.useState)("\u542F\u52A8\u4E2D..."),q=m()(ln,2),Sn=q[0],Cn=q[1],J=(0,F.useState)(!0),A=m()(J,2),a=A[0],k=A[1],fn=(0,F.useState)(!0),nn=m()(fn,2),N=nn[0],R=nn[1],un=(0,F.useState)(!1),x=m()(un,2),W=x[0],rn=x[1],_=(0,F.useRef)({value:0,down:!0}),p=function B(Q){Q&&k(!0),D.W.get(Dn||"".concat(M.Z.apiPrefix,"crons/").concat(an.id,"/log")).then(function(t){var C=t.code,en=t.data;if(C===200&&localStorage.getItem("logCron")===String(an.id)&&en!==Sn){var $=en;Cn($||"\u6682\u65E0\u65E5\u5FD7");var P=!!($&&!(0,K.x$)($)&&!$.includes("\u91CD\u542F\u9762\u677F")&&!$.includes("\u4EFB\u52A1\u672A\u8FD0\u884C"));R(P),S(),P&&setTimeout(function(){B()},2e3),$&&$.includes("\u91CD\u542F\u9762\u677F")&&an.status===V.running&&(g.ZP.warning({content:(0,O.jsxs)("span",{children:["\u7CFB\u7EDF\u5C06\u5728",(0,O.jsx)(yn,{className:"inline-countdown",format:"ss",value:Date.now()+1e3*30}),"\u79D2\u540E\u81EA\u52A8\u5237\u65B0"]}),duration:10}),setTimeout(function(){window.location.reload()},3e4))}}).finally(function(){Q&&k(!1)})},S=function(){_.current.down&&setTimeout(function(){document.querySelector("#log-flag").scrollIntoView({behavior:"smooth"})},1e3)},z=function(){localStorage.removeItem("logCron"),Mn()},vn=function(Q){var t=Q.target.scrollTop;_.current.down&&(_.current={value:t,down:t>_.current.value})},on=function(){return(0,O.jsxs)(O.Fragment,{children:[(N||a)&&(0,O.jsx)(L.Z,{spin:!0}),!N&&!a&&(0,O.jsx)(X.Z,{}),(0,O.jsx)("span",{style:{marginLeft:5},children:an&&an.name})]})};return(0,F.useEffect)(function(){an&&an.id&&xn&&p(!0)},[an,xn]),(0,F.useEffect)(function(){r&&Cn(r)},[r]),(0,F.useEffect)(function(){rn(document.body.clientWidth<768)},[]),(0,O.jsx)(d.Z,{title:on(),open:xn,centered:!0,className:"log-modal",bodyStyle:{minHeight:"300px"},forceRender:!0,onOk:function(){return z()},onCancel:function(){return z()},footer:[(0,O.jsx)(I.Z,{type:"primary",onClick:function(){return z()},children:"\u77E5\u9053\u4E86"})],children:(0,O.jsxs)("div",{onScroll:vn,className:"log-container",children:[a?(0,O.jsx)(Z.Z,{}):(0,O.jsx)("pre",{style:W?{fontFamily:"Source Code Pro",width:375,zoom:.83}:{},children:Sn}),(0,O.jsx)("div",{id:"log-flag"})]})})};tn.default=Pn},13515:function(bn,tn,n){n.r(tn),n.d(tn,{CronLabelModal:function(){return Sn},default:function(){return q}});var mn=n(25359),m=n.n(mn),F=n(57213),u=n.n(F),y=n(49811),g=n.n(y),d=n(54306),I=n.n(d),D=n(63313),M=n(67393),L=n(9835),X=n(84163),Z=n(22159),K=n(24378),O=n(35911),V=n(90717),yn=n(11186),Pn=n.n(yn),Y=n(93525),dn=n.n(Y),an=n(51704),Mn=n(8297),xn=n(26839),r=n(11527),Dn=function(J){var A=J.value,a=J.onChange,k=(0,D.useState)(""),fn=I()(k,2),nn=fn[0],N=fn[1],R=(0,D.useState)(!1),un=I()(R,2),x=un[0],W=un[1],rn=(0,D.useState)([]),_=I()(rn,2),p=_[0],S=_[1],z=(0,D.useRef)(),vn=function(en){var $=p.filter(function(P){return P!==en});S($),a==null||a($)},on=function(){W(!0)},B=function(en){N(en.target.value)},Q=function(){nn&&!p.includes(nn)&&(S([].concat(dn()(p),[nn])),a==null||a([].concat(dn()(p),[nn]))),W(!1),N("")},t=p.map(function(C){var en=(0,r.jsx)(an.Z,{closable:!0,onClose:function(P){P.preventDefault(),vn(C)},children:C});return(0,r.jsx)("span",{style:{display:"inline-block",marginBottom:8},children:en},C)});return(0,D.useEffect)(function(){x&&z&&z.current.focus()},[x]),(0,D.useEffect)(function(){A&&S(A)},[A]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Mn.Z,{enter:{scale:.8,opacity:0,type:"from",duration:100},leave:{opacity:0,width:0,scale:0,duration:200},appear:!1,children:t}),x&&(0,r.jsx)(Z.Z,{ref:z,type:"text",size:"small",style:{width:78},value:nn,onChange:B,onBlur:Q,onPressEnter:Q}),!x&&(0,r.jsxs)(an.Z,{onClick:on,style:{borderStyle:"dashed",cursor:"pointer"},children:[(0,r.jsx)(xn.Z,{})," \u65B0\u5EFA"]})]})},ln=Dn,q=function(J){var A=J.cron,a=J.handleCancel,k=J.visible,fn=M.Z.useForm(),nn=I()(fn,1),N=nn[0],R=(0,D.useState)(!1),un=I()(R,2),x=un[0],W=un[1],rn=function(){var _=g()(m()().mark(function p(S){var z,vn,on,B,Q;return m()().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return W(!0),z=A?"put":"post",vn=u()({},S),A&&(vn.id=A.id),C.prev=4,C.next=7,O.W[z]("".concat(V.Z.apiPrefix,"crons"),{data:vn});case 7:on=C.sent,B=on.code,Q=on.data,B===200&&(L.ZP.success(A?"\u66F4\u65B0Cron\u6210\u529F":"\u65B0\u5EFACron\u6210\u529F"),a(Q)),W(!1),C.next=17;break;case 14:C.prev=14,C.t0=C.catch(4),W(!1);case 17:case"end":return C.stop()}},p,null,[[4,14]])}));return function(S){return _.apply(this,arguments)}}();return(0,D.useEffect)(function(){N.resetFields()},[A,k]),(0,r.jsx)(X.Z,{title:A?"\u7F16\u8F91\u4EFB\u52A1":"\u65B0\u5EFA\u4EFB\u52A1",open:k,forceRender:!0,centered:!0,maskClosable:!1,onOk:function(){N.validateFields().then(function(p){rn(p)}).catch(function(p){console.log("Validate Failed:",p)})},onCancel:function(){return a()},confirmLoading:x,children:(0,r.jsxs)(M.Z,{form:N,layout:"vertical",name:"form_in_modal",initialValues:A,children:[(0,r.jsx)(M.Z.Item,{name:"name",label:"\u540D\u79F0",children:(0,r.jsx)(Z.Z,{placeholder:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"})}),(0,r.jsx)(M.Z.Item,{name:"command",label:"\u547D\u4EE4/\u811A\u672C",rules:[{required:!0,whitespace:!0}],children:(0,r.jsx)(Z.Z.TextArea,{rows:4,autoSize:!0,placeholder:"\u652F\u6301\u8F93\u5165\u811A\u672C\u8DEF\u5F84/\u4EFB\u610F\u7CFB\u7EDF\u53EF\u6267\u884C\u547D\u4EE4/task \u811A\u672C\u8DEF\u5F84"})}),(0,r.jsx)(M.Z.Item,{name:"schedule",label:"\u5B9A\u65F6\u89C4\u5219",rules:[{required:!0},{validator:function(p,S){return!S||Pn().parseExpression(S).hasNext()?Promise.resolve():Promise.reject("Cron\u8868\u8FBE\u5F0F\u683C\u5F0F\u6709\u8BEF")}}],children:(0,r.jsx)(Z.Z,{placeholder:"\u79D2(\u53EF\u9009) \u5206 \u65F6 \u5929 \u6708 \u5468"})}),(0,r.jsx)(M.Z.Item,{name:"labels",label:"\u6807\u7B7E",children:(0,r.jsx)(ln,{})})]})})},Sn=function(J){var A=J.ids,a=J.handleCancel,k=J.visible,fn=M.Z.useForm(),nn=I()(fn,1),N=nn[0],R=(0,D.useState)(!1),un=I()(R,2),x=un[0],W=un[1],rn=function(){var p=g()(m()().mark(function S(z){return m()().wrap(function(on){for(;;)switch(on.prev=on.next){case 0:N.validateFields().then(function(){var B=g()(m()().mark(function Q(t){var C,en,$,P;return m()().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return W(!0),C={ids:A,labels:t.labels},w.prev=2,w.next=5,O.W[z]("".concat(V.Z.apiPrefix,"crons/labels"),{data:C});case 5:en=w.sent,$=en.code,P=en.data,$===200&&(L.ZP.success(z==="post"?"\u6DFB\u52A0Labels\u6210\u529F":"\u5220\u9664Labels\u6210\u529F"),a(!0)),W(!1),w.next=15;break;case 12:w.prev=12,w.t0=w.catch(2),W(!1);case 15:case"end":return w.stop()}},Q,null,[[2,12]])}));return function(Q){return B.apply(this,arguments)}}()).catch(function(B){console.log("Validate Failed:",B)});case 1:case"end":return on.stop()}},S)}));return function(z){return p.apply(this,arguments)}}();(0,D.useEffect)(function(){N.resetFields()},[A,k]);var _=[(0,r.jsx)(K.Z,{onClick:function(){return a(!1)},children:"\u53D6\u6D88"}),(0,r.jsx)(K.Z,{type:"primary",danger:!0,onClick:function(){return rn("delete")},children:"\u5220\u9664"}),(0,r.jsx)(K.Z,{type:"primary",onClick:function(){return rn("post")},children:"\u6DFB\u52A0"})];return(0,r.jsx)(X.Z,{title:"\u6279\u91CF\u4FEE\u6539\u6807\u7B7E",open:k,footer:_,centered:!0,maskClosable:!1,forceRender:!0,onCancel:function(){return a(!1)},confirmLoading:x,children:(0,r.jsx)(M.Z,{form:N,layout:"vertical",name:"form_in_label_modal",children:(0,r.jsx)(M.Z.Item,{name:"labels",label:"\u6807\u7B7E",children:(0,r.jsx)(ln,{})})})})}},93164:function(bn,tn,n){n.d(tn,{E:function(){return mn}});function mn(m){var F=m*1e3,u=Math.floor(F/(24*3600*1e3)),y=F%(24*3600*1e3),g=Math.floor(y/(3600*1e3)),d=y%(3600*1e3),I=Math.floor(d/(60*1e3)),D=d%(60*1e3),M=Math.round(D/1e3),L=M+"\u79D2";return I>0&&(L=I+"\u5206"+L),g>0&&(L=g+"\u5C0F\u65F6"+L),u>0&&(L=u+"\u5929"+L),L}}}]);