@iobroker/adapter-react-v5 7.1.1 → 7.1.3
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/AdminConnection.js +0 -2
- package/Components/ComplexCron.js +16 -2
- package/Dialogs/ComplexCron.d.ts +3 -1
- package/Dialogs/ComplexCron.js +28 -1
- package/README.md +1437 -1432
- package/assets/lamp_ceiling.svg +8 -8
- package/assets/lamp_table.svg +7 -7
- package/assets/no_icon.svg +9 -9
- package/i18n/de.json +439 -435
- package/i18n/en.json +439 -435
- package/i18n/es.json +439 -435
- package/i18n/fr.json +439 -435
- package/i18n/it.json +439 -435
- package/i18n/nl.json +439 -435
- package/i18n/pl.json +439 -435
- package/i18n/pt.json +439 -435
- package/i18n/ru.json +439 -435
- package/i18n/uk.json +439 -435
- package/i18n/zh-cn.json +439 -435
- package/index.js +1 -3
- package/package.json +3 -3
- package/src/Components/ComplexCron.tsx +561 -544
- package/src/Components/TabContainer.tsx +57 -57
- package/src/Dialogs/ComplexCron.tsx +163 -123
- package/tasks.js +91 -91
package/AdminConnection.js
CHANGED
|
@@ -61,6 +61,11 @@ const styles = {
|
|
|
61
61
|
appBar: {
|
|
62
62
|
color: 'white',
|
|
63
63
|
},
|
|
64
|
+
warning: {
|
|
65
|
+
marginLeft: 16,
|
|
66
|
+
color: 'red',
|
|
67
|
+
fontSize: 12,
|
|
68
|
+
},
|
|
64
69
|
};
|
|
65
70
|
const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
|
66
71
|
const MONTHS = [
|
|
@@ -391,13 +396,22 @@ class ComplexCron extends react_1.Component {
|
|
|
391
396
|
}
|
|
392
397
|
render() {
|
|
393
398
|
const tab = this.state.seconds !== false ? this.state.tab : this.state.tab + 1;
|
|
399
|
+
// Detect if every minute or every second is activated
|
|
400
|
+
const everyMinute = this.state.minutes === '*' || this.state.minutes === '*/1';
|
|
401
|
+
const everySecond = this.state.seconds === '*' || this.state.seconds === '*/1';
|
|
394
402
|
return (react_1.default.createElement("div", { style: styles.mainDiv },
|
|
395
403
|
react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%' } },
|
|
396
404
|
react_1.default.createElement(material_1.TextField, { variant: "standard", style: { width: '100%' }, value: this.state.cron, disabled: true })),
|
|
397
|
-
react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%', height: 60 } },
|
|
405
|
+
react_1.default.createElement("div", { style: { paddingLeft: 8, width: '100%', height: 60 } },
|
|
406
|
+
ComplexCron.convertCronToText(this.state.cron, this.props.language || 'en'),
|
|
407
|
+
react_1.default.createElement("span", { style: styles.warning }, everySecond
|
|
408
|
+
? i18n_1.default.t('ra_warning_every_second')
|
|
409
|
+
: everyMinute
|
|
410
|
+
? i18n_1.default.t('ra_warning_every_minute')
|
|
411
|
+
: '')),
|
|
398
412
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: !!this.state.seconds, onChange: e => this.setState({ seconds: e.target.checked ? '*' : false }, () => this.recalcCron()) }), label: i18n_1.default.t('ra_use seconds') }),
|
|
399
413
|
react_1.default.createElement(material_1.AppBar, { position: "static", sx: { '&.MuiAppBar-root': styles.appBar }, color: "secondary" },
|
|
400
|
-
react_1.default.createElement(material_1.Tabs, { value: this.state.tab, style: styles.appBar, color: "secondary", onChange: (
|
|
414
|
+
react_1.default.createElement(material_1.Tabs, { value: this.state.tab, style: styles.appBar, color: "secondary", onChange: (_active, _tab) => this.setState({ tab: _tab }) },
|
|
401
415
|
this.state.seconds !== false && (react_1.default.createElement(material_1.Tab, { id: "sc_seconds", label: i18n_1.default.t('sc_seconds') })),
|
|
402
416
|
react_1.default.createElement(material_1.Tab, { id: "minutes", label: i18n_1.default.t('sc_minutes') }),
|
|
403
417
|
react_1.default.createElement(material_1.Tab, { id: "hours", label: i18n_1.default.t('sc_hours') }),
|
package/Dialogs/ComplexCron.d.ts
CHANGED
|
@@ -11,11 +11,13 @@ interface DialogCronProps {
|
|
|
11
11
|
}
|
|
12
12
|
interface DialogCronState {
|
|
13
13
|
cron: string;
|
|
14
|
+
showWarning: '' | 'everySecond' | 'everyMinute';
|
|
14
15
|
}
|
|
15
16
|
declare class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState> {
|
|
16
17
|
constructor(props: DialogCronProps);
|
|
17
18
|
handleCancel(): void;
|
|
18
|
-
handleOk(): void;
|
|
19
|
+
handleOk(ignoreCheck?: boolean): void;
|
|
20
|
+
renderWarningDialog(): JSX.Element | null;
|
|
19
21
|
handleClear(): void;
|
|
20
22
|
render(): JSX.Element;
|
|
21
23
|
}
|
package/Dialogs/ComplexCron.js
CHANGED
|
@@ -7,6 +7,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const material_1 = require("@mui/material");
|
|
8
8
|
const icons_material_1 = require("@mui/icons-material");
|
|
9
9
|
const ComplexCron_1 = __importDefault(require("../Components/ComplexCron"));
|
|
10
|
+
const Confirm_1 = __importDefault(require("../Dialogs/Confirm"));
|
|
10
11
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
11
12
|
// Generate cron expression
|
|
12
13
|
const styles = {
|
|
@@ -35,22 +36,48 @@ class DialogComplexCron extends react_1.default.Component {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
this.state = {
|
|
39
|
+
showWarning: '',
|
|
38
40
|
cron,
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
handleCancel() {
|
|
42
44
|
this.props.onClose();
|
|
43
45
|
}
|
|
44
|
-
handleOk() {
|
|
46
|
+
handleOk(ignoreCheck) {
|
|
47
|
+
if (!ignoreCheck) {
|
|
48
|
+
// Check if the CRON will be executed every second or every minute and warn about it
|
|
49
|
+
const cron = ComplexCron_1.default.cron2state(this.state.cron);
|
|
50
|
+
if (cron.seconds === '*' || cron.seconds === '*/1') {
|
|
51
|
+
this.setState({ showWarning: 'everySecond' });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (cron.minutes === '*' || cron.minutes === '*/1') {
|
|
55
|
+
this.setState({ showWarning: 'everyMinute' });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
45
59
|
this.props.onOk(this.state.cron);
|
|
46
60
|
this.props.onClose();
|
|
47
61
|
}
|
|
62
|
+
renderWarningDialog() {
|
|
63
|
+
if (!this.state.showWarning) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return (react_1.default.createElement(Confirm_1.default, { title: i18n_1.default.t('ra_Please confirm'), text: i18n_1.default.t(this.state.showWarning === 'everySecond'
|
|
67
|
+
? 'ra_The schedule will be executed every second. Are you sure?'
|
|
68
|
+
: 'ra_The schedule will be executed every minute. Are you sure?'), onClose: (ok) => this.setState({ showWarning: '' }, () => {
|
|
69
|
+
if (ok) {
|
|
70
|
+
this.handleOk(true);
|
|
71
|
+
}
|
|
72
|
+
}) }));
|
|
73
|
+
}
|
|
48
74
|
handleClear() {
|
|
49
75
|
this.props.onOk(false);
|
|
50
76
|
this.props.onClose();
|
|
51
77
|
}
|
|
52
78
|
render() {
|
|
53
79
|
return (react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
80
|
+
this.renderWarningDialog(),
|
|
54
81
|
react_1.default.createElement(material_1.DialogTitle, { id: "cron-dialog-title" }, this.props.title || i18n_1.default.t('ra_Define schedule...')),
|
|
55
82
|
react_1.default.createElement(material_1.DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
56
83
|
react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|