@iobroker/adapter-react-v5 3.1.33 → 3.1.35
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/404.js +0 -23
- package/Components/404.js.map +1 -1
- package/Components/ColorPicker.js +6 -37
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ComplexCron.js +10 -84
- package/Components/ComplexCron.js.map +1 -1
- package/Components/CustomModal.js +29 -54
- package/Components/CustomModal.js.map +1 -1
- package/Components/FileBrowser.js +15 -265
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +7 -68
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.d.ts +1 -1
- package/Components/Icon.js +2 -42
- package/Components/Icon.js.map +1 -1
- package/Components/IconPicker.js +6 -28
- package/Components/IconPicker.js.map +1 -1
- package/Components/IconSelector.js +3 -55
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +1 -38
- package/Components/Image.js.map +1 -1
- package/Components/JsonConfigComponent/ChipInput.js +66 -197
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -31
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +6 -39
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +6 -52
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +5 -39
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +4 -42
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -28
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigChip.js +4 -33
- package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.js +0 -34
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -33
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +14 -73
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +0 -46
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +7 -126
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -34
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.js +15 -110
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +2 -35
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +4 -44
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +1 -59
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +7 -40
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +2 -42
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +2 -45
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +6 -40
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +7 -91
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -42
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -25
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -34
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +4 -34
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +11 -67
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +8 -91
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -55
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -28
- package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -21
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -24
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -23
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -31
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +13 -105
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +2 -35
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +0 -34
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -37
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -25
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -29
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +2 -40
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/JsonConfigComponent/index.js +5 -81
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/Loader.js +2 -20
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +2 -20
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +2 -21
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/Logo.js +6 -39
- package/Components/Logo.js.map +1 -1
- package/Components/MDUtils.js +3 -27
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +1 -1
- package/Components/ObjectBrowser.js +206 -794
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js +7 -31
- package/Components/Router.js.map +1 -1
- package/Components/SaveCloseButtons.js +2 -32
- package/Components/SaveCloseButtons.js.map +1 -1
- package/Components/Schedule.js +29 -251
- package/Components/Schedule.js.map +1 -1
- package/Components/SelectWithIcon.d.ts +1 -1
- package/Components/SelectWithIcon.js +0 -48
- package/Components/SelectWithIcon.js.map +1 -1
- package/Components/SimpleCron/cron2text.js +45 -91
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/cronText.js +0 -6
- package/Components/SimpleCron/cronText.js.map +1 -1
- package/Components/SimpleCron/index.js +19 -102
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/SimpleCron/jquery.cron.locale.js +44 -24
- package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
- package/Components/TabContainer.js +2 -23
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.js +2 -22
- package/Components/TabContent.js.map +1 -1
- package/Components/TabHeader.js +1 -17
- package/Components/TabHeader.js.map +1 -1
- package/Components/TableResize.js +6 -51
- package/Components/TableResize.js.map +1 -1
- package/Components/TextWithIcon.js +0 -20
- package/Components/TextWithIcon.js.map +1 -1
- package/Components/ToggleThemeMenu.js +5 -13
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/TreeTable.js +4 -121
- package/Components/TreeTable.js.map +1 -1
- package/Components/UploadImage.js +17 -60
- package/Components/UploadImage.js.map +1 -1
- package/Components/Utils.js +87 -263
- package/Components/Utils.js.map +1 -1
- package/Components/copy-to-clipboard.js +16 -38
- package/Components/copy-to-clipboard.js.map +1 -1
- package/Components/withWidth.js +2 -10
- package/Components/withWidth.js.map +1 -1
- package/Connection.d.ts +1 -0
- package/Connection.js +156 -527
- package/Connection.js.map +1 -1
- package/Dialogs/ComplexCron.js +0 -34
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.js +1 -39
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/Cron.js +1 -37
- package/Dialogs/Cron.js.map +1 -1
- package/Dialogs/Error.d.ts +1 -1
- package/Dialogs/Error.js +2 -29
- package/Dialogs/Error.js.map +1 -1
- package/Dialogs/FileSelect.js +2 -36
- package/Dialogs/FileSelect.js.map +1 -1
- package/Dialogs/Message.js +2 -27
- package/Dialogs/Message.js.map +1 -1
- package/Dialogs/SelectID.d.ts +1 -1
- package/Dialogs/SelectID.js +3 -40
- package/Dialogs/SelectID.js.map +1 -1
- package/Dialogs/SimpleCron.js +1 -33
- package/Dialogs/SimpleCron.js.map +1 -1
- package/Dialogs/TextInput.js +2 -34
- package/Dialogs/TextInput.js.map +1 -1
- package/GenericApp.js +54 -150
- package/GenericApp.js.map +1 -1
- package/Prompt.js +0 -2
- package/Prompt.js.map +1 -1
- package/README.md +11 -4
- package/Theme.js +7 -22
- package/Theme.js.map +1 -1
- package/i18n.d.ts +2 -0
- package/i18n.js +14 -25
- package/i18n.js.map +1 -1
- package/icons/IconAdapter.d.ts +2 -2
- package/icons/IconAdapter.js +2 -6
- package/icons/IconAdapter.js.map +1 -1
- package/icons/IconAlias.d.ts +2 -2
- package/icons/IconAlias.js +2 -6
- package/icons/IconAlias.js.map +1 -1
- package/icons/IconChannel.d.ts +2 -2
- package/icons/IconChannel.js +2 -6
- package/icons/IconChannel.js.map +1 -1
- package/icons/IconClearFilter.d.ts +2 -2
- package/icons/IconClearFilter.js +0 -5
- package/icons/IconClearFilter.js.map +1 -1
- package/icons/IconClosed.d.ts +2 -2
- package/icons/IconClosed.js +0 -5
- package/icons/IconClosed.js.map +1 -1
- package/icons/IconCopy.d.ts +2 -2
- package/icons/IconCopy.js +0 -5
- package/icons/IconCopy.js.map +1 -1
- package/icons/IconDevice.d.ts +2 -2
- package/icons/IconDevice.js +0 -5
- package/icons/IconDevice.js.map +1 -1
- package/icons/IconDocument.d.ts +2 -2
- package/icons/IconDocument.js +0 -5
- package/icons/IconDocument.js.map +1 -1
- package/icons/IconDocumentReadOnly.d.ts +2 -2
- package/icons/IconDocumentReadOnly.js +0 -5
- package/icons/IconDocumentReadOnly.js.map +1 -1
- package/icons/IconExpert.d.ts +2 -2
- package/icons/IconExpert.js +0 -5
- package/icons/IconExpert.js.map +1 -1
- package/icons/IconFx.d.ts +2 -2
- package/icons/IconFx.js +0 -5
- package/icons/IconFx.js.map +1 -1
- package/icons/IconInstance.d.ts +2 -2
- package/icons/IconInstance.js +0 -5
- package/icons/IconInstance.js.map +1 -1
- package/icons/IconLogout.d.ts +2 -2
- package/icons/IconLogout.js +0 -5
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconNoIcon.d.ts +2 -2
- package/icons/IconNoIcon.js +0 -5
- package/icons/IconNoIcon.js.map +1 -1
- package/icons/IconOpen.d.ts +2 -2
- package/icons/IconOpen.js +0 -5
- package/icons/IconOpen.js.map +1 -1
- package/icons/IconState.d.ts +2 -2
- package/icons/IconState.js +0 -6
- package/icons/IconState.js.map +1 -1
- package/package.json +15 -15
package/GenericApp.js
CHANGED
|
@@ -1,81 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
-
|
|
20
13
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
21
|
-
|
|
22
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
15
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
-
|
|
26
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
-
|
|
28
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
-
|
|
30
18
|
var _react = _interopRequireDefault(require("react"));
|
|
31
|
-
|
|
32
19
|
var _Connection = _interopRequireWildcard(require("./Connection"));
|
|
33
|
-
|
|
34
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
21
|
var Sentry = _interopRequireWildcard(require("@sentry/browser"));
|
|
37
|
-
|
|
38
22
|
var SentryIntegrations = _interopRequireWildcard(require("@sentry/integrations"));
|
|
39
|
-
|
|
40
23
|
var _Error = _interopRequireDefault(require("./Dialogs/Error"));
|
|
41
|
-
|
|
42
24
|
var _Snackbar = _interopRequireDefault(require("@mui/material/Snackbar"));
|
|
43
|
-
|
|
44
25
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
45
|
-
|
|
46
26
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
47
|
-
|
|
48
27
|
var _Prompt = _interopRequireDefault(require("./Prompt"));
|
|
49
|
-
|
|
50
28
|
var _Theme = _interopRequireDefault(require("./Theme"));
|
|
51
|
-
|
|
52
29
|
var _Loader = _interopRequireDefault(require("./Components/Loader"));
|
|
53
|
-
|
|
54
30
|
var _Router2 = _interopRequireDefault(require("./Components/Router"));
|
|
55
|
-
|
|
56
31
|
var _Utils = _interopRequireDefault(require("./Components/Utils"));
|
|
57
|
-
|
|
58
32
|
var _SaveCloseButtons = _interopRequireDefault(require("./Components/SaveCloseButtons"));
|
|
59
|
-
|
|
60
33
|
var _Confirm = _interopRequireDefault(require("./Dialogs/Confirm"));
|
|
61
|
-
|
|
62
34
|
var _i18n = _interopRequireDefault(require("./i18n"));
|
|
63
|
-
|
|
64
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
65
|
-
|
|
66
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
67
|
-
|
|
68
37
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
69
|
-
|
|
70
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
71
|
-
|
|
72
39
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
73
|
-
|
|
74
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
75
|
-
|
|
76
41
|
// import './index.css';
|
|
77
42
|
var cssStyle = "\nhtml {\n height: 100%;\n}\n\nbody {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n/* scrollbar */\n::-webkit-scrollbar-track {\n background-color: #ccc;\n border-radius: 5px;\n}\n\n::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n background-color: #ccc;\n}\n\n::-webkit-scrollbar-thumb {\n background-color: #575757;\n border-radius: 5px;\n}\n\n#root {\n height: 100%;\n}\n\n.App {\n height: 100%;\n}\n\n@keyframes glow {\n from {\n background-color: initial;\n }\n to {\n background-color: #58c458;\n }\n}\n";
|
|
78
|
-
|
|
79
43
|
if (!window.localStorage) {
|
|
80
44
|
window.localStorage = {
|
|
81
45
|
getItem: function getItem() {
|
|
@@ -86,57 +50,48 @@ if (!window.localStorage) {
|
|
|
86
50
|
}
|
|
87
51
|
};
|
|
88
52
|
}
|
|
53
|
+
|
|
89
54
|
/**
|
|
90
55
|
* @extends {Router<import('./types').GenericAppProps, import('./types').GenericAppState>}
|
|
91
56
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
57
|
var GenericApp = /*#__PURE__*/function (_Router) {
|
|
95
58
|
(0, _inherits2["default"])(GenericApp, _Router);
|
|
96
|
-
|
|
97
59
|
var _super = _createSuper(GenericApp);
|
|
98
|
-
|
|
99
60
|
/**
|
|
100
61
|
* @param {import('./types').GenericAppProps} props
|
|
101
62
|
* @param {import('./types').GenericAppSettings | undefined} settings
|
|
102
63
|
*/
|
|
103
64
|
function GenericApp(props, settings) {
|
|
104
65
|
var _this;
|
|
105
|
-
|
|
106
66
|
(0, _classCallCheck2["default"])(this, GenericApp);
|
|
107
67
|
var ConnectionClass = props.Connection || settings.Connection || _Connection["default"];
|
|
108
|
-
|
|
109
68
|
if (!window.document.getElementById('generic-app-iobroker-component')) {
|
|
110
69
|
var style = window.document.createElement('style');
|
|
111
70
|
style.setAttribute('id', 'generic-app-iobroker-component');
|
|
112
71
|
style.innerHTML = cssStyle;
|
|
113
72
|
window.document.head.appendChild(style);
|
|
114
|
-
}
|
|
115
|
-
|
|
73
|
+
}
|
|
116
74
|
|
|
75
|
+
// Remove `!Connection.isWeb() && window.adapterName !== 'material'` when iobroker.socket will support native ws
|
|
117
76
|
if (!ConnectionClass.isWeb() && window.io && window.location.port === '3000') {
|
|
118
77
|
try {
|
|
119
78
|
var io = new window.SocketClient();
|
|
120
79
|
delete window.io;
|
|
121
80
|
window.io = io;
|
|
122
|
-
} catch (e) {
|
|
81
|
+
} catch (e) {
|
|
82
|
+
// ignore
|
|
123
83
|
}
|
|
124
84
|
}
|
|
125
|
-
|
|
126
85
|
_this = _super.call(this, props);
|
|
127
86
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSystemConfigChanged", function (id, obj) {
|
|
128
87
|
if (obj && id === 'system.config') {
|
|
129
88
|
var _obj$common;
|
|
130
|
-
|
|
131
89
|
if (_this.socket.systemLang !== (obj === null || obj === void 0 ? void 0 : obj.common.language)) {
|
|
132
90
|
_this.socket.systemLang = (obj === null || obj === void 0 ? void 0 : obj.common.language) || 'en';
|
|
133
|
-
|
|
134
91
|
_i18n["default"].setLanguage(_this.socket.systemLang);
|
|
135
92
|
}
|
|
136
|
-
|
|
137
93
|
if (_this._systemConfig.expertMode !== !!(obj !== null && obj !== void 0 && (_obj$common = obj.common) !== null && _obj$common !== void 0 && _obj$common.expertMode)) {
|
|
138
94
|
_this._systemConfig = (obj === null || obj === void 0 ? void 0 : obj.common) || {};
|
|
139
|
-
|
|
140
95
|
_this.setState({
|
|
141
96
|
expertMode: _this.getExpertMode()
|
|
142
97
|
});
|
|
@@ -149,11 +104,8 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
149
104
|
if (message !== null && message !== void 0 && message.data) {
|
|
150
105
|
if (message.data === 'updateTheme') {
|
|
151
106
|
var newThemeName = _Utils["default"].getThemeName();
|
|
152
|
-
|
|
153
107
|
_Utils["default"].setThemeName(_Utils["default"].getThemeName());
|
|
154
|
-
|
|
155
108
|
var _theme = _this.createTheme(newThemeName);
|
|
156
|
-
|
|
157
109
|
_this.setState({
|
|
158
110
|
theme: _theme,
|
|
159
111
|
themeName: _this.getThemeName(_theme),
|
|
@@ -173,7 +125,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
173
125
|
_this.resizeTimer && clearTimeout(_this.resizeTimer);
|
|
174
126
|
_this.resizeTimer = setTimeout(function () {
|
|
175
127
|
_this.resizeTimer = null;
|
|
176
|
-
|
|
177
128
|
_this.setState({
|
|
178
129
|
width: GenericApp.getWidth()
|
|
179
130
|
});
|
|
@@ -187,27 +138,24 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
187
138
|
}).forEach(function (b) {
|
|
188
139
|
var parts = b.split('=');
|
|
189
140
|
args[parts[0]] = parts.length === 2 ? parts[1] : true;
|
|
190
|
-
|
|
191
141
|
if (args[parts[0]] === 'true') {
|
|
192
142
|
args[parts[0]] = true;
|
|
193
143
|
} else if (args[parts[0]] === 'false') {
|
|
194
144
|
args[parts[0]] = false;
|
|
195
145
|
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
_this.instance = args.instance !== undefined ? parseInt(args.instance, 10) || 0 : parseInt(window.location.search.slice(1), 10) || 0; // extract adapter name from URL
|
|
146
|
+
});
|
|
199
147
|
|
|
148
|
+
// extract instance from URL
|
|
149
|
+
_this.instance = args.instance !== undefined ? parseInt(args.instance, 10) || 0 : parseInt(window.location.search.slice(1), 10) || 0;
|
|
150
|
+
// extract adapter name from URL
|
|
200
151
|
var tmp = window.location.pathname.split('/');
|
|
201
152
|
_this.adapterName = (settings === null || settings === void 0 ? void 0 : settings.adapterName) || props.adapterName || window.adapterName || tmp[tmp.length - 2] || 'iot';
|
|
202
153
|
_this.instanceId = "system.adapter.".concat(_this.adapterName, ".").concat(_this.instance);
|
|
203
154
|
_this.newReact = args.newReact === true; // it is admin5
|
|
204
155
|
|
|
205
156
|
var location = _Router2["default"].getLocation();
|
|
206
|
-
|
|
207
157
|
location.tab = location.tab || (window._localStorage || window.localStorage).getItem("".concat(_this.adapterName, "-adapter")) || '';
|
|
208
|
-
|
|
209
158
|
var themeInstance = _this.createTheme();
|
|
210
|
-
|
|
211
159
|
_this.state = {
|
|
212
160
|
selectedTab: (window._localStorage || window.localStorage).getItem("".concat(_this.adapterName, "-adapter")) || '',
|
|
213
161
|
selectedTabNum: -1,
|
|
@@ -225,8 +173,9 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
225
173
|
bottomButtons: (settings && settings.bottomButtons) === false ? false : (props && props.bottomButtons) === false ? false : true,
|
|
226
174
|
width: GenericApp.getWidth(),
|
|
227
175
|
confirmClose: false
|
|
228
|
-
};
|
|
176
|
+
};
|
|
229
177
|
|
|
178
|
+
// init translations
|
|
230
179
|
var translations = {
|
|
231
180
|
'en': require('./i18n/en.json'),
|
|
232
181
|
'de': require('./i18n/de.json'),
|
|
@@ -238,8 +187,9 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
238
187
|
'es': require('./i18n/es.json'),
|
|
239
188
|
'pl': require('./i18n/pl.json'),
|
|
240
189
|
'zh-cn': require('./i18n/zh-cn.json')
|
|
241
|
-
};
|
|
190
|
+
};
|
|
242
191
|
|
|
192
|
+
// merge together
|
|
243
193
|
if (settings && settings.translations) {
|
|
244
194
|
Object.keys(settings.translations).forEach(function (lang) {
|
|
245
195
|
return translations[lang] = Object.assign(translations[lang], settings.translations[lang]);
|
|
@@ -249,9 +199,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
249
199
|
return translations[lang] = Object.assign(translations[lang], props.translations[lang]);
|
|
250
200
|
});
|
|
251
201
|
}
|
|
252
|
-
|
|
253
202
|
_i18n["default"].setTranslations(translations);
|
|
254
|
-
|
|
255
203
|
_this.savedNative = {}; // to detect if the config changed
|
|
256
204
|
|
|
257
205
|
_this.encryptedFields = props.encryptedFields || (settings === null || settings === void 0 ? void 0 : settings.encryptedFields) || [];
|
|
@@ -275,9 +223,9 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
275
223
|
}
|
|
276
224
|
},
|
|
277
225
|
onReady: function onReady(objects, scripts) {
|
|
278
|
-
_i18n["default"].setLanguage(_this.socket.systemLang);
|
|
279
|
-
|
|
226
|
+
_i18n["default"].setLanguage(_this.socket.systemLang);
|
|
280
227
|
|
|
228
|
+
// subscribe because of language and expert mode
|
|
281
229
|
_this.socket.subscribeObject('system.config', _this.onSystemConfigChanged).then(function () {
|
|
282
230
|
return _this.getSystemConfig();
|
|
283
231
|
}).then(function (obj) {
|
|
@@ -286,8 +234,9 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
286
234
|
return _this.socket.getObject(_this.instanceId);
|
|
287
235
|
}).then(function (instanceObj) {
|
|
288
236
|
var waitPromise;
|
|
289
|
-
var sentryEnabled = _this._systemConfig.diag !== 'none' && instanceObj && instanceObj.common && instanceObj.common.name && instanceObj.common.version && !instanceObj.common.disableDataReporting && window.location.host !== 'localhost:3000';
|
|
237
|
+
var sentryEnabled = _this._systemConfig.diag !== 'none' && instanceObj && instanceObj.common && instanceObj.common.name && instanceObj.common.version && !instanceObj.common.disableDataReporting && window.location.host !== 'localhost:3000';
|
|
290
238
|
|
|
239
|
+
// activate sentry plugin
|
|
291
240
|
if (!_this.sentryStarted && _this.sentryDSN && sentryEnabled) {
|
|
292
241
|
_this.sentryStarted = true;
|
|
293
242
|
Sentry.init({
|
|
@@ -295,10 +244,10 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
295
244
|
release: "iobroker.".concat(instanceObj.common.name, "@").concat(instanceObj.common.version),
|
|
296
245
|
integrations: [new SentryIntegrations.Dedupe()]
|
|
297
246
|
});
|
|
298
|
-
}
|
|
299
|
-
// for backward compatibility it will be processed separately from above logic: some adapters could still have this.sentryDSN as undefined
|
|
300
|
-
|
|
247
|
+
}
|
|
301
248
|
|
|
249
|
+
// read UUID and init sentry with it.
|
|
250
|
+
// for backward compatibility it will be processed separately from above logic: some adapters could still have this.sentryDSN as undefined
|
|
302
251
|
if (!_this.sentryInited && sentryEnabled) {
|
|
303
252
|
_this.sentryInited = true;
|
|
304
253
|
waitPromise = _this.socket.getObject('system.meta.uuid').then(function (uuidObj) {
|
|
@@ -311,17 +260,12 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
311
260
|
}
|
|
312
261
|
});
|
|
313
262
|
}
|
|
314
|
-
|
|
315
263
|
waitPromise = waitPromise || Promise.resolve();
|
|
316
264
|
waitPromise.then(function () {
|
|
317
265
|
if (instanceObj) {
|
|
318
266
|
_this.common = instanceObj === null || instanceObj === void 0 ? void 0 : instanceObj.common;
|
|
319
|
-
|
|
320
267
|
_this.onPrepareLoad(instanceObj["native"], instanceObj.encryptedNative); // decode all secrets
|
|
321
|
-
|
|
322
|
-
|
|
323
268
|
_this.savedNative = JSON.parse(JSON.stringify(instanceObj["native"]));
|
|
324
|
-
|
|
325
269
|
_this.setState({
|
|
326
270
|
"native": instanceObj["native"],
|
|
327
271
|
loaded: true,
|
|
@@ -331,7 +275,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
331
275
|
});
|
|
332
276
|
} else {
|
|
333
277
|
console.warn('Cannot load instance settings');
|
|
334
|
-
|
|
335
278
|
_this.setState({
|
|
336
279
|
"native": {},
|
|
337
280
|
loaded: true,
|
|
@@ -345,13 +288,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
345
288
|
},
|
|
346
289
|
onError: function onError(err) {
|
|
347
290
|
console.error(err);
|
|
348
|
-
|
|
349
291
|
_this.showError(err);
|
|
350
292
|
}
|
|
351
293
|
}));
|
|
352
294
|
return _this;
|
|
353
295
|
}
|
|
354
|
-
|
|
355
296
|
(0, _createClass2["default"])(GenericApp, [{
|
|
356
297
|
key: "componentDidMount",
|
|
357
298
|
value:
|
|
@@ -363,10 +304,10 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
363
304
|
window.addEventListener('message', this.onReceiveMessage, false);
|
|
364
305
|
(0, _get2["default"])((0, _getPrototypeOf2["default"])(GenericApp.prototype), "componentDidMount", this).call(this);
|
|
365
306
|
}
|
|
307
|
+
|
|
366
308
|
/**
|
|
367
309
|
* Called immediately before a component is destroyed.
|
|
368
310
|
*/
|
|
369
|
-
|
|
370
311
|
}, {
|
|
371
312
|
key: "componentWillUnmount",
|
|
372
313
|
value: function componentWillUnmount() {
|
|
@@ -386,43 +327,41 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
386
327
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
387
328
|
return (0, _Theme["default"])(_Utils["default"].getThemeName(name));
|
|
388
329
|
}
|
|
330
|
+
|
|
389
331
|
/**
|
|
390
332
|
* Get the theme name
|
|
391
333
|
* @param {import('./types').Theme} theme Theme
|
|
392
334
|
* @returns {string} Theme name
|
|
393
335
|
*/
|
|
394
|
-
|
|
395
336
|
}, {
|
|
396
337
|
key: "getThemeName",
|
|
397
338
|
value: function getThemeName(theme) {
|
|
398
339
|
return theme.name;
|
|
399
340
|
}
|
|
341
|
+
|
|
400
342
|
/**
|
|
401
343
|
* Get the theme type
|
|
402
344
|
* @param {import('./types').Theme} theme Theme
|
|
403
345
|
* @returns {string} Theme type
|
|
404
346
|
*/
|
|
405
|
-
|
|
406
347
|
}, {
|
|
407
348
|
key: "getThemeType",
|
|
408
349
|
value: function getThemeType(theme) {
|
|
409
350
|
return theme.palette.mode;
|
|
410
351
|
}
|
|
352
|
+
|
|
411
353
|
/**
|
|
412
354
|
* Changes the current theme
|
|
413
355
|
*/
|
|
414
|
-
|
|
415
356
|
}, {
|
|
416
357
|
key: "toggleTheme",
|
|
417
358
|
value: function toggleTheme() {
|
|
418
359
|
var _this2 = this;
|
|
360
|
+
var themeName = this.state.themeName;
|
|
419
361
|
|
|
420
|
-
|
|
421
|
-
|
|
362
|
+
// dark => blue => colored => light => dark
|
|
422
363
|
var newThemeName = themeName === 'dark' ? 'blue' : themeName === 'blue' ? 'colored' : themeName === 'colored' ? 'light' : 'dark';
|
|
423
|
-
|
|
424
364
|
_Utils["default"].setThemeName(newThemeName);
|
|
425
|
-
|
|
426
365
|
var theme = this.createTheme(newThemeName);
|
|
427
366
|
this.setState({
|
|
428
367
|
theme: theme,
|
|
@@ -433,88 +372,83 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
433
372
|
_this2.onThemeChanged && _this2.onThemeChanged(newThemeName);
|
|
434
373
|
});
|
|
435
374
|
}
|
|
375
|
+
|
|
436
376
|
/**
|
|
437
377
|
* Gets the system configuration.
|
|
438
378
|
* @returns {Promise<ioBroker.OtherObject>}
|
|
439
379
|
*/
|
|
440
|
-
|
|
441
380
|
}, {
|
|
442
381
|
key: "getSystemConfig",
|
|
443
382
|
value: function getSystemConfig() {
|
|
444
383
|
return this.socket.getSystemConfig();
|
|
445
384
|
}
|
|
385
|
+
|
|
446
386
|
/**
|
|
447
387
|
* Get current expert mode
|
|
448
388
|
* @returns {boolean}
|
|
449
389
|
*/
|
|
450
|
-
|
|
451
390
|
}, {
|
|
452
391
|
key: "getExpertMode",
|
|
453
392
|
value: function getExpertMode() {
|
|
454
393
|
return window.sessionStorage.getItem('App.expertMode') === 'true' || !!this._systemConfig.expertMode;
|
|
455
394
|
}
|
|
395
|
+
|
|
456
396
|
/**
|
|
457
397
|
* Gets called when the socket.io connection is ready.
|
|
458
398
|
* You can overload this function to execute own commands.
|
|
459
399
|
*/
|
|
460
|
-
|
|
461
400
|
}, {
|
|
462
401
|
key: "onConnectionReady",
|
|
463
402
|
value: function onConnectionReady() {}
|
|
403
|
+
|
|
464
404
|
/**
|
|
465
405
|
* Encrypts a string.
|
|
466
406
|
* @param {string} value
|
|
467
407
|
* @returns {string}
|
|
468
408
|
*/
|
|
469
|
-
|
|
470
409
|
}, {
|
|
471
410
|
key: "encrypt",
|
|
472
411
|
value: function encrypt(value) {
|
|
473
412
|
var result = '';
|
|
474
|
-
|
|
475
413
|
for (var i = 0; i < value.length; i++) {
|
|
476
414
|
result += String.fromCharCode(this._secret[i % this._secret.length].charCodeAt(0) ^ value.charCodeAt(i));
|
|
477
415
|
}
|
|
478
|
-
|
|
479
416
|
return result;
|
|
480
417
|
}
|
|
418
|
+
|
|
481
419
|
/**
|
|
482
420
|
* Decrypts a string.
|
|
483
421
|
* @param {string} value
|
|
484
422
|
* @returns {string}
|
|
485
423
|
*/
|
|
486
|
-
|
|
487
424
|
}, {
|
|
488
425
|
key: "decrypt",
|
|
489
426
|
value: function decrypt(value) {
|
|
490
427
|
var result = '';
|
|
491
|
-
|
|
492
428
|
for (var i = 0; i < value.length; i++) {
|
|
493
429
|
result += String.fromCharCode(this._secret[i % this._secret.length].charCodeAt(0) ^ value.charCodeAt(i));
|
|
494
430
|
}
|
|
495
|
-
|
|
496
431
|
return result;
|
|
497
432
|
}
|
|
433
|
+
|
|
498
434
|
/**
|
|
499
435
|
* Gets called when the navigation hash changes.
|
|
500
436
|
* You may override this if needed.
|
|
501
437
|
*/
|
|
502
|
-
|
|
503
438
|
}, {
|
|
504
439
|
key: "onHashChanged",
|
|
505
440
|
value: function onHashChanged() {
|
|
506
441
|
var location = _Router2["default"].getLocation();
|
|
507
|
-
|
|
508
442
|
if (location.tab !== this.state.selectedTab) {
|
|
509
443
|
this.selectTab(location.tab);
|
|
510
444
|
}
|
|
511
445
|
}
|
|
446
|
+
|
|
512
447
|
/**
|
|
513
448
|
* Selects the given tab.
|
|
514
449
|
* @param {string} tab
|
|
515
450
|
* @param {number} [index]
|
|
516
451
|
*/
|
|
517
|
-
|
|
518
452
|
}, {
|
|
519
453
|
key: "selectTab",
|
|
520
454
|
value: function selectTab(tab, index) {
|
|
@@ -524,17 +458,16 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
524
458
|
selectedTabNum: index
|
|
525
459
|
});
|
|
526
460
|
}
|
|
461
|
+
|
|
527
462
|
/**
|
|
528
463
|
* Gets called before the settings are saved.
|
|
529
464
|
* You may override this if needed.
|
|
530
465
|
* @param {Record<string, any>} settings
|
|
531
466
|
*/
|
|
532
|
-
|
|
533
467
|
}, {
|
|
534
468
|
key: "onPrepareSave",
|
|
535
469
|
value: function onPrepareSave(settings) {
|
|
536
470
|
var _this3 = this;
|
|
537
|
-
|
|
538
471
|
// here you can encode values
|
|
539
472
|
this.encryptedFields && this.encryptedFields.forEach(function (attr) {
|
|
540
473
|
if (settings[attr]) {
|
|
@@ -543,18 +476,17 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
543
476
|
});
|
|
544
477
|
return true;
|
|
545
478
|
}
|
|
479
|
+
|
|
546
480
|
/**
|
|
547
481
|
* Gets called after the settings are loaded.
|
|
548
482
|
* You may override this if needed.
|
|
549
483
|
* @param {Record<string, any>} settings
|
|
550
484
|
* @param {string[]} encryptedNative optional list of fields to be decrypted
|
|
551
485
|
*/
|
|
552
|
-
|
|
553
486
|
}, {
|
|
554
487
|
key: "onPrepareLoad",
|
|
555
488
|
value: function onPrepareLoad(settings, encryptedNative) {
|
|
556
489
|
var _this4 = this;
|
|
557
|
-
|
|
558
490
|
// here you can encode values
|
|
559
491
|
this.encryptedFields && this.encryptedFields.forEach(function (attr) {
|
|
560
492
|
if (settings[attr]) {
|
|
@@ -564,22 +496,20 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
564
496
|
encryptedNative && encryptedNative.forEach(function (attr) {
|
|
565
497
|
_this4.encryptedFields = _this4.encryptedFields || [];
|
|
566
498
|
!_this4.encryptedFields.includes(attr) && _this4.encryptedFields.push(attr);
|
|
567
|
-
|
|
568
499
|
if (settings[attr]) {
|
|
569
500
|
settings[attr] = _this4.decrypt(settings[attr]);
|
|
570
501
|
}
|
|
571
502
|
});
|
|
572
503
|
}
|
|
504
|
+
|
|
573
505
|
/**
|
|
574
506
|
* Gets the extendable instances.
|
|
575
507
|
* @returns {Promise<any[]>}
|
|
576
508
|
*/
|
|
577
|
-
|
|
578
509
|
}, {
|
|
579
510
|
key: "getExtendableInstances",
|
|
580
511
|
value: function getExtendableInstances() {
|
|
581
512
|
var _this5 = this;
|
|
582
|
-
|
|
583
513
|
return new Promise(function (resolve) {
|
|
584
514
|
_this5.socket._socket.emit('getObjectView', 'system', 'instance', null, function (err, doc) {
|
|
585
515
|
if (err) {
|
|
@@ -594,16 +524,15 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
594
524
|
});
|
|
595
525
|
});
|
|
596
526
|
}
|
|
527
|
+
|
|
597
528
|
/**
|
|
598
529
|
* Gets the IP addresses of the given host.
|
|
599
530
|
* @param {string} host
|
|
600
531
|
*/
|
|
601
|
-
|
|
602
532
|
}, {
|
|
603
533
|
key: "getIpAddresses",
|
|
604
534
|
value: function getIpAddresses(host) {
|
|
605
535
|
var _this6 = this;
|
|
606
|
-
|
|
607
536
|
return new Promise(function (resolve, reject) {
|
|
608
537
|
_this6.socket._socket.emit('getHostByIp', host || _this6.common.host, function (ip, _host) {
|
|
609
538
|
var IPs4 = [{
|
|
@@ -616,10 +545,8 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
616
545
|
address: '::',
|
|
617
546
|
family: 'ipv6'
|
|
618
547
|
}];
|
|
619
|
-
|
|
620
548
|
if (_host) {
|
|
621
549
|
host = _host;
|
|
622
|
-
|
|
623
550
|
if (host["native"].hardware && host["native"].hardware.networkInterfaces) {
|
|
624
551
|
Object.keys(host["native"].hardware.networkInterfaces).forEach(function (eth) {
|
|
625
552
|
return host["native"].hardware.networkInterfaces[eth].forEach(function (inter) {
|
|
@@ -639,38 +566,32 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
639
566
|
});
|
|
640
567
|
});
|
|
641
568
|
}
|
|
642
|
-
|
|
643
569
|
IPs6.forEach(function (ip) {
|
|
644
570
|
return IPs4.push(ip);
|
|
645
571
|
});
|
|
646
572
|
}
|
|
647
|
-
|
|
648
573
|
resolve(IPs4);
|
|
649
574
|
});
|
|
650
575
|
});
|
|
651
576
|
}
|
|
577
|
+
|
|
652
578
|
/**
|
|
653
579
|
* Saves the settings to the server.
|
|
654
580
|
* @param {boolean} isClose True if the user is closing the dialog.
|
|
655
581
|
*/
|
|
656
|
-
|
|
657
582
|
}, {
|
|
658
583
|
key: "onSave",
|
|
659
584
|
value: function onSave(isClose) {
|
|
660
585
|
var _this7 = this;
|
|
661
|
-
|
|
662
586
|
var oldObj;
|
|
663
|
-
|
|
664
587
|
if (this.state.isConfigurationError) {
|
|
665
588
|
this.setState({
|
|
666
589
|
errorText: this.state.isConfigurationError
|
|
667
590
|
});
|
|
668
591
|
return;
|
|
669
592
|
}
|
|
670
|
-
|
|
671
593
|
this.socket.getObject(this.instanceId).then(function (_oldObj) {
|
|
672
594
|
oldObj = _oldObj || {};
|
|
673
|
-
|
|
674
595
|
for (var a in _this7.state["native"]) {
|
|
675
596
|
if (_this7.state["native"].hasOwnProperty(a)) {
|
|
676
597
|
if (_this7.state["native"][a] === null) {
|
|
@@ -682,7 +603,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
682
603
|
}
|
|
683
604
|
}
|
|
684
605
|
}
|
|
685
|
-
|
|
686
606
|
if (_this7.state.common) {
|
|
687
607
|
for (var b in _this7.state.common) {
|
|
688
608
|
if (_this7.state.common[b] === null) {
|
|
@@ -694,7 +614,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
694
614
|
}
|
|
695
615
|
}
|
|
696
616
|
}
|
|
697
|
-
|
|
698
617
|
if (_this7.onPrepareSave(oldObj["native"]) !== false) {
|
|
699
618
|
return _this7.socket.setObject(_this7.instanceId, oldObj);
|
|
700
619
|
} else {
|
|
@@ -703,35 +622,31 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
703
622
|
}).then(function () {
|
|
704
623
|
_this7.savedNative = oldObj["native"];
|
|
705
624
|
globalThis.changed = false;
|
|
706
|
-
|
|
707
625
|
try {
|
|
708
626
|
window.parent.postMessage('nochange', '*');
|
|
709
|
-
} catch (e) {
|
|
627
|
+
} catch (e) {
|
|
628
|
+
// ignore
|
|
710
629
|
}
|
|
711
|
-
|
|
712
630
|
_this7.setState({
|
|
713
631
|
changed: false
|
|
714
632
|
});
|
|
715
|
-
|
|
716
633
|
isClose && GenericApp.onClose();
|
|
717
634
|
})["catch"](function (e) {
|
|
718
635
|
console.error("Cannot save configuration: ".concat(e));
|
|
719
636
|
});
|
|
720
637
|
}
|
|
638
|
+
|
|
721
639
|
/**
|
|
722
640
|
* Renders the toast.
|
|
723
641
|
* @returns {JSX.Element | null} The JSX element.
|
|
724
642
|
*/
|
|
725
|
-
|
|
726
643
|
}, {
|
|
727
644
|
key: "renderToast",
|
|
728
645
|
value: function renderToast() {
|
|
729
646
|
var _this8 = this;
|
|
730
|
-
|
|
731
647
|
if (!this.state.toast) {
|
|
732
648
|
return null;
|
|
733
649
|
}
|
|
734
|
-
|
|
735
650
|
return /*#__PURE__*/_react["default"].createElement(_Snackbar["default"], {
|
|
736
651
|
anchorOrigin: {
|
|
737
652
|
vertical: 'bottom',
|
|
@@ -764,11 +679,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
764
679
|
}, /*#__PURE__*/_react["default"].createElement(_Close["default"], null))]
|
|
765
680
|
});
|
|
766
681
|
}
|
|
682
|
+
|
|
767
683
|
/**
|
|
768
684
|
* Closes the dialog.
|
|
769
685
|
* @private
|
|
770
686
|
*/
|
|
771
|
-
|
|
772
687
|
}, {
|
|
773
688
|
key: "renderError",
|
|
774
689
|
value:
|
|
@@ -778,7 +693,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
778
693
|
*/
|
|
779
694
|
function renderError() {
|
|
780
695
|
var _this9 = this;
|
|
781
|
-
|
|
782
696
|
if (!this.state.errorText) {
|
|
783
697
|
return null;
|
|
784
698
|
} else {
|
|
@@ -792,11 +706,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
792
706
|
});
|
|
793
707
|
}
|
|
794
708
|
}
|
|
709
|
+
|
|
795
710
|
/**
|
|
796
711
|
* Checks if the configuration has changed.
|
|
797
712
|
* @param {Record<string, any>} [native] the new state
|
|
798
713
|
*/
|
|
799
|
-
|
|
800
714
|
}, {
|
|
801
715
|
key: "getIsChanged",
|
|
802
716
|
value: function getIsChanged(_native) {
|
|
@@ -805,11 +719,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
805
719
|
globalThis.changed = isChanged;
|
|
806
720
|
return isChanged;
|
|
807
721
|
}
|
|
722
|
+
|
|
808
723
|
/**
|
|
809
724
|
* Gets called when loading the configuration.
|
|
810
725
|
* @param {Record<string, any>} newNative The new configuration object.
|
|
811
726
|
*/
|
|
812
|
-
|
|
813
727
|
}, {
|
|
814
728
|
key: "onLoadConfig",
|
|
815
729
|
value: function onLoadConfig(newNative) {
|
|
@@ -820,11 +734,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
820
734
|
});
|
|
821
735
|
}
|
|
822
736
|
}
|
|
737
|
+
|
|
823
738
|
/**
|
|
824
739
|
* Sets the configuration error.
|
|
825
740
|
* @param {string} errorText
|
|
826
741
|
*/
|
|
827
|
-
|
|
828
742
|
}, {
|
|
829
743
|
key: "setConfigurationError",
|
|
830
744
|
value: function setConfigurationError(errorText) {
|
|
@@ -834,20 +748,18 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
834
748
|
});
|
|
835
749
|
}
|
|
836
750
|
}
|
|
751
|
+
|
|
837
752
|
/**
|
|
838
753
|
* Renders the save and close buttons.
|
|
839
754
|
* @returns {JSX.Element | undefined} The JSX element.
|
|
840
755
|
*/
|
|
841
|
-
|
|
842
756
|
}, {
|
|
843
757
|
key: "renderSaveCloseButtons",
|
|
844
758
|
value: function renderSaveCloseButtons() {
|
|
845
759
|
var _this10 = this;
|
|
846
|
-
|
|
847
760
|
if (!this.state.confirmClose && !this.state.bottomButtons) {
|
|
848
761
|
return null;
|
|
849
762
|
}
|
|
850
|
-
|
|
851
763
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.state.bottomButtons ? /*#__PURE__*/_react["default"].createElement(_SaveCloseButtons["default"], {
|
|
852
764
|
theme: this.state.theme,
|
|
853
765
|
newReact: this.newReact,
|
|
@@ -879,6 +791,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
879
791
|
}
|
|
880
792
|
}) : null);
|
|
881
793
|
}
|
|
794
|
+
|
|
882
795
|
/**
|
|
883
796
|
* @private
|
|
884
797
|
* @param {Record<string, any>} obj
|
|
@@ -886,16 +799,13 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
886
799
|
* @param {any} value
|
|
887
800
|
* @returns {boolean | undefined}
|
|
888
801
|
*/
|
|
889
|
-
|
|
890
802
|
}, {
|
|
891
803
|
key: "_updateNativeValue",
|
|
892
804
|
value: function _updateNativeValue(obj, attrs, value) {
|
|
893
805
|
if ((0, _typeof2["default"])(attrs) !== 'object') {
|
|
894
806
|
attrs = attrs.split('.');
|
|
895
807
|
}
|
|
896
|
-
|
|
897
808
|
var attr = attrs.shift();
|
|
898
|
-
|
|
899
809
|
if (!attrs.length) {
|
|
900
810
|
if (value && (0, _typeof2["default"])(value) === 'object') {
|
|
901
811
|
if (JSON.stringify(obj[attr]) !== JSON.stringify(value)) {
|
|
@@ -910,47 +820,43 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
910
820
|
}
|
|
911
821
|
} else {
|
|
912
822
|
obj[attr] = obj[attr] || {};
|
|
913
|
-
|
|
914
823
|
if ((0, _typeof2["default"])(obj[attr]) !== 'object') {
|
|
915
824
|
throw new Error("attribute ".concat(attr, " is no object, but ").concat((0, _typeof2["default"])(obj[attr])));
|
|
916
825
|
}
|
|
917
|
-
|
|
918
826
|
return this._updateNativeValue(obj[attr], attrs, value);
|
|
919
827
|
}
|
|
920
828
|
}
|
|
829
|
+
|
|
921
830
|
/**
|
|
922
831
|
* Update the native value
|
|
923
832
|
* @param {string} attr The attribute name with dots as delimiter.
|
|
924
833
|
* @param {any} value The new value.
|
|
925
834
|
* @param {(() => void)} [cb] Callback which will be called upon completion.
|
|
926
835
|
*/
|
|
927
|
-
|
|
928
836
|
}, {
|
|
929
837
|
key: "updateNativeValue",
|
|
930
838
|
value: function updateNativeValue(attr, value, cb) {
|
|
931
839
|
var _native2 = JSON.parse(JSON.stringify(this.state["native"]));
|
|
932
|
-
|
|
933
840
|
if (this._updateNativeValue(_native2, attr, value)) {
|
|
934
841
|
var changed = this.getIsChanged(_native2);
|
|
935
|
-
|
|
936
842
|
if (changed !== this.state.changed) {
|
|
937
843
|
try {
|
|
938
844
|
window.parent.postMessage(changed ? 'change' : 'nochange', '*');
|
|
939
|
-
} catch (e) {
|
|
845
|
+
} catch (e) {
|
|
846
|
+
// ignore
|
|
940
847
|
}
|
|
941
848
|
}
|
|
942
|
-
|
|
943
849
|
this.setState({
|
|
944
850
|
"native": _native2,
|
|
945
851
|
changed: changed
|
|
946
852
|
}, cb);
|
|
947
853
|
}
|
|
948
854
|
}
|
|
855
|
+
|
|
949
856
|
/**
|
|
950
857
|
* Set the error text to be shown.
|
|
951
858
|
* @param {string | JSX.Element} text
|
|
952
859
|
*/
|
|
953
|
-
|
|
954
860
|
}, {
|
|
955
861
|
key: "showError",
|
|
956
862
|
value: function showError(text) {
|
|
@@ -958,11 +864,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
958
864
|
errorText: text
|
|
959
865
|
});
|
|
960
866
|
}
|
|
867
|
+
|
|
961
868
|
/**
|
|
962
869
|
* Sets the toast to be shown.
|
|
963
870
|
* @param {string} toast
|
|
964
871
|
*/
|
|
965
|
-
|
|
966
872
|
}, {
|
|
967
873
|
key: "showToast",
|
|
968
874
|
value: function showToast(toast) {
|
|
@@ -970,11 +876,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
970
876
|
toast: toast
|
|
971
877
|
});
|
|
972
878
|
}
|
|
879
|
+
|
|
973
880
|
/**
|
|
974
881
|
* Renders this component.
|
|
975
882
|
* @returns {JSX.Element} The JSX element.
|
|
976
883
|
*/
|
|
977
|
-
|
|
978
884
|
}, {
|
|
979
885
|
key: "render",
|
|
980
886
|
value: function render() {
|
|
@@ -983,7 +889,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
983
889
|
theme: this.state.themeType
|
|
984
890
|
});
|
|
985
891
|
}
|
|
986
|
-
|
|
987
892
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
988
893
|
className: "App"
|
|
989
894
|
}, this.renderError(), this.renderToast(), this.renderSaveCloseButtons());
|
|
@@ -1001,6 +906,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
1001
906
|
* |-------|-------|-------|-------|------>
|
|
1002
907
|
* width | xs | sm | md | lg | xl
|
|
1003
908
|
*/
|
|
909
|
+
|
|
1004
910
|
var SIZES = {
|
|
1005
911
|
xs: 0,
|
|
1006
912
|
sm: 600,
|
|
@@ -1033,7 +939,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
1033
939
|
}]);
|
|
1034
940
|
return GenericApp;
|
|
1035
941
|
}(_Router2["default"]);
|
|
1036
|
-
|
|
1037
942
|
GenericApp.propTypes = {
|
|
1038
943
|
adapterName: _propTypes["default"].string,
|
|
1039
944
|
// (optional) name of adapter
|
|
@@ -1046,7 +951,6 @@ GenericApp.propTypes = {
|
|
|
1046
951
|
bottomButtons: _propTypes["default"].bool,
|
|
1047
952
|
// If the bottom buttons (Save/Close) must be shown
|
|
1048
953
|
Connection: _propTypes["default"].object // If the bottom buttons (Save/Close) must be shown
|
|
1049
|
-
|
|
1050
954
|
};
|
|
1051
955
|
var _default = GenericApp;
|
|
1052
956
|
exports["default"] = _default;
|