@iobroker/adapter-react-v5 7.1.1 → 7.1.4
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/ComplexCron.js +16 -2
- package/Dialogs/ComplexCron.d.ts +3 -1
- package/Dialogs/ComplexCron.js +28 -1
- package/README.md +11 -2
- package/i18n/de.json +438 -434
- package/i18n/en.json +438 -434
- package/i18n/es.json +438 -434
- package/i18n/fr.json +438 -434
- package/i18n/it.json +438 -434
- package/i18n/nl.json +438 -434
- package/i18n/pl.json +438 -434
- package/i18n/pt.json +438 -434
- package/i18n/ru.json +438 -434
- package/i18n/uk.json +438 -434
- package/i18n/zh-cn.json +438 -434
- package/package.json +3 -3
- package/src/Components/ComplexCron.tsx +18 -1
- package/src/Dialogs/ComplexCron.tsx +41 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/adapter-react-v5",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.4",
|
|
4
4
|
"description": "React classes to develop admin interfaces for ioBroker with react.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Denis Haev (bluefox)",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@emotion/react": "^11.13.3",
|
|
31
31
|
"@emotion/styled": "^11.13.0",
|
|
32
|
-
"@iobroker/socket-client": "^
|
|
32
|
+
"@iobroker/socket-client": "^3.0.1",
|
|
33
33
|
"@iobroker/types": "^6.0.11",
|
|
34
34
|
"@iobroker/js-controller-common": "^6.0.11",
|
|
35
35
|
"@iobroker/js-controller-common-db": "^6.0.11",
|
|
36
36
|
"@mui/icons-material": "^6.1.0",
|
|
37
37
|
"@mui/material": "^6.1.0",
|
|
38
|
-
"@mui/x-date-pickers": "^7.
|
|
38
|
+
"@mui/x-date-pickers": "^7.17.0",
|
|
39
39
|
"@sentry/browser": "^8.30.0",
|
|
40
40
|
"cronstrue": "^2.50.0",
|
|
41
41
|
"react-color": "^2.19.3",
|
|
@@ -36,6 +36,11 @@ const styles: Record<string, React.CSSProperties> = {
|
|
|
36
36
|
appBar: {
|
|
37
37
|
color: 'white',
|
|
38
38
|
},
|
|
39
|
+
warning: {
|
|
40
|
+
marginLeft: 16,
|
|
41
|
+
color: 'red',
|
|
42
|
+
fontSize: 12,
|
|
43
|
+
},
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
|
@@ -467,6 +472,11 @@ class ComplexCron extends Component<ComplexCronProps, ComplexCronState> {
|
|
|
467
472
|
|
|
468
473
|
render(): React.JSX.Element {
|
|
469
474
|
const tab = this.state.seconds !== false ? this.state.tab : this.state.tab + 1;
|
|
475
|
+
|
|
476
|
+
// Detect if every minute or every second is activated
|
|
477
|
+
const everyMinute = this.state.minutes === '*' || this.state.minutes === '*/1';
|
|
478
|
+
const everySecond = this.state.seconds === '*' || this.state.seconds === '*/1';
|
|
479
|
+
|
|
470
480
|
return (
|
|
471
481
|
<div style={styles.mainDiv}>
|
|
472
482
|
<div style={{ paddingLeft: 8, width: '100%' }}>
|
|
@@ -479,6 +489,13 @@ class ComplexCron extends Component<ComplexCronProps, ComplexCronState> {
|
|
|
479
489
|
</div>
|
|
480
490
|
<div style={{ paddingLeft: 8, width: '100%', height: 60 }}>
|
|
481
491
|
{ComplexCron.convertCronToText(this.state.cron, this.props.language || 'en')}
|
|
492
|
+
<span style={styles.warning}>
|
|
493
|
+
{everySecond
|
|
494
|
+
? I18n.t('ra_warning_every_second')
|
|
495
|
+
: everyMinute
|
|
496
|
+
? I18n.t('ra_warning_every_minute')
|
|
497
|
+
: ''}
|
|
498
|
+
</span>
|
|
482
499
|
</div>
|
|
483
500
|
<FormControlLabel
|
|
484
501
|
control={
|
|
@@ -500,7 +517,7 @@ class ComplexCron extends Component<ComplexCronProps, ComplexCronState> {
|
|
|
500
517
|
value={this.state.tab}
|
|
501
518
|
style={styles.appBar}
|
|
502
519
|
color="secondary"
|
|
503
|
-
onChange={(
|
|
520
|
+
onChange={(_active, _tab) => this.setState({ tab: _tab })}
|
|
504
521
|
>
|
|
505
522
|
{this.state.seconds !== false && (
|
|
506
523
|
<Tab
|
|
@@ -5,6 +5,7 @@ import { Button, DialogTitle, DialogContent, DialogActions, Dialog } from '@mui/
|
|
|
5
5
|
import { Check as IconOk, Cancel as IconCancel, Delete as IconClear } from '@mui/icons-material';
|
|
6
6
|
|
|
7
7
|
import ComplexCron from '../Components/ComplexCron';
|
|
8
|
+
import ConfirmDialog from '../Dialogs/Confirm';
|
|
8
9
|
|
|
9
10
|
import I18n from '../i18n';
|
|
10
11
|
|
|
@@ -35,6 +36,7 @@ interface DialogCronProps {
|
|
|
35
36
|
|
|
36
37
|
interface DialogCronState {
|
|
37
38
|
cron: string;
|
|
39
|
+
showWarning: '' | 'everySecond' | 'everyMinute';
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState> {
|
|
@@ -51,6 +53,7 @@ class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
this.state = {
|
|
56
|
+
showWarning: '',
|
|
54
57
|
cron,
|
|
55
58
|
};
|
|
56
59
|
}
|
|
@@ -59,11 +62,47 @@ class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState
|
|
|
59
62
|
this.props.onClose();
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
handleOk(): void {
|
|
65
|
+
handleOk(ignoreCheck?: boolean): void {
|
|
66
|
+
if (!ignoreCheck) {
|
|
67
|
+
// Check if the CRON will be executed every second or every minute and warn about it
|
|
68
|
+
const cron = ComplexCron.cron2state(this.state.cron);
|
|
69
|
+
if (cron.seconds === '*' || cron.seconds === '*/1') {
|
|
70
|
+
this.setState({ showWarning: 'everySecond' });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (cron.minutes === '*' || cron.minutes === '*/1') {
|
|
74
|
+
this.setState({ showWarning: 'everyMinute' });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
63
79
|
this.props.onOk(this.state.cron);
|
|
64
80
|
this.props.onClose();
|
|
65
81
|
}
|
|
66
82
|
|
|
83
|
+
renderWarningDialog(): JSX.Element | null {
|
|
84
|
+
if (!this.state.showWarning) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return (
|
|
88
|
+
<ConfirmDialog
|
|
89
|
+
title={I18n.t('ra_Please confirm')}
|
|
90
|
+
text={I18n.t(
|
|
91
|
+
this.state.showWarning === 'everySecond'
|
|
92
|
+
? 'ra_The schedule will be executed every second. Are you sure?'
|
|
93
|
+
: 'ra_The schedule will be executed every minute. Are you sure?',
|
|
94
|
+
)}
|
|
95
|
+
onClose={(ok: boolean) =>
|
|
96
|
+
this.setState({ showWarning: '' }, () => {
|
|
97
|
+
if (ok) {
|
|
98
|
+
this.handleOk(true);
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
67
106
|
handleClear(): void {
|
|
68
107
|
this.props.onOk(false);
|
|
69
108
|
this.props.onClose();
|
|
@@ -79,6 +118,7 @@ class DialogComplexCron extends React.Component<DialogCronProps, DialogCronState
|
|
|
79
118
|
open={!0}
|
|
80
119
|
aria-labelledby="cron-dialog-title"
|
|
81
120
|
>
|
|
121
|
+
{this.renderWarningDialog()}
|
|
82
122
|
<DialogTitle id="cron-dialog-title">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>
|
|
83
123
|
<DialogContent style={{ height: '100%', overflow: 'hidden' }}>
|
|
84
124
|
<ComplexCron
|