@iobroker/adapter-react-v5 3.1.34 → 3.2.0
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 +181 -788
- 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 +55 -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/uk.json +326 -0
- package/i18n.d.ts +2 -0
- package/i18n.js +9 -29
- 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'),
|
|
@@ -237,9 +186,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
237
186
|
'it': require('./i18n/it.json'),
|
|
238
187
|
'es': require('./i18n/es.json'),
|
|
239
188
|
'pl': require('./i18n/pl.json'),
|
|
189
|
+
'uk': require('./i18n/uk.json'),
|
|
240
190
|
'zh-cn': require('./i18n/zh-cn.json')
|
|
241
|
-
};
|
|
191
|
+
};
|
|
242
192
|
|
|
193
|
+
// merge together
|
|
243
194
|
if (settings && settings.translations) {
|
|
244
195
|
Object.keys(settings.translations).forEach(function (lang) {
|
|
245
196
|
return translations[lang] = Object.assign(translations[lang], settings.translations[lang]);
|
|
@@ -249,9 +200,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
249
200
|
return translations[lang] = Object.assign(translations[lang], props.translations[lang]);
|
|
250
201
|
});
|
|
251
202
|
}
|
|
252
|
-
|
|
253
203
|
_i18n["default"].setTranslations(translations);
|
|
254
|
-
|
|
255
204
|
_this.savedNative = {}; // to detect if the config changed
|
|
256
205
|
|
|
257
206
|
_this.encryptedFields = props.encryptedFields || (settings === null || settings === void 0 ? void 0 : settings.encryptedFields) || [];
|
|
@@ -275,9 +224,9 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
275
224
|
}
|
|
276
225
|
},
|
|
277
226
|
onReady: function onReady(objects, scripts) {
|
|
278
|
-
_i18n["default"].setLanguage(_this.socket.systemLang);
|
|
279
|
-
|
|
227
|
+
_i18n["default"].setLanguage(_this.socket.systemLang);
|
|
280
228
|
|
|
229
|
+
// subscribe because of language and expert mode
|
|
281
230
|
_this.socket.subscribeObject('system.config', _this.onSystemConfigChanged).then(function () {
|
|
282
231
|
return _this.getSystemConfig();
|
|
283
232
|
}).then(function (obj) {
|
|
@@ -286,8 +235,9 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
286
235
|
return _this.socket.getObject(_this.instanceId);
|
|
287
236
|
}).then(function (instanceObj) {
|
|
288
237
|
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';
|
|
238
|
+
var sentryEnabled = _this._systemConfig.diag !== 'none' && instanceObj && instanceObj.common && instanceObj.common.name && instanceObj.common.version && !instanceObj.common.disableDataReporting && window.location.host !== 'localhost:3000';
|
|
290
239
|
|
|
240
|
+
// activate sentry plugin
|
|
291
241
|
if (!_this.sentryStarted && _this.sentryDSN && sentryEnabled) {
|
|
292
242
|
_this.sentryStarted = true;
|
|
293
243
|
Sentry.init({
|
|
@@ -295,10 +245,10 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
295
245
|
release: "iobroker.".concat(instanceObj.common.name, "@").concat(instanceObj.common.version),
|
|
296
246
|
integrations: [new SentryIntegrations.Dedupe()]
|
|
297
247
|
});
|
|
298
|
-
}
|
|
299
|
-
// for backward compatibility it will be processed separately from above logic: some adapters could still have this.sentryDSN as undefined
|
|
300
|
-
|
|
248
|
+
}
|
|
301
249
|
|
|
250
|
+
// read UUID and init sentry with it.
|
|
251
|
+
// for backward compatibility it will be processed separately from above logic: some adapters could still have this.sentryDSN as undefined
|
|
302
252
|
if (!_this.sentryInited && sentryEnabled) {
|
|
303
253
|
_this.sentryInited = true;
|
|
304
254
|
waitPromise = _this.socket.getObject('system.meta.uuid').then(function (uuidObj) {
|
|
@@ -311,17 +261,12 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
311
261
|
}
|
|
312
262
|
});
|
|
313
263
|
}
|
|
314
|
-
|
|
315
264
|
waitPromise = waitPromise || Promise.resolve();
|
|
316
265
|
waitPromise.then(function () {
|
|
317
266
|
if (instanceObj) {
|
|
318
267
|
_this.common = instanceObj === null || instanceObj === void 0 ? void 0 : instanceObj.common;
|
|
319
|
-
|
|
320
268
|
_this.onPrepareLoad(instanceObj["native"], instanceObj.encryptedNative); // decode all secrets
|
|
321
|
-
|
|
322
|
-
|
|
323
269
|
_this.savedNative = JSON.parse(JSON.stringify(instanceObj["native"]));
|
|
324
|
-
|
|
325
270
|
_this.setState({
|
|
326
271
|
"native": instanceObj["native"],
|
|
327
272
|
loaded: true,
|
|
@@ -331,7 +276,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
331
276
|
});
|
|
332
277
|
} else {
|
|
333
278
|
console.warn('Cannot load instance settings');
|
|
334
|
-
|
|
335
279
|
_this.setState({
|
|
336
280
|
"native": {},
|
|
337
281
|
loaded: true,
|
|
@@ -345,13 +289,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
345
289
|
},
|
|
346
290
|
onError: function onError(err) {
|
|
347
291
|
console.error(err);
|
|
348
|
-
|
|
349
292
|
_this.showError(err);
|
|
350
293
|
}
|
|
351
294
|
}));
|
|
352
295
|
return _this;
|
|
353
296
|
}
|
|
354
|
-
|
|
355
297
|
(0, _createClass2["default"])(GenericApp, [{
|
|
356
298
|
key: "componentDidMount",
|
|
357
299
|
value:
|
|
@@ -363,10 +305,10 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
363
305
|
window.addEventListener('message', this.onReceiveMessage, false);
|
|
364
306
|
(0, _get2["default"])((0, _getPrototypeOf2["default"])(GenericApp.prototype), "componentDidMount", this).call(this);
|
|
365
307
|
}
|
|
308
|
+
|
|
366
309
|
/**
|
|
367
310
|
* Called immediately before a component is destroyed.
|
|
368
311
|
*/
|
|
369
|
-
|
|
370
312
|
}, {
|
|
371
313
|
key: "componentWillUnmount",
|
|
372
314
|
value: function componentWillUnmount() {
|
|
@@ -386,43 +328,41 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
386
328
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
387
329
|
return (0, _Theme["default"])(_Utils["default"].getThemeName(name));
|
|
388
330
|
}
|
|
331
|
+
|
|
389
332
|
/**
|
|
390
333
|
* Get the theme name
|
|
391
334
|
* @param {import('./types').Theme} theme Theme
|
|
392
335
|
* @returns {string} Theme name
|
|
393
336
|
*/
|
|
394
|
-
|
|
395
337
|
}, {
|
|
396
338
|
key: "getThemeName",
|
|
397
339
|
value: function getThemeName(theme) {
|
|
398
340
|
return theme.name;
|
|
399
341
|
}
|
|
342
|
+
|
|
400
343
|
/**
|
|
401
344
|
* Get the theme type
|
|
402
345
|
* @param {import('./types').Theme} theme Theme
|
|
403
346
|
* @returns {string} Theme type
|
|
404
347
|
*/
|
|
405
|
-
|
|
406
348
|
}, {
|
|
407
349
|
key: "getThemeType",
|
|
408
350
|
value: function getThemeType(theme) {
|
|
409
351
|
return theme.palette.mode;
|
|
410
352
|
}
|
|
353
|
+
|
|
411
354
|
/**
|
|
412
355
|
* Changes the current theme
|
|
413
356
|
*/
|
|
414
|
-
|
|
415
357
|
}, {
|
|
416
358
|
key: "toggleTheme",
|
|
417
359
|
value: function toggleTheme() {
|
|
418
360
|
var _this2 = this;
|
|
361
|
+
var themeName = this.state.themeName;
|
|
419
362
|
|
|
420
|
-
|
|
421
|
-
|
|
363
|
+
// dark => blue => colored => light => dark
|
|
422
364
|
var newThemeName = themeName === 'dark' ? 'blue' : themeName === 'blue' ? 'colored' : themeName === 'colored' ? 'light' : 'dark';
|
|
423
|
-
|
|
424
365
|
_Utils["default"].setThemeName(newThemeName);
|
|
425
|
-
|
|
426
366
|
var theme = this.createTheme(newThemeName);
|
|
427
367
|
this.setState({
|
|
428
368
|
theme: theme,
|
|
@@ -433,88 +373,83 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
433
373
|
_this2.onThemeChanged && _this2.onThemeChanged(newThemeName);
|
|
434
374
|
});
|
|
435
375
|
}
|
|
376
|
+
|
|
436
377
|
/**
|
|
437
378
|
* Gets the system configuration.
|
|
438
379
|
* @returns {Promise<ioBroker.OtherObject>}
|
|
439
380
|
*/
|
|
440
|
-
|
|
441
381
|
}, {
|
|
442
382
|
key: "getSystemConfig",
|
|
443
383
|
value: function getSystemConfig() {
|
|
444
384
|
return this.socket.getSystemConfig();
|
|
445
385
|
}
|
|
386
|
+
|
|
446
387
|
/**
|
|
447
388
|
* Get current expert mode
|
|
448
389
|
* @returns {boolean}
|
|
449
390
|
*/
|
|
450
|
-
|
|
451
391
|
}, {
|
|
452
392
|
key: "getExpertMode",
|
|
453
393
|
value: function getExpertMode() {
|
|
454
394
|
return window.sessionStorage.getItem('App.expertMode') === 'true' || !!this._systemConfig.expertMode;
|
|
455
395
|
}
|
|
396
|
+
|
|
456
397
|
/**
|
|
457
398
|
* Gets called when the socket.io connection is ready.
|
|
458
399
|
* You can overload this function to execute own commands.
|
|
459
400
|
*/
|
|
460
|
-
|
|
461
401
|
}, {
|
|
462
402
|
key: "onConnectionReady",
|
|
463
403
|
value: function onConnectionReady() {}
|
|
404
|
+
|
|
464
405
|
/**
|
|
465
406
|
* Encrypts a string.
|
|
466
407
|
* @param {string} value
|
|
467
408
|
* @returns {string}
|
|
468
409
|
*/
|
|
469
|
-
|
|
470
410
|
}, {
|
|
471
411
|
key: "encrypt",
|
|
472
412
|
value: function encrypt(value) {
|
|
473
413
|
var result = '';
|
|
474
|
-
|
|
475
414
|
for (var i = 0; i < value.length; i++) {
|
|
476
415
|
result += String.fromCharCode(this._secret[i % this._secret.length].charCodeAt(0) ^ value.charCodeAt(i));
|
|
477
416
|
}
|
|
478
|
-
|
|
479
417
|
return result;
|
|
480
418
|
}
|
|
419
|
+
|
|
481
420
|
/**
|
|
482
421
|
* Decrypts a string.
|
|
483
422
|
* @param {string} value
|
|
484
423
|
* @returns {string}
|
|
485
424
|
*/
|
|
486
|
-
|
|
487
425
|
}, {
|
|
488
426
|
key: "decrypt",
|
|
489
427
|
value: function decrypt(value) {
|
|
490
428
|
var result = '';
|
|
491
|
-
|
|
492
429
|
for (var i = 0; i < value.length; i++) {
|
|
493
430
|
result += String.fromCharCode(this._secret[i % this._secret.length].charCodeAt(0) ^ value.charCodeAt(i));
|
|
494
431
|
}
|
|
495
|
-
|
|
496
432
|
return result;
|
|
497
433
|
}
|
|
434
|
+
|
|
498
435
|
/**
|
|
499
436
|
* Gets called when the navigation hash changes.
|
|
500
437
|
* You may override this if needed.
|
|
501
438
|
*/
|
|
502
|
-
|
|
503
439
|
}, {
|
|
504
440
|
key: "onHashChanged",
|
|
505
441
|
value: function onHashChanged() {
|
|
506
442
|
var location = _Router2["default"].getLocation();
|
|
507
|
-
|
|
508
443
|
if (location.tab !== this.state.selectedTab) {
|
|
509
444
|
this.selectTab(location.tab);
|
|
510
445
|
}
|
|
511
446
|
}
|
|
447
|
+
|
|
512
448
|
/**
|
|
513
449
|
* Selects the given tab.
|
|
514
450
|
* @param {string} tab
|
|
515
451
|
* @param {number} [index]
|
|
516
452
|
*/
|
|
517
|
-
|
|
518
453
|
}, {
|
|
519
454
|
key: "selectTab",
|
|
520
455
|
value: function selectTab(tab, index) {
|
|
@@ -524,17 +459,16 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
524
459
|
selectedTabNum: index
|
|
525
460
|
});
|
|
526
461
|
}
|
|
462
|
+
|
|
527
463
|
/**
|
|
528
464
|
* Gets called before the settings are saved.
|
|
529
465
|
* You may override this if needed.
|
|
530
466
|
* @param {Record<string, any>} settings
|
|
531
467
|
*/
|
|
532
|
-
|
|
533
468
|
}, {
|
|
534
469
|
key: "onPrepareSave",
|
|
535
470
|
value: function onPrepareSave(settings) {
|
|
536
471
|
var _this3 = this;
|
|
537
|
-
|
|
538
472
|
// here you can encode values
|
|
539
473
|
this.encryptedFields && this.encryptedFields.forEach(function (attr) {
|
|
540
474
|
if (settings[attr]) {
|
|
@@ -543,18 +477,17 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
543
477
|
});
|
|
544
478
|
return true;
|
|
545
479
|
}
|
|
480
|
+
|
|
546
481
|
/**
|
|
547
482
|
* Gets called after the settings are loaded.
|
|
548
483
|
* You may override this if needed.
|
|
549
484
|
* @param {Record<string, any>} settings
|
|
550
485
|
* @param {string[]} encryptedNative optional list of fields to be decrypted
|
|
551
486
|
*/
|
|
552
|
-
|
|
553
487
|
}, {
|
|
554
488
|
key: "onPrepareLoad",
|
|
555
489
|
value: function onPrepareLoad(settings, encryptedNative) {
|
|
556
490
|
var _this4 = this;
|
|
557
|
-
|
|
558
491
|
// here you can encode values
|
|
559
492
|
this.encryptedFields && this.encryptedFields.forEach(function (attr) {
|
|
560
493
|
if (settings[attr]) {
|
|
@@ -564,22 +497,20 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
564
497
|
encryptedNative && encryptedNative.forEach(function (attr) {
|
|
565
498
|
_this4.encryptedFields = _this4.encryptedFields || [];
|
|
566
499
|
!_this4.encryptedFields.includes(attr) && _this4.encryptedFields.push(attr);
|
|
567
|
-
|
|
568
500
|
if (settings[attr]) {
|
|
569
501
|
settings[attr] = _this4.decrypt(settings[attr]);
|
|
570
502
|
}
|
|
571
503
|
});
|
|
572
504
|
}
|
|
505
|
+
|
|
573
506
|
/**
|
|
574
507
|
* Gets the extendable instances.
|
|
575
508
|
* @returns {Promise<any[]>}
|
|
576
509
|
*/
|
|
577
|
-
|
|
578
510
|
}, {
|
|
579
511
|
key: "getExtendableInstances",
|
|
580
512
|
value: function getExtendableInstances() {
|
|
581
513
|
var _this5 = this;
|
|
582
|
-
|
|
583
514
|
return new Promise(function (resolve) {
|
|
584
515
|
_this5.socket._socket.emit('getObjectView', 'system', 'instance', null, function (err, doc) {
|
|
585
516
|
if (err) {
|
|
@@ -594,16 +525,15 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
594
525
|
});
|
|
595
526
|
});
|
|
596
527
|
}
|
|
528
|
+
|
|
597
529
|
/**
|
|
598
530
|
* Gets the IP addresses of the given host.
|
|
599
531
|
* @param {string} host
|
|
600
532
|
*/
|
|
601
|
-
|
|
602
533
|
}, {
|
|
603
534
|
key: "getIpAddresses",
|
|
604
535
|
value: function getIpAddresses(host) {
|
|
605
536
|
var _this6 = this;
|
|
606
|
-
|
|
607
537
|
return new Promise(function (resolve, reject) {
|
|
608
538
|
_this6.socket._socket.emit('getHostByIp', host || _this6.common.host, function (ip, _host) {
|
|
609
539
|
var IPs4 = [{
|
|
@@ -616,10 +546,8 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
616
546
|
address: '::',
|
|
617
547
|
family: 'ipv6'
|
|
618
548
|
}];
|
|
619
|
-
|
|
620
549
|
if (_host) {
|
|
621
550
|
host = _host;
|
|
622
|
-
|
|
623
551
|
if (host["native"].hardware && host["native"].hardware.networkInterfaces) {
|
|
624
552
|
Object.keys(host["native"].hardware.networkInterfaces).forEach(function (eth) {
|
|
625
553
|
return host["native"].hardware.networkInterfaces[eth].forEach(function (inter) {
|
|
@@ -639,38 +567,32 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
639
567
|
});
|
|
640
568
|
});
|
|
641
569
|
}
|
|
642
|
-
|
|
643
570
|
IPs6.forEach(function (ip) {
|
|
644
571
|
return IPs4.push(ip);
|
|
645
572
|
});
|
|
646
573
|
}
|
|
647
|
-
|
|
648
574
|
resolve(IPs4);
|
|
649
575
|
});
|
|
650
576
|
});
|
|
651
577
|
}
|
|
578
|
+
|
|
652
579
|
/**
|
|
653
580
|
* Saves the settings to the server.
|
|
654
581
|
* @param {boolean} isClose True if the user is closing the dialog.
|
|
655
582
|
*/
|
|
656
|
-
|
|
657
583
|
}, {
|
|
658
584
|
key: "onSave",
|
|
659
585
|
value: function onSave(isClose) {
|
|
660
586
|
var _this7 = this;
|
|
661
|
-
|
|
662
587
|
var oldObj;
|
|
663
|
-
|
|
664
588
|
if (this.state.isConfigurationError) {
|
|
665
589
|
this.setState({
|
|
666
590
|
errorText: this.state.isConfigurationError
|
|
667
591
|
});
|
|
668
592
|
return;
|
|
669
593
|
}
|
|
670
|
-
|
|
671
594
|
this.socket.getObject(this.instanceId).then(function (_oldObj) {
|
|
672
595
|
oldObj = _oldObj || {};
|
|
673
|
-
|
|
674
596
|
for (var a in _this7.state["native"]) {
|
|
675
597
|
if (_this7.state["native"].hasOwnProperty(a)) {
|
|
676
598
|
if (_this7.state["native"][a] === null) {
|
|
@@ -682,7 +604,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
682
604
|
}
|
|
683
605
|
}
|
|
684
606
|
}
|
|
685
|
-
|
|
686
607
|
if (_this7.state.common) {
|
|
687
608
|
for (var b in _this7.state.common) {
|
|
688
609
|
if (_this7.state.common[b] === null) {
|
|
@@ -694,7 +615,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
694
615
|
}
|
|
695
616
|
}
|
|
696
617
|
}
|
|
697
|
-
|
|
698
618
|
if (_this7.onPrepareSave(oldObj["native"]) !== false) {
|
|
699
619
|
return _this7.socket.setObject(_this7.instanceId, oldObj);
|
|
700
620
|
} else {
|
|
@@ -703,35 +623,31 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
703
623
|
}).then(function () {
|
|
704
624
|
_this7.savedNative = oldObj["native"];
|
|
705
625
|
globalThis.changed = false;
|
|
706
|
-
|
|
707
626
|
try {
|
|
708
627
|
window.parent.postMessage('nochange', '*');
|
|
709
|
-
} catch (e) {
|
|
628
|
+
} catch (e) {
|
|
629
|
+
// ignore
|
|
710
630
|
}
|
|
711
|
-
|
|
712
631
|
_this7.setState({
|
|
713
632
|
changed: false
|
|
714
633
|
});
|
|
715
|
-
|
|
716
634
|
isClose && GenericApp.onClose();
|
|
717
635
|
})["catch"](function (e) {
|
|
718
636
|
console.error("Cannot save configuration: ".concat(e));
|
|
719
637
|
});
|
|
720
638
|
}
|
|
639
|
+
|
|
721
640
|
/**
|
|
722
641
|
* Renders the toast.
|
|
723
642
|
* @returns {JSX.Element | null} The JSX element.
|
|
724
643
|
*/
|
|
725
|
-
|
|
726
644
|
}, {
|
|
727
645
|
key: "renderToast",
|
|
728
646
|
value: function renderToast() {
|
|
729
647
|
var _this8 = this;
|
|
730
|
-
|
|
731
648
|
if (!this.state.toast) {
|
|
732
649
|
return null;
|
|
733
650
|
}
|
|
734
|
-
|
|
735
651
|
return /*#__PURE__*/_react["default"].createElement(_Snackbar["default"], {
|
|
736
652
|
anchorOrigin: {
|
|
737
653
|
vertical: 'bottom',
|
|
@@ -764,11 +680,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
764
680
|
}, /*#__PURE__*/_react["default"].createElement(_Close["default"], null))]
|
|
765
681
|
});
|
|
766
682
|
}
|
|
683
|
+
|
|
767
684
|
/**
|
|
768
685
|
* Closes the dialog.
|
|
769
686
|
* @private
|
|
770
687
|
*/
|
|
771
|
-
|
|
772
688
|
}, {
|
|
773
689
|
key: "renderError",
|
|
774
690
|
value:
|
|
@@ -778,7 +694,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
778
694
|
*/
|
|
779
695
|
function renderError() {
|
|
780
696
|
var _this9 = this;
|
|
781
|
-
|
|
782
697
|
if (!this.state.errorText) {
|
|
783
698
|
return null;
|
|
784
699
|
} else {
|
|
@@ -792,11 +707,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
792
707
|
});
|
|
793
708
|
}
|
|
794
709
|
}
|
|
710
|
+
|
|
795
711
|
/**
|
|
796
712
|
* Checks if the configuration has changed.
|
|
797
713
|
* @param {Record<string, any>} [native] the new state
|
|
798
714
|
*/
|
|
799
|
-
|
|
800
715
|
}, {
|
|
801
716
|
key: "getIsChanged",
|
|
802
717
|
value: function getIsChanged(_native) {
|
|
@@ -805,11 +720,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
805
720
|
globalThis.changed = isChanged;
|
|
806
721
|
return isChanged;
|
|
807
722
|
}
|
|
723
|
+
|
|
808
724
|
/**
|
|
809
725
|
* Gets called when loading the configuration.
|
|
810
726
|
* @param {Record<string, any>} newNative The new configuration object.
|
|
811
727
|
*/
|
|
812
|
-
|
|
813
728
|
}, {
|
|
814
729
|
key: "onLoadConfig",
|
|
815
730
|
value: function onLoadConfig(newNative) {
|
|
@@ -820,11 +735,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
820
735
|
});
|
|
821
736
|
}
|
|
822
737
|
}
|
|
738
|
+
|
|
823
739
|
/**
|
|
824
740
|
* Sets the configuration error.
|
|
825
741
|
* @param {string} errorText
|
|
826
742
|
*/
|
|
827
|
-
|
|
828
743
|
}, {
|
|
829
744
|
key: "setConfigurationError",
|
|
830
745
|
value: function setConfigurationError(errorText) {
|
|
@@ -834,20 +749,18 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
834
749
|
});
|
|
835
750
|
}
|
|
836
751
|
}
|
|
752
|
+
|
|
837
753
|
/**
|
|
838
754
|
* Renders the save and close buttons.
|
|
839
755
|
* @returns {JSX.Element | undefined} The JSX element.
|
|
840
756
|
*/
|
|
841
|
-
|
|
842
757
|
}, {
|
|
843
758
|
key: "renderSaveCloseButtons",
|
|
844
759
|
value: function renderSaveCloseButtons() {
|
|
845
760
|
var _this10 = this;
|
|
846
|
-
|
|
847
761
|
if (!this.state.confirmClose && !this.state.bottomButtons) {
|
|
848
762
|
return null;
|
|
849
763
|
}
|
|
850
|
-
|
|
851
764
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, this.state.bottomButtons ? /*#__PURE__*/_react["default"].createElement(_SaveCloseButtons["default"], {
|
|
852
765
|
theme: this.state.theme,
|
|
853
766
|
newReact: this.newReact,
|
|
@@ -879,6 +792,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
879
792
|
}
|
|
880
793
|
}) : null);
|
|
881
794
|
}
|
|
795
|
+
|
|
882
796
|
/**
|
|
883
797
|
* @private
|
|
884
798
|
* @param {Record<string, any>} obj
|
|
@@ -886,16 +800,13 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
886
800
|
* @param {any} value
|
|
887
801
|
* @returns {boolean | undefined}
|
|
888
802
|
*/
|
|
889
|
-
|
|
890
803
|
}, {
|
|
891
804
|
key: "_updateNativeValue",
|
|
892
805
|
value: function _updateNativeValue(obj, attrs, value) {
|
|
893
806
|
if ((0, _typeof2["default"])(attrs) !== 'object') {
|
|
894
807
|
attrs = attrs.split('.');
|
|
895
808
|
}
|
|
896
|
-
|
|
897
809
|
var attr = attrs.shift();
|
|
898
|
-
|
|
899
810
|
if (!attrs.length) {
|
|
900
811
|
if (value && (0, _typeof2["default"])(value) === 'object') {
|
|
901
812
|
if (JSON.stringify(obj[attr]) !== JSON.stringify(value)) {
|
|
@@ -910,47 +821,43 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
910
821
|
}
|
|
911
822
|
} else {
|
|
912
823
|
obj[attr] = obj[attr] || {};
|
|
913
|
-
|
|
914
824
|
if ((0, _typeof2["default"])(obj[attr]) !== 'object') {
|
|
915
825
|
throw new Error("attribute ".concat(attr, " is no object, but ").concat((0, _typeof2["default"])(obj[attr])));
|
|
916
826
|
}
|
|
917
|
-
|
|
918
827
|
return this._updateNativeValue(obj[attr], attrs, value);
|
|
919
828
|
}
|
|
920
829
|
}
|
|
830
|
+
|
|
921
831
|
/**
|
|
922
832
|
* Update the native value
|
|
923
833
|
* @param {string} attr The attribute name with dots as delimiter.
|
|
924
834
|
* @param {any} value The new value.
|
|
925
835
|
* @param {(() => void)} [cb] Callback which will be called upon completion.
|
|
926
836
|
*/
|
|
927
|
-
|
|
928
837
|
}, {
|
|
929
838
|
key: "updateNativeValue",
|
|
930
839
|
value: function updateNativeValue(attr, value, cb) {
|
|
931
840
|
var _native2 = JSON.parse(JSON.stringify(this.state["native"]));
|
|
932
|
-
|
|
933
841
|
if (this._updateNativeValue(_native2, attr, value)) {
|
|
934
842
|
var changed = this.getIsChanged(_native2);
|
|
935
|
-
|
|
936
843
|
if (changed !== this.state.changed) {
|
|
937
844
|
try {
|
|
938
845
|
window.parent.postMessage(changed ? 'change' : 'nochange', '*');
|
|
939
|
-
} catch (e) {
|
|
846
|
+
} catch (e) {
|
|
847
|
+
// ignore
|
|
940
848
|
}
|
|
941
849
|
}
|
|
942
|
-
|
|
943
850
|
this.setState({
|
|
944
851
|
"native": _native2,
|
|
945
852
|
changed: changed
|
|
946
853
|
}, cb);
|
|
947
854
|
}
|
|
948
855
|
}
|
|
856
|
+
|
|
949
857
|
/**
|
|
950
858
|
* Set the error text to be shown.
|
|
951
859
|
* @param {string | JSX.Element} text
|
|
952
860
|
*/
|
|
953
|
-
|
|
954
861
|
}, {
|
|
955
862
|
key: "showError",
|
|
956
863
|
value: function showError(text) {
|
|
@@ -958,11 +865,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
958
865
|
errorText: text
|
|
959
866
|
});
|
|
960
867
|
}
|
|
868
|
+
|
|
961
869
|
/**
|
|
962
870
|
* Sets the toast to be shown.
|
|
963
871
|
* @param {string} toast
|
|
964
872
|
*/
|
|
965
|
-
|
|
966
873
|
}, {
|
|
967
874
|
key: "showToast",
|
|
968
875
|
value: function showToast(toast) {
|
|
@@ -970,11 +877,11 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
970
877
|
toast: toast
|
|
971
878
|
});
|
|
972
879
|
}
|
|
880
|
+
|
|
973
881
|
/**
|
|
974
882
|
* Renders this component.
|
|
975
883
|
* @returns {JSX.Element} The JSX element.
|
|
976
884
|
*/
|
|
977
|
-
|
|
978
885
|
}, {
|
|
979
886
|
key: "render",
|
|
980
887
|
value: function render() {
|
|
@@ -983,7 +890,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
983
890
|
theme: this.state.themeType
|
|
984
891
|
});
|
|
985
892
|
}
|
|
986
|
-
|
|
987
893
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
988
894
|
className: "App"
|
|
989
895
|
}, this.renderError(), this.renderToast(), this.renderSaveCloseButtons());
|
|
@@ -1001,6 +907,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
1001
907
|
* |-------|-------|-------|-------|------>
|
|
1002
908
|
* width | xs | sm | md | lg | xl
|
|
1003
909
|
*/
|
|
910
|
+
|
|
1004
911
|
var SIZES = {
|
|
1005
912
|
xs: 0,
|
|
1006
913
|
sm: 600,
|
|
@@ -1033,7 +940,6 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
1033
940
|
}]);
|
|
1034
941
|
return GenericApp;
|
|
1035
942
|
}(_Router2["default"]);
|
|
1036
|
-
|
|
1037
943
|
GenericApp.propTypes = {
|
|
1038
944
|
adapterName: _propTypes["default"].string,
|
|
1039
945
|
// (optional) name of adapter
|
|
@@ -1046,7 +952,6 @@ GenericApp.propTypes = {
|
|
|
1046
952
|
bottomButtons: _propTypes["default"].bool,
|
|
1047
953
|
// If the bottom buttons (Save/Close) must be shown
|
|
1048
954
|
Connection: _propTypes["default"].object // If the bottom buttons (Save/Close) must be shown
|
|
1049
|
-
|
|
1050
955
|
};
|
|
1051
956
|
var _default = GenericApp;
|
|
1052
957
|
exports["default"] = _default;
|