@iobroker/adapter-react-v5 4.6.5 → 4.6.7
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/Components/IconSelector.js +3 -4
- package/Components/IconSelector.js.map +1 -1
- package/Components/MDUtils.js +4 -4
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.js +2 -2
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Schedule.js +27 -27
- package/Components/Schedule.js.map +1 -1
- package/Components/SimpleCron/cron2text.js +51 -51
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/index.js +190 -187
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/SimpleCron/jquery.cron.locale.js +10 -10
- package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
- package/GenericApp.d.ts +4 -4
- package/GenericApp.js +17 -17
- package/GenericApp.js.map +1 -1
- package/LegacyConnection.js +31 -33
- package/LegacyConnection.js.map +1 -1
- package/README.md +6 -0
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconNoIcon.js.map +1 -1
- package/package.json +8 -8
|
@@ -137,12 +137,12 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
137
137
|
control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
138
138
|
checked: settings.weekdays.indexOf(day) !== -1,
|
|
139
139
|
onChange: function onChange(e) {
|
|
140
|
-
var
|
|
141
|
-
var pos =
|
|
142
|
-
e.target.checked && pos === -1 &&
|
|
143
|
-
!e.target.checked && pos !== -1 &&
|
|
144
|
-
|
|
145
|
-
_this2.setState((0, _defineProperty2["default"])({}, type,
|
|
140
|
+
var _settings = JSON.parse(JSON.stringify(_this2.state[type]));
|
|
141
|
+
var pos = _settings.weekdays.indexOf(day);
|
|
142
|
+
e.target.checked && pos === -1 && _settings.weekdays.push(day);
|
|
143
|
+
!e.target.checked && pos !== -1 && _settings.weekdays.splice(pos, 1);
|
|
144
|
+
_settings.weekdays.sort();
|
|
145
|
+
_this2.setState((0, _defineProperty2["default"])({}, type, _settings), function () {
|
|
146
146
|
return _this2.recalcCron();
|
|
147
147
|
});
|
|
148
148
|
},
|
|
@@ -179,12 +179,12 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
179
179
|
label: _i18n["default"].t('sc_minutes'),
|
|
180
180
|
value: settings.minutes,
|
|
181
181
|
onChange: function onChange(e) {
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
|
|
182
|
+
var _settings = JSON.parse(JSON.stringify(_this3.state[type]));
|
|
183
|
+
_settings.minutes = parseInt(e.target.value, 10);
|
|
184
|
+
if (_settings.minutes < 1) {
|
|
185
|
+
_settings.minutes = 1;
|
|
186
186
|
}
|
|
187
|
-
_this3.setState((0, _defineProperty2["default"])({}, type,
|
|
187
|
+
_this3.setState((0, _defineProperty2["default"])({}, type, _settings), function () {
|
|
188
188
|
return _this3.recalcCron();
|
|
189
189
|
});
|
|
190
190
|
},
|
|
@@ -223,64 +223,63 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
223
223
|
},
|
|
224
224
|
margin: "normal"
|
|
225
225
|
}));
|
|
226
|
-
} else {
|
|
227
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
228
|
-
key: "period",
|
|
229
|
-
style: {
|
|
230
|
-
paddingLeft: 8,
|
|
231
|
-
display: 'inline-block'
|
|
232
|
-
}
|
|
233
|
-
}, /*#__PURE__*/_react["default"].createElement("h5", {
|
|
234
|
-
style: {
|
|
235
|
-
marginBottom: 5
|
|
236
|
-
}
|
|
237
|
-
}, _i18n["default"].t('sc_period')), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
238
|
-
variant: "standard",
|
|
239
|
-
style: {
|
|
240
|
-
marginTop: 0,
|
|
241
|
-
marginBottom: 0,
|
|
242
|
-
verticalAlign: 'bottom'
|
|
243
|
-
},
|
|
244
|
-
key: "value",
|
|
245
|
-
label: _i18n["default"].t('sc_every'),
|
|
246
|
-
value: settings.period,
|
|
247
|
-
onChange: function onChange(e) {
|
|
248
|
-
var settings = JSON.parse(JSON.stringify(_this3.state[type]));
|
|
249
|
-
settings.period = parseInt(e.target.value, 10);
|
|
250
|
-
if (settings.period < 1) {
|
|
251
|
-
settings.period = 1;
|
|
252
|
-
}
|
|
253
|
-
_this3.setState((0, _defineProperty2["default"])({}, type, settings), function () {
|
|
254
|
-
return _this3.recalcCron();
|
|
255
|
-
});
|
|
256
|
-
},
|
|
257
|
-
min: 1,
|
|
258
|
-
max: 60,
|
|
259
|
-
type: "number",
|
|
260
|
-
InputLabelProps: {
|
|
261
|
-
shrink: true
|
|
262
|
-
},
|
|
263
|
-
margin: "normal"
|
|
264
|
-
}), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
265
|
-
variant: "standard",
|
|
266
|
-
style: {
|
|
267
|
-
verticalAlign: 'bottom'
|
|
268
|
-
},
|
|
269
|
-
value: settings.unit,
|
|
270
|
-
onChange: function onChange(e) {
|
|
271
|
-
var settings = JSON.parse(JSON.stringify(_this3.state[type]));
|
|
272
|
-
settings.unit = e.target.value;
|
|
273
|
-
_this3.setState((0, _defineProperty2["default"])({}, type, settings), function () {
|
|
274
|
-
return _this3.recalcCron();
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}, Object.keys(PERIODIC_TYPES).map(function (mode) {
|
|
278
|
-
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
279
|
-
key: PERIODIC_TYPES[mode],
|
|
280
|
-
value: PERIODIC_TYPES[mode]
|
|
281
|
-
}, _i18n["default"].t("sc_".concat(PERIODIC_TYPES[mode])));
|
|
282
|
-
})));
|
|
283
226
|
}
|
|
227
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
228
|
+
key: "period",
|
|
229
|
+
style: {
|
|
230
|
+
paddingLeft: 8,
|
|
231
|
+
display: 'inline-block'
|
|
232
|
+
}
|
|
233
|
+
}, /*#__PURE__*/_react["default"].createElement("h5", {
|
|
234
|
+
style: {
|
|
235
|
+
marginBottom: 5
|
|
236
|
+
}
|
|
237
|
+
}, _i18n["default"].t('sc_period')), /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
|
|
238
|
+
variant: "standard",
|
|
239
|
+
style: {
|
|
240
|
+
marginTop: 0,
|
|
241
|
+
marginBottom: 0,
|
|
242
|
+
verticalAlign: 'bottom'
|
|
243
|
+
},
|
|
244
|
+
key: "value",
|
|
245
|
+
label: _i18n["default"].t('sc_every'),
|
|
246
|
+
value: settings.period,
|
|
247
|
+
onChange: function onChange(e) {
|
|
248
|
+
var settings = JSON.parse(JSON.stringify(_this3.state[type]));
|
|
249
|
+
settings.period = parseInt(e.target.value, 10);
|
|
250
|
+
if (settings.period < 1) {
|
|
251
|
+
settings.period = 1;
|
|
252
|
+
}
|
|
253
|
+
_this3.setState((0, _defineProperty2["default"])({}, type, settings), function () {
|
|
254
|
+
return _this3.recalcCron();
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
min: 1,
|
|
258
|
+
max: 60,
|
|
259
|
+
type: "number",
|
|
260
|
+
InputLabelProps: {
|
|
261
|
+
shrink: true
|
|
262
|
+
},
|
|
263
|
+
margin: "normal"
|
|
264
|
+
}), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
265
|
+
variant: "standard",
|
|
266
|
+
style: {
|
|
267
|
+
verticalAlign: 'bottom'
|
|
268
|
+
},
|
|
269
|
+
value: settings.unit,
|
|
270
|
+
onChange: function onChange(e) {
|
|
271
|
+
var _settings = JSON.parse(JSON.stringify(_this3.state[type]));
|
|
272
|
+
_settings.unit = e.target.value;
|
|
273
|
+
_this3.setState((0, _defineProperty2["default"])({}, type, _settings), function () {
|
|
274
|
+
return _this3.recalcCron();
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}, Object.keys(PERIODIC_TYPES).map(function (mode) {
|
|
278
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
279
|
+
key: PERIODIC_TYPES[mode],
|
|
280
|
+
value: PERIODIC_TYPES[mode]
|
|
281
|
+
}, _i18n["default"].t("sc_".concat(PERIODIC_TYPES[mode])));
|
|
282
|
+
})));
|
|
284
283
|
}
|
|
285
284
|
}, {
|
|
286
285
|
key: "getControlsTime",
|
|
@@ -300,9 +299,9 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
300
299
|
value: settings.time,
|
|
301
300
|
type: "time",
|
|
302
301
|
onChange: function onChange(e) {
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
_this4.setState((0, _defineProperty2["default"])({}, type,
|
|
302
|
+
var _settings = JSON.parse(JSON.stringify(_this4.state[type]));
|
|
303
|
+
_settings.time = e.target.value;
|
|
304
|
+
_this4.setState((0, _defineProperty2["default"])({}, type, _settings), function () {
|
|
306
305
|
return _this4.recalcCron();
|
|
307
306
|
});
|
|
308
307
|
},
|
|
@@ -322,7 +321,7 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
322
321
|
settings.date = "".concat(d.getDate(), ".").concat(padding(d.getMonth() + 1));
|
|
323
322
|
}
|
|
324
323
|
|
|
325
|
-
|
|
324
|
+
// <InputLabel htmlFor="formatted-text-mask-input">{I18n.t('sc_at')}</InputLabel>
|
|
326
325
|
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
327
326
|
variant: "standard",
|
|
328
327
|
className: this.props.classes.formControl
|
|
@@ -336,9 +335,9 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
336
335
|
className: this.props.classes.formControlPaddingTop
|
|
337
336
|
},
|
|
338
337
|
onChange: function onChange(e) {
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
_this5.setState((0, _defineProperty2["default"])({}, type,
|
|
338
|
+
var _settings = JSON.parse(JSON.stringify(_this5.state[type]));
|
|
339
|
+
_settings.date = e.target.value;
|
|
340
|
+
_this5.setState((0, _defineProperty2["default"])({}, type, _settings), function () {
|
|
342
341
|
return _this5.recalcCron();
|
|
343
342
|
});
|
|
344
343
|
},
|
|
@@ -391,10 +390,10 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
391
390
|
},
|
|
392
391
|
value: settings.timeFrom,
|
|
393
392
|
onChange: function onChange(e) {
|
|
394
|
-
var
|
|
395
|
-
|
|
393
|
+
var _settings = JSON.parse(JSON.stringify(_this6.state.intervalBetween));
|
|
394
|
+
_settings.timeFrom = parseInt(e.target.value, 10);
|
|
396
395
|
_this6.setState({
|
|
397
|
-
intervalBetween:
|
|
396
|
+
intervalBetween: _settings
|
|
398
397
|
}, function () {
|
|
399
398
|
return _this6.recalcCron();
|
|
400
399
|
});
|
|
@@ -417,10 +416,10 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
417
416
|
},
|
|
418
417
|
value: settings.timeTo,
|
|
419
418
|
onChange: function onChange(e) {
|
|
420
|
-
var
|
|
421
|
-
|
|
419
|
+
var _settings = JSON.parse(JSON.stringify(_this6.state.intervalBetween));
|
|
420
|
+
_settings.timeTo = parseInt(e.target.value, 10);
|
|
422
421
|
_this6.setState({
|
|
423
|
-
intervalBetween:
|
|
422
|
+
intervalBetween: _settings
|
|
424
423
|
}, function () {
|
|
425
424
|
return _this6.recalcCron();
|
|
426
425
|
});
|
|
@@ -517,33 +516,32 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
517
516
|
max = max || 7;
|
|
518
517
|
if (list.length === max) {
|
|
519
518
|
return '*';
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
519
|
+
}
|
|
520
|
+
var text = [];
|
|
521
|
+
var start = null;
|
|
522
|
+
var end = null;
|
|
523
|
+
for (var i = 0; i < list.length; i++) {
|
|
524
|
+
if (start === null) {
|
|
525
|
+
start = list[i];
|
|
526
|
+
end = list[i];
|
|
527
|
+
} else if (list[i - 1] + 1 === list[i]) {
|
|
528
|
+
end = list[i];
|
|
529
|
+
} else {
|
|
530
|
+
if (start !== end) {
|
|
531
|
+
text.push("".concat(start, "-").concat(end));
|
|
530
532
|
} else {
|
|
531
|
-
|
|
532
|
-
text.push("".concat(start, "-").concat(end));
|
|
533
|
-
} else {
|
|
534
|
-
text.push(start);
|
|
535
|
-
}
|
|
536
|
-
start = list[i];
|
|
537
|
-
end = list[i];
|
|
533
|
+
text.push(start);
|
|
538
534
|
}
|
|
535
|
+
start = list[i];
|
|
536
|
+
end = list[i];
|
|
539
537
|
}
|
|
540
|
-
if (start !== end) {
|
|
541
|
-
text.push("".concat(start, "-").concat(end));
|
|
542
|
-
} else {
|
|
543
|
-
text.push(start);
|
|
544
|
-
}
|
|
545
|
-
return text.join(',');
|
|
546
538
|
}
|
|
539
|
+
if (start !== end) {
|
|
540
|
+
text.push("".concat(start, "-").concat(end));
|
|
541
|
+
} else {
|
|
542
|
+
text.push(start);
|
|
543
|
+
}
|
|
544
|
+
return text.join(',');
|
|
547
545
|
}
|
|
548
546
|
}, {
|
|
549
547
|
key: "text2weekdays",
|
|
@@ -615,68 +613,61 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
615
613
|
period: 1,
|
|
616
614
|
unit: PERIODIC_TYPES.seconds
|
|
617
615
|
};
|
|
618
|
-
} else
|
|
616
|
+
} else if (options.seconds === null && options.minutes.includes('/') && options.hours === '*' && options.date === '*' && options.months === '*') {
|
|
619
617
|
// */n * * * *
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
time: "".concat(padding(parseInt(options.hours, 10)), ":").concat(padding(parseInt(options.minutes, 10))),
|
|
670
|
-
date: "".concat(padding(parseInt(options.date, 10)), ".").concat(padding(parseInt(options.months, 10))),
|
|
671
|
-
// ignored
|
|
672
|
-
weekdays: SimpleCron.text2weekdays(options.dow)
|
|
673
|
-
};
|
|
674
|
-
}
|
|
618
|
+
state.mode = PERIODIC.interval;
|
|
619
|
+
state.interval = {
|
|
620
|
+
period: parseInt(options.minutes.split('/')[1], 10),
|
|
621
|
+
unit: PERIODIC_TYPES.minutes
|
|
622
|
+
};
|
|
623
|
+
} else if (options.seconds !== null && options.seconds.includes('/') && options.minutes === '*' && options.hours === '*' && options.date === '*' && options.months === '*') {
|
|
624
|
+
// */n * * * * *
|
|
625
|
+
state.mode = PERIODIC.interval;
|
|
626
|
+
state.interval = {
|
|
627
|
+
period: parseInt(options.seconds.split('/')[1], 10),
|
|
628
|
+
unit: PERIODIC_TYPES.seconds
|
|
629
|
+
};
|
|
630
|
+
} else if (options.seconds !== null && options.seconds.includes('/') && options.minutes === '*' && options.hours.includes('-') && options.date === '*' && options.months === '*') {
|
|
631
|
+
// */n * 1-24 * * 1-7 or */n * 1-24 * * *
|
|
632
|
+
state.mode = PERIODIC.intervalBetween;
|
|
633
|
+
state.intervalBetween = {
|
|
634
|
+
period: parseInt(options.seconds.split('/')[1], 10),
|
|
635
|
+
unit: PERIODIC_TYPES.seconds,
|
|
636
|
+
timeFrom: parseInt(options.hours.split('-')[0], 10),
|
|
637
|
+
timeTo: parseInt(options.hours.split('-')[1], 10),
|
|
638
|
+
weekdays: SimpleCron.text2weekdays(options.dow)
|
|
639
|
+
};
|
|
640
|
+
} else if (options.seconds === null && options.minutes.includes('/') && options.hours.includes('-') && options.date === '*' && options.months === '*') {
|
|
641
|
+
// */n 1-24 * * 1-7 or */n 1-24 * * *
|
|
642
|
+
state.mode = PERIODIC.intervalBetween;
|
|
643
|
+
state.intervalBetween = {
|
|
644
|
+
period: parseInt(options.minutes.split('/')[1], 10),
|
|
645
|
+
unit: PERIODIC_TYPES.minutes,
|
|
646
|
+
timeFrom: parseInt(options.hours.split('-')[0], 10),
|
|
647
|
+
timeTo: parseInt(options.hours.split('-')[1], 10),
|
|
648
|
+
weekdays: SimpleCron.text2weekdays(options.dow)
|
|
649
|
+
};
|
|
650
|
+
} else if (options.seconds === null && parseInt(options.minutes, 10).toString() === options.minutes && parseInt(options.hours, 10).toString() === options.hours && options.date === '*' && options.months === '*') {
|
|
651
|
+
// m h * * 1-7 or m h * * *
|
|
652
|
+
state.mode = PERIODIC.specific;
|
|
653
|
+
state.specific = {
|
|
654
|
+
time: "".concat(padding(parseInt(options.hours, 10)), ":").concat(padding(parseInt(options.minutes, 10))),
|
|
655
|
+
weekdays: SimpleCron.text2weekdays(options.dow)
|
|
656
|
+
};
|
|
657
|
+
} else if (options.seconds === null && parseInt(options.minutes, 10).toString() === options.minutes && parseInt(options.hours, 10).toString() === options.hours && parseInt(options.date, 10).toString() === options.date && parseInt(options.months, 10).toString() === options.months && options.dow === '*') {
|
|
658
|
+
// m h d M *
|
|
659
|
+
state.mode = PERIODIC.once;
|
|
660
|
+
state.once = {
|
|
661
|
+
time: "".concat(padding(parseInt(options.hours, 10)), ":").concat(padding(parseInt(options.minutes, 10))),
|
|
662
|
+
date: "".concat(padding(parseInt(options.date, 10)), ".").concat(padding(parseInt(options.months, 10))),
|
|
663
|
+
// ignored
|
|
664
|
+
weekdays: SimpleCron.text2weekdays(options.dow)
|
|
665
|
+
};
|
|
666
|
+
}
|
|
675
667
|
if (state.mode) {
|
|
676
668
|
return state;
|
|
677
|
-
} else {
|
|
678
|
-
return null;
|
|
679
669
|
}
|
|
670
|
+
return null;
|
|
680
671
|
}
|
|
681
672
|
}, {
|
|
682
673
|
key: "state2cron",
|
|
@@ -684,12 +675,24 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
684
675
|
var cron = '* * * * *';
|
|
685
676
|
if (state.mode === PERIODIC.interval) {
|
|
686
677
|
var settings = state.interval || {};
|
|
687
|
-
if (settings.period > 60)
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (settings.
|
|
691
|
-
|
|
692
|
-
|
|
678
|
+
if (settings.period > 60) {
|
|
679
|
+
settings.period = 60;
|
|
680
|
+
}
|
|
681
|
+
if (settings.period < 1) {
|
|
682
|
+
settings.period = 1;
|
|
683
|
+
}
|
|
684
|
+
if (settings.minutes > 60) {
|
|
685
|
+
settings.minutes = 60;
|
|
686
|
+
}
|
|
687
|
+
if (settings.minutes < 1) {
|
|
688
|
+
settings.minutes = 1;
|
|
689
|
+
}
|
|
690
|
+
if (settings.hours > 24) {
|
|
691
|
+
settings.hours = 24;
|
|
692
|
+
}
|
|
693
|
+
if (settings.hours < 1) {
|
|
694
|
+
settings.hours = 1;
|
|
695
|
+
}
|
|
693
696
|
if (state.extended) {
|
|
694
697
|
cron = "".concat(settings.minutes > 1 ? "*/".concat(settings.minutes) : '*', " ").concat(settings.hours > 1 ? "*/".concat(settings.hours) : '*', " * * *");
|
|
695
698
|
} else {
|
|
@@ -705,45 +708,45 @@ var SimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
705
708
|
}
|
|
706
709
|
}
|
|
707
710
|
} else if (state.mode === PERIODIC.intervalBetween) {
|
|
708
|
-
var
|
|
711
|
+
var _settings2 = state.intervalBetween || {};
|
|
709
712
|
var hours;
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
if (
|
|
713
|
+
_settings2.timeFrom = _settings2.timeFrom || 0;
|
|
714
|
+
_settings2.timeTo = _settings2.timeTo === undefined ? 24 : _settings2.timeTo;
|
|
715
|
+
if (_settings2.timeFrom === 0 && _settings2.timeTo === 24) {
|
|
713
716
|
hours = '*';
|
|
714
717
|
} else {
|
|
715
|
-
hours =
|
|
718
|
+
hours = _settings2.timeFrom !== _settings2.timeTo ? "".concat(_settings2.timeFrom, "-").concat(_settings2.timeTo) : '*';
|
|
716
719
|
}
|
|
717
|
-
if (
|
|
718
|
-
if (
|
|
719
|
-
|
|
720
|
-
switch (
|
|
720
|
+
if (_settings2.period > 60) _settings2.period = 60;
|
|
721
|
+
if (_settings2.period < 1) _settings2.period = 1;
|
|
722
|
+
_settings2.unit = _settings2.unit || PERIODIC_TYPES.minutes;
|
|
723
|
+
switch (_settings2.unit) {
|
|
721
724
|
case PERIODIC_TYPES.seconds:
|
|
722
|
-
cron = "".concat(
|
|
725
|
+
cron = "".concat(_settings2.period > 1 ? "*/".concat(_settings2.period) : '*', " * ").concat(hours, " * * ").concat(this.periodArray2text(_settings2.weekdays));
|
|
723
726
|
break;
|
|
724
727
|
case PERIODIC_TYPES.minutes:
|
|
725
|
-
cron = "".concat(
|
|
728
|
+
cron = "".concat(_settings2.period > 1 ? "*/".concat(_settings2.period) : '*', " ").concat(hours, " * * ").concat(this.periodArray2text(_settings2.weekdays));
|
|
726
729
|
break;
|
|
727
730
|
default:
|
|
728
731
|
break;
|
|
729
732
|
}
|
|
730
733
|
} else if (state.mode === PERIODIC.specific) {
|
|
731
|
-
var
|
|
732
|
-
var parts = (
|
|
734
|
+
var _settings3 = state.specific || {};
|
|
735
|
+
var parts = (_settings3.time || '00:00').split(':');
|
|
733
736
|
var minutes = parseInt(parts[1], 10) || 0;
|
|
734
737
|
if (minutes > 59) minutes = 59;
|
|
735
738
|
if (minutes < 0) minutes = 0;
|
|
736
739
|
var _hours = parseInt(parts[0], 10) || 0;
|
|
737
740
|
if (_hours > 23) _hours = 59;
|
|
738
741
|
if (_hours < 0) _hours = 0;
|
|
739
|
-
cron = "".concat(minutes, " ").concat(_hours, " * * ").concat(this.periodArray2text(
|
|
742
|
+
cron = "".concat(minutes, " ").concat(_hours, " * * ").concat(this.periodArray2text(_settings3.weekdays || []));
|
|
740
743
|
} else if (state.mode === PERIODIC.once) {
|
|
741
|
-
var
|
|
742
|
-
if (!
|
|
743
|
-
|
|
744
|
+
var _settings4 = state.once || {};
|
|
745
|
+
if (!_settings4.date) {
|
|
746
|
+
_settings4.date = "".concat(new Date().getDate(), ".").concat(padding(new Date().getMonth() + 1));
|
|
744
747
|
}
|
|
745
|
-
var _parts2 = (
|
|
746
|
-
var partsDate =
|
|
748
|
+
var _parts2 = (_settings4.time || '00:00').split(':');
|
|
749
|
+
var partsDate = _settings4.date.split('.');
|
|
747
750
|
var _minutes = parseInt(_parts2[1], 10) || 0;
|
|
748
751
|
if (_minutes > 59) _minutes = 59;
|
|
749
752
|
if (_minutes < 0) _minutes = 0;
|