@iobroker/adapter-react-v5 4.3.3 → 4.4.1
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/JsonConfigComponent/ChipInput.d.ts +3 -4
- package/Components/JsonConfigComponent/ChipInput.js +57 -67
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAccordion.js +14 -17
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.js +4 -4
- package/Components/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +5 -5
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +61 -64
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCRON.js +8 -8
- package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertCollection.js +1 -1
- package/Components/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +18 -22
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCertificates.js +20 -23
- package/Components/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +224 -126
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js +7 -10
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigChip.js +7 -8
- package/Components/JsonConfigComponent/ConfigChip.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.d.ts +20 -13
- package/Components/JsonConfigComponent/ConfigColor.js +12 -16
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js +13 -17
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +48 -45
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.js +2 -2
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFile.js +39 -36
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +96 -94
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +10 -10
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigGeneric.js +240 -243
- package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +6 -6
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageSendTo.js +2 -1
- package/Components/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +5 -5
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +14 -14
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +3 -3
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +7 -7
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigLicense.js +2 -1
- package/Components/JsonConfigComponent/ConfigLicense.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.js +55 -56
- package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +7 -7
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +72 -69
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +8 -5
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPort.js +6 -7
- package/Components/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +10 -10
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelect.js +12 -12
- package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +95 -106
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +26 -19
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSetState.js +13 -31
- package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSlider.js +2 -3
- package/Components/JsonConfigComponent/ConfigSlider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.js +5 -3
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +12 -13
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +24 -25
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +3 -3
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigText.js +61 -64
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +5 -5
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.js +3 -3
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTopic.js +3 -3
- package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUUID.js +3 -1
- package/Components/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/JsonConfigComponent/index.d.ts +0 -2
- package/Components/JsonConfigComponent/index.js +39 -45
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/LegacyConnection.d.ts +18 -0
- package/LegacyConnection.js +80 -2
- package/LegacyConnection.js.map +1 -1
- package/README.md +3 -0
- package/package.json +4 -4
|
@@ -19,9 +19,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
19
19
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
20
|
var _styles = require("@mui/styles");
|
|
21
21
|
var _material = require("@mui/material");
|
|
22
|
-
var
|
|
22
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
23
23
|
var _i18n = _interopRequireDefault(require("./wrapper/i18n"));
|
|
24
|
-
var _Error = _interopRequireDefault(require("./wrapper/Dialogs/Error"));
|
|
25
24
|
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
26
25
|
var _Confirm = _interopRequireDefault(require("./wrapper/Dialogs/Confirm"));
|
|
27
26
|
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); }; }
|
|
@@ -97,18 +96,72 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
97
96
|
value: function renderErrorDialog() {
|
|
98
97
|
var _this = this;
|
|
99
98
|
if (this.state._error && !this.state.showLicenseData) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
var content = this.state._error;
|
|
100
|
+
if (this.state.allLicenses) {
|
|
101
|
+
content = [/*#__PURE__*/_react["default"].createElement("div", {
|
|
102
|
+
key: "error"
|
|
103
|
+
}, content)];
|
|
104
|
+
content.push( /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
105
|
+
key: "button",
|
|
106
|
+
variant: "contained",
|
|
107
|
+
onClick: function onClick() {
|
|
108
|
+
return window.open('https://iobroker.net/www/account/licenses', '_blank');
|
|
109
|
+
}
|
|
110
|
+
}, _i18n["default"].t('iobroker.net')));
|
|
111
|
+
if (!this.state.allLicenses.length) {
|
|
112
|
+
content.push( /*#__PURE__*/_react["default"].createElement("div", {
|
|
113
|
+
key: "text1"
|
|
114
|
+
}, _i18n["default"].t('ra_No one license found in license manager')));
|
|
115
|
+
content.push( /*#__PURE__*/_react["default"].createElement("div", {
|
|
116
|
+
key: "text2"
|
|
117
|
+
}, _i18n["default"].t('ra_Please create license')));
|
|
118
|
+
} else {
|
|
119
|
+
// license.id,
|
|
120
|
+
// validName,
|
|
121
|
+
// validUuid,
|
|
122
|
+
// validTill,
|
|
123
|
+
// validVersion,
|
|
124
|
+
// license,
|
|
125
|
+
content.push( /*#__PURE__*/_react["default"].createElement(_material.TableContainer, {
|
|
126
|
+
key: "table"
|
|
127
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Table, {
|
|
128
|
+
size: "small"
|
|
129
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.TableHead, null, /*#__PURE__*/_react["default"].createElement(_material.TableRow, null, /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, _i18n["default"].t('ra_Product')), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, _i18n["default"].t('ra_Version')), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, "UUID"), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, _i18n["default"].t('ra_ValidTill')), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, _i18n["default"].t('ra_Commercial')), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, "ID"))), /*#__PURE__*/_react["default"].createElement(_material.TableBody, null, this.state.allLicenses.map(function (license) {
|
|
130
|
+
return /*#__PURE__*/_react["default"].createElement(_material.TableRow, {
|
|
131
|
+
key: license.id
|
|
132
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
133
|
+
className: license.validName ? '' : _this.props.classes.errorText
|
|
134
|
+
}, license.license.product), /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
135
|
+
className: license.validVersion ? '' : _this.props.classes.errorText
|
|
136
|
+
}, license.license.version), /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
137
|
+
className: license.validUuid ? '' : _this.props.classes.errorText
|
|
138
|
+
}, license.license.uuid || '--'), /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
139
|
+
className: license.validTill ? '' : _this.props.classes.errorText
|
|
140
|
+
}, license.license.validTill && license.license.validTill !== '0000-00-00 00:00:00' ? new Date(license.license.validTill).toLocaleDateString() : '--'), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, license.license.invoice !== 'free' ? license.license.invoice === 'MANUALLY_CREATED' ? '✓' : license.license.invoice : '-'), /*#__PURE__*/_react["default"].createElement(_material.TableCell, null, license.id));
|
|
141
|
+
})))));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
145
|
+
open: !0,
|
|
146
|
+
maxWidth: "xl",
|
|
147
|
+
fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true,
|
|
103
148
|
onClose: function onClose() {
|
|
149
|
+
return _this.handleOk();
|
|
150
|
+
}
|
|
151
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, _i18n["default"].t('ra_Error')), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_material.DialogContentText, null, content)), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
152
|
+
variant: "contained",
|
|
153
|
+
onClick: function onClick() {
|
|
104
154
|
return _this.setState({
|
|
105
|
-
_error: ''
|
|
155
|
+
_error: '',
|
|
156
|
+
allLicenses: null
|
|
106
157
|
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
158
|
+
},
|
|
159
|
+
color: "primary",
|
|
160
|
+
autoFocus: true,
|
|
161
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Check, null)
|
|
162
|
+
}, _i18n["default"].t('ra_Ok'))));
|
|
111
163
|
}
|
|
164
|
+
return null;
|
|
112
165
|
}
|
|
113
166
|
}, {
|
|
114
167
|
key: "renderMessageDialog",
|
|
@@ -136,7 +189,7 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
136
189
|
key: key1
|
|
137
190
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
138
191
|
className: _this2.props.classes.licLabel
|
|
139
|
-
}, key,
|
|
192
|
+
}, key, ' ', "-", key1, ":"), obj[key1].toString()));
|
|
140
193
|
}
|
|
141
194
|
}
|
|
142
195
|
});
|
|
@@ -162,27 +215,32 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
162
215
|
}
|
|
163
216
|
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
164
217
|
className: this.state.result ? this.props.classes.okTitle : this.props.classes.errorTitle
|
|
165
|
-
}, _i18n["default"].t('ra_License %s', this.state.result ? 'OK' : 'INVALID'))), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, this.state.
|
|
218
|
+
}, _i18n["default"].t('ra_License %s', this.state.result ? 'OK' : 'INVALID'))), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, this.state.showLinkToProfile ? /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
219
|
+
variant: "contained",
|
|
220
|
+
onClick: function onClick() {
|
|
221
|
+
return window.open('https://iobroker.net/www/account/licenses', '_blank');
|
|
222
|
+
}
|
|
223
|
+
}, "https://iobroker.net") : null, this.state._error ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
224
|
className: this.props.classes.errorText
|
|
167
225
|
}, this.state._error) : null, pre), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
168
226
|
onClick: function onClick() {
|
|
169
227
|
return _this2.setState({
|
|
170
|
-
showLicenseData: null
|
|
228
|
+
showLicenseData: null,
|
|
229
|
+
_error: ''
|
|
171
230
|
});
|
|
172
231
|
},
|
|
173
232
|
color: "primary",
|
|
174
233
|
variant: "contained"
|
|
175
234
|
}, _i18n["default"].t('ra_Close'))));
|
|
176
|
-
} else {
|
|
177
|
-
return null;
|
|
178
235
|
}
|
|
236
|
+
return null;
|
|
179
237
|
}
|
|
180
238
|
}, {
|
|
181
239
|
key: "findInLicenseManager",
|
|
182
240
|
value: function () {
|
|
183
241
|
var _findInLicenseManager = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(adapterName) {
|
|
184
242
|
var _licenses$native;
|
|
185
|
-
var licenses,
|
|
243
|
+
var licenses, errors, useLicense, now, uuid, _uuidObj$native, uuidObj, version, _aObj$common, aObj;
|
|
186
244
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
187
245
|
while (1) switch (_context2.prev = _context2.next) {
|
|
188
246
|
case 0:
|
|
@@ -190,45 +248,61 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
190
248
|
return this.props.socket.getObject('system.licenses');
|
|
191
249
|
case 2:
|
|
192
250
|
licenses = _context2.sent;
|
|
251
|
+
errors = [];
|
|
193
252
|
if (!(licenses !== null && licenses !== void 0 && (_licenses$native = licenses["native"]) !== null && _licenses$native !== void 0 && (_licenses$native = _licenses$native.licenses) !== null && _licenses$native !== void 0 && _licenses$native.length)) {
|
|
194
|
-
_context2.next =
|
|
253
|
+
_context2.next = 18;
|
|
195
254
|
break;
|
|
196
255
|
}
|
|
197
256
|
// enable license manager
|
|
198
257
|
now = Date.now();
|
|
199
258
|
if (!this.props.schema.uuid) {
|
|
200
|
-
_context2.next =
|
|
259
|
+
_context2.next = 11;
|
|
201
260
|
break;
|
|
202
261
|
}
|
|
203
|
-
_context2.next =
|
|
262
|
+
_context2.next = 9;
|
|
204
263
|
return this.props.socket.getObject('system.meta.uuid');
|
|
205
|
-
case
|
|
264
|
+
case 9:
|
|
206
265
|
uuidObj = _context2.sent;
|
|
207
266
|
uuid = uuidObj === null || uuidObj === void 0 || (_uuidObj$native = uuidObj["native"]) === null || _uuidObj$native === void 0 ? void 0 : _uuidObj$native.uuid;
|
|
208
|
-
case
|
|
267
|
+
case 11:
|
|
209
268
|
if (!this.props.schema.version) {
|
|
210
|
-
_context2.next =
|
|
269
|
+
_context2.next = 16;
|
|
211
270
|
break;
|
|
212
271
|
}
|
|
213
|
-
_context2.next =
|
|
272
|
+
_context2.next = 14;
|
|
214
273
|
return this.props.socket.getObject("system.adapter.".concat(adapterName));
|
|
215
|
-
case
|
|
274
|
+
case 14:
|
|
216
275
|
aObj = _context2.sent;
|
|
217
276
|
version = aObj === null || aObj === void 0 || (_aObj$common = aObj.common) === null || _aObj$common === void 0 ? void 0 : _aObj$common.version;
|
|
218
|
-
case
|
|
277
|
+
case 16:
|
|
219
278
|
// find license for vis
|
|
220
279
|
licenses["native"].licenses.forEach(function (license) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
280
|
+
var validTill = !license.validTill || license.validTill === '0000-00-00 00:00:00' || new Date(license.validTill).getTime() > now;
|
|
281
|
+
var parts = (license.product || '').split('.');
|
|
282
|
+
var validName = parts[1] === adapterName || adapterName === 'vis-2' && parts[1] === 'vis';
|
|
283
|
+
var validUuid = !uuid || !license.uuid || license.uuid === uuid;
|
|
284
|
+
var validVersion = ConfigCheckLicense.isVersionValid(version, license.version, license.invoice, adapterName);
|
|
285
|
+
// commercial license has priority over free license
|
|
286
|
+
if ((!useLicense || license.invoice !== 'free') && validTill && validName && validUuid && validVersion) {
|
|
287
|
+
useLicense = license;
|
|
226
288
|
}
|
|
289
|
+
errors.push({
|
|
290
|
+
id: license.id,
|
|
291
|
+
validName: validName,
|
|
292
|
+
validUuid: validUuid,
|
|
293
|
+
validVersion: validVersion,
|
|
294
|
+
validTill: validTill,
|
|
295
|
+
license: license
|
|
296
|
+
});
|
|
227
297
|
});
|
|
228
|
-
|
|
298
|
+
if (useLicense) {
|
|
299
|
+
errors.find(function (e) {
|
|
300
|
+
return e.id === useLicense.id;
|
|
301
|
+
}).used = true;
|
|
302
|
+
}
|
|
303
|
+
case 18:
|
|
304
|
+
return _context2.abrupt("return", errors);
|
|
229
305
|
case 19:
|
|
230
|
-
return _context2.abrupt("return", false);
|
|
231
|
-
case 20:
|
|
232
306
|
case "end":
|
|
233
307
|
return _context2.stop();
|
|
234
308
|
}
|
|
@@ -243,7 +317,7 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
243
317
|
key: "checkLicense",
|
|
244
318
|
value: function () {
|
|
245
319
|
var _checkLicense = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(license, adapterName) {
|
|
246
|
-
var uuid, _uuidObj$native2, uuidObj, version, _aObj$common2, aObj, controller, timeout, _data, response, data,
|
|
320
|
+
var uuid, _uuidObj$native2, uuidObj, version, _aObj$common2, aObj, controller, timeout, _data, response, data, data_, _error, showLicenseData, validTill, parts, _error$response, _data2, _parts;
|
|
247
321
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
248
322
|
while (1) switch (_context3.prev = _context3.next) {
|
|
249
323
|
case 0:
|
|
@@ -298,20 +372,21 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
298
372
|
// ignore
|
|
299
373
|
}
|
|
300
374
|
if (!((_data = data) !== null && _data !== void 0 && _data.error)) {
|
|
301
|
-
_context3.next =
|
|
375
|
+
_context3.next = 34;
|
|
302
376
|
break;
|
|
303
377
|
}
|
|
304
378
|
_context3.prev = 22;
|
|
305
|
-
|
|
379
|
+
data_ = ConfigCheckLicense.parseJwt(license);
|
|
380
|
+
_error = _i18n["default"].t("ra_".concat(data_.error || data.error || 'Unknown error')).replace(/^ra_/, '');
|
|
306
381
|
return _context3.abrupt("return", this.setState({
|
|
307
|
-
_error:
|
|
382
|
+
_error: _error,
|
|
308
383
|
licenseOfflineCheck: false,
|
|
309
|
-
showLicenseData:
|
|
384
|
+
showLicenseData: data_,
|
|
310
385
|
result: false,
|
|
311
386
|
running: false
|
|
312
387
|
}));
|
|
313
|
-
case
|
|
314
|
-
_context3.prev =
|
|
388
|
+
case 28:
|
|
389
|
+
_context3.prev = 28;
|
|
315
390
|
_context3.t0 = _context3["catch"](22);
|
|
316
391
|
console.log('Cannot parse license');
|
|
317
392
|
return _context3.abrupt("return", this.setState({
|
|
@@ -319,21 +394,23 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
319
394
|
result: false,
|
|
320
395
|
running: false
|
|
321
396
|
}));
|
|
322
|
-
case
|
|
323
|
-
_context3.next =
|
|
397
|
+
case 32:
|
|
398
|
+
_context3.next = 51;
|
|
324
399
|
break;
|
|
325
|
-
case
|
|
400
|
+
case 34:
|
|
326
401
|
showLicenseData = null;
|
|
327
402
|
try {
|
|
328
403
|
showLicenseData = ConfigCheckLicense.parseJwt(license);
|
|
329
|
-
} catch (e) {
|
|
404
|
+
} catch (e) {
|
|
405
|
+
// ignore
|
|
406
|
+
}
|
|
330
407
|
if (!data) {
|
|
331
|
-
_context3.next =
|
|
408
|
+
_context3.next = 50;
|
|
332
409
|
break;
|
|
333
410
|
}
|
|
334
411
|
validTill = data.validTill || data.valid_till;
|
|
335
412
|
if (!(validTill && validTill !== '0000-00-00 00:00:00' && new Date(validTill).getTime() < Date.now())) {
|
|
336
|
-
_context3.next =
|
|
413
|
+
_context3.next = 40;
|
|
337
414
|
break;
|
|
338
415
|
}
|
|
339
416
|
return _context3.abrupt("return", this.setState({
|
|
@@ -343,14 +420,27 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
343
420
|
result: false,
|
|
344
421
|
running: false
|
|
345
422
|
}));
|
|
346
|
-
case
|
|
423
|
+
case 40:
|
|
347
424
|
parts = (data.name || '').split('.');
|
|
348
|
-
if (!(parts[1] === adapterName)) {
|
|
349
|
-
_context3.next =
|
|
425
|
+
if (!(parts[1] === adapterName || parts[1] === 'vis' && adapterName === 'vis-2')) {
|
|
426
|
+
_context3.next = 49;
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
if (!(uuid && !data.uuid && adapterName === 'vis-2')) {
|
|
430
|
+
_context3.next = 44;
|
|
350
431
|
break;
|
|
351
432
|
}
|
|
433
|
+
return _context3.abrupt("return", this.setState({
|
|
434
|
+
_error: _i18n["default"].t('ra_License must be converted', data.uuid),
|
|
435
|
+
showLinkToProfile: true,
|
|
436
|
+
licenseOfflineCheck: false,
|
|
437
|
+
showLicenseData: showLicenseData,
|
|
438
|
+
result: false,
|
|
439
|
+
running: false
|
|
440
|
+
}));
|
|
441
|
+
case 44:
|
|
352
442
|
if (!(uuid && data.uuid && data.uuid !== uuid)) {
|
|
353
|
-
_context3.next =
|
|
443
|
+
_context3.next = 46;
|
|
354
444
|
break;
|
|
355
445
|
}
|
|
356
446
|
return _context3.abrupt("return", this.setState({
|
|
@@ -360,9 +450,9 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
360
450
|
result: false,
|
|
361
451
|
running: false
|
|
362
452
|
}));
|
|
363
|
-
case
|
|
453
|
+
case 46:
|
|
364
454
|
if (ConfigCheckLicense.isVersionValid(version, data.version, data.invoice, adapterName)) {
|
|
365
|
-
_context3.next =
|
|
455
|
+
_context3.next = 48;
|
|
366
456
|
break;
|
|
367
457
|
}
|
|
368
458
|
return _context3.abrupt("return", this.setState({
|
|
@@ -372,14 +462,14 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
372
462
|
result: false,
|
|
373
463
|
running: false
|
|
374
464
|
}));
|
|
375
|
-
case
|
|
465
|
+
case 48:
|
|
376
466
|
return _context3.abrupt("return", this.setState({
|
|
377
467
|
licenseOfflineCheck: false,
|
|
378
468
|
showLicenseData: showLicenseData,
|
|
379
469
|
result: true,
|
|
380
470
|
running: false
|
|
381
471
|
}));
|
|
382
|
-
case
|
|
472
|
+
case 49:
|
|
383
473
|
return _context3.abrupt("return", this.setState({
|
|
384
474
|
_error: _i18n["default"].t('ra_License for other product "%s"', data.name),
|
|
385
475
|
licenseOfflineCheck: false,
|
|
@@ -387,19 +477,16 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
387
477
|
result: false,
|
|
388
478
|
running: false
|
|
389
479
|
}));
|
|
390
|
-
case
|
|
391
|
-
_context3.next = 52;
|
|
392
|
-
break;
|
|
393
|
-
case 51:
|
|
480
|
+
case 50:
|
|
394
481
|
throw new Error('ra_Invalid answer from server');
|
|
395
|
-
case
|
|
396
|
-
_context3.next =
|
|
482
|
+
case 51:
|
|
483
|
+
_context3.next = 74;
|
|
397
484
|
break;
|
|
398
|
-
case
|
|
399
|
-
_context3.prev =
|
|
485
|
+
case 53:
|
|
486
|
+
_context3.prev = 53;
|
|
400
487
|
_context3.t1 = _context3["catch"](12);
|
|
401
488
|
if (!((_context3.t1 === null || _context3.t1 === void 0 || (_error$response = _context3.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 404)) {
|
|
402
|
-
_context3.next =
|
|
489
|
+
_context3.next = 57;
|
|
403
490
|
break;
|
|
404
491
|
}
|
|
405
492
|
return _context3.abrupt("return", this.setState({
|
|
@@ -407,81 +494,78 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
407
494
|
result: false,
|
|
408
495
|
running: false
|
|
409
496
|
}));
|
|
410
|
-
case
|
|
411
|
-
_context3.prev =
|
|
412
|
-
|
|
413
|
-
_parts = (
|
|
414
|
-
if (!(
|
|
415
|
-
_context3.next =
|
|
497
|
+
case 57:
|
|
498
|
+
_context3.prev = 57;
|
|
499
|
+
_data2 = ConfigCheckLicense.parseJwt(license);
|
|
500
|
+
_parts = (_data2.name || '').split('.');
|
|
501
|
+
if (!(_data2.valid_till && _data2.valid_till !== '0000-00-00 00:00:00' && new Date(_data2.valid_till).getTime() < Date.now())) {
|
|
502
|
+
_context3.next = 62;
|
|
416
503
|
break;
|
|
417
504
|
}
|
|
418
505
|
return _context3.abrupt("return", this.setState({
|
|
419
|
-
_error: _i18n["default"].t('ra_License expired on %s', new Date(
|
|
420
|
-
showLicenseData:
|
|
506
|
+
_error: _i18n["default"].t('ra_License expired on %s', new Date(_data2.valid_till).toLocaleString()),
|
|
507
|
+
showLicenseData: _data2,
|
|
421
508
|
licenseOfflineCheck: true,
|
|
422
509
|
running: false,
|
|
423
510
|
result: false
|
|
424
511
|
}));
|
|
425
|
-
case
|
|
512
|
+
case 62:
|
|
426
513
|
if (!(_parts[1] === adapterName)) {
|
|
427
|
-
_context3.next =
|
|
514
|
+
_context3.next = 68;
|
|
428
515
|
break;
|
|
429
516
|
}
|
|
430
|
-
if (!(uuid &&
|
|
431
|
-
_context3.next =
|
|
517
|
+
if (!(uuid && _data2.uuid && _data2.uuid !== uuid)) {
|
|
518
|
+
_context3.next = 65;
|
|
432
519
|
break;
|
|
433
520
|
}
|
|
434
521
|
return _context3.abrupt("return", this.setState({
|
|
435
|
-
_error: _i18n["default"].t('ra_Serial number (UUID) "%s" in license is for other device.',
|
|
436
|
-
showLicenseData:
|
|
522
|
+
_error: _i18n["default"].t('ra_Serial number (UUID) "%s" in license is for other device.', _data2.uuid),
|
|
523
|
+
showLicenseData: _data2,
|
|
437
524
|
licenseOfflineCheck: true,
|
|
438
525
|
result: false,
|
|
439
526
|
running: false
|
|
440
527
|
}));
|
|
441
|
-
case
|
|
442
|
-
if (ConfigCheckLicense.isVersionValid(version,
|
|
443
|
-
_context3.next =
|
|
528
|
+
case 65:
|
|
529
|
+
if (ConfigCheckLicense.isVersionValid(version, _data2.version, _data2.invoice, adapterName)) {
|
|
530
|
+
_context3.next = 67;
|
|
444
531
|
break;
|
|
445
532
|
}
|
|
446
533
|
return _context3.abrupt("return", this.setState({
|
|
447
|
-
_error: _i18n["default"].t('ra_License is for version %s, but required version is %s',
|
|
534
|
+
_error: _i18n["default"].t('ra_License is for version %s, but required version is %s', _data2.version, this.props.schema.version),
|
|
448
535
|
licenseOfflineCheck: true,
|
|
449
|
-
showLicenseData:
|
|
536
|
+
showLicenseData: _data2,
|
|
450
537
|
result: false,
|
|
451
538
|
running: false
|
|
452
539
|
}));
|
|
453
|
-
case
|
|
540
|
+
case 67:
|
|
454
541
|
return _context3.abrupt("return", this.setState({
|
|
455
542
|
running: false,
|
|
456
543
|
result: true,
|
|
457
544
|
licenseOfflineCheck: true,
|
|
458
|
-
showLicenseData:
|
|
545
|
+
showLicenseData: _data2
|
|
459
546
|
}));
|
|
460
|
-
case
|
|
547
|
+
case 68:
|
|
461
548
|
return _context3.abrupt("return", this.setState({
|
|
462
|
-
_error: _i18n["default"].t('ra_License for other product "%s"',
|
|
549
|
+
_error: _i18n["default"].t('ra_License for other product "%s"', _data2.name),
|
|
463
550
|
licenseOfflineCheck: true,
|
|
464
|
-
showLicenseData:
|
|
551
|
+
showLicenseData: _data2,
|
|
465
552
|
result: false,
|
|
466
553
|
running: false
|
|
467
554
|
}));
|
|
468
|
-
case
|
|
469
|
-
_context3.
|
|
470
|
-
|
|
471
|
-
case 74:
|
|
472
|
-
_context3.prev = 74;
|
|
473
|
-
_context3.t2 = _context3["catch"](58);
|
|
555
|
+
case 71:
|
|
556
|
+
_context3.prev = 71;
|
|
557
|
+
_context3.t2 = _context3["catch"](57);
|
|
474
558
|
return _context3.abrupt("return", this.setState({
|
|
475
559
|
_error: _i18n["default"].t('ra_Cannot decode license'),
|
|
476
560
|
result: false,
|
|
477
561
|
licenseOfflineCheck: true,
|
|
478
562
|
running: false
|
|
479
563
|
}));
|
|
480
|
-
case
|
|
564
|
+
case 74:
|
|
481
565
|
case "end":
|
|
482
566
|
return _context3.stop();
|
|
483
567
|
}
|
|
484
|
-
}, _callee3, this, [[12,
|
|
568
|
+
}, _callee3, this, [[12, 53], [22, 28], [57, 71]]);
|
|
485
569
|
}));
|
|
486
570
|
function checkLicense(_x2, _x3) {
|
|
487
571
|
return _checkLicense.apply(this, arguments);
|
|
@@ -503,19 +587,27 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
503
587
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
504
588
|
while (1) switch (_context4.prev = _context4.next) {
|
|
505
589
|
case 0:
|
|
506
|
-
_this3.setState({
|
|
507
|
-
askForUpdate: false
|
|
508
|
-
});
|
|
509
590
|
if (!isYes) {
|
|
510
|
-
_context4.next =
|
|
591
|
+
_context4.next = 8;
|
|
511
592
|
break;
|
|
512
593
|
}
|
|
594
|
+
_this3.setState({
|
|
595
|
+
askForUpdate: false
|
|
596
|
+
});
|
|
513
597
|
_context4.next = 4;
|
|
514
|
-
return ConfigCheckLicense.updateLicenses();
|
|
598
|
+
return ConfigCheckLicense.updateLicenses(_this3.props.socket);
|
|
515
599
|
case 4:
|
|
516
600
|
_context4.next = 6;
|
|
517
601
|
return _this3._onClick(true);
|
|
518
602
|
case 6:
|
|
603
|
+
_context4.next = 9;
|
|
604
|
+
break;
|
|
605
|
+
case 8:
|
|
606
|
+
_this3.setState({
|
|
607
|
+
askForUpdate: false,
|
|
608
|
+
running: false
|
|
609
|
+
});
|
|
610
|
+
case 9:
|
|
519
611
|
case "end":
|
|
520
612
|
return _context4.stop();
|
|
521
613
|
}
|
|
@@ -531,7 +623,7 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
531
623
|
key: "_onClick",
|
|
532
624
|
value: function () {
|
|
533
625
|
var _onClick2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(secondRun) {
|
|
534
|
-
var adapterName, license;
|
|
626
|
+
var adapterName, license, licenses;
|
|
535
627
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
536
628
|
while (1) switch (_context5.prev = _context5.next) {
|
|
537
629
|
case 0:
|
|
@@ -540,44 +632,51 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
540
632
|
running: true
|
|
541
633
|
});
|
|
542
634
|
if (!this.props.data.useLicenseManager) {
|
|
543
|
-
_context5.next =
|
|
635
|
+
_context5.next = 13;
|
|
544
636
|
break;
|
|
545
637
|
}
|
|
546
638
|
_context5.next = 5;
|
|
547
639
|
return this.findInLicenseManager(adapterName);
|
|
548
640
|
case 5:
|
|
549
|
-
|
|
641
|
+
licenses = _context5.sent;
|
|
642
|
+
license = licenses.find(function (li) {
|
|
643
|
+
return li.used;
|
|
644
|
+
});
|
|
645
|
+
if (license) {
|
|
646
|
+
license = license.license.json;
|
|
647
|
+
}
|
|
550
648
|
if (!(!license && !secondRun)) {
|
|
551
|
-
_context5.next =
|
|
649
|
+
_context5.next = 11;
|
|
552
650
|
break;
|
|
553
651
|
}
|
|
554
|
-
// no suitable license found in license manager
|
|
652
|
+
// no suitable license found in the license manager
|
|
555
653
|
// should we read all licenses again?
|
|
556
654
|
this.setState({
|
|
557
655
|
askForUpdate: true
|
|
558
656
|
});
|
|
559
657
|
return _context5.abrupt("return");
|
|
560
|
-
case 9:
|
|
561
|
-
_context5.next = 12;
|
|
562
|
-
break;
|
|
563
658
|
case 11:
|
|
659
|
+
_context5.next = 14;
|
|
660
|
+
break;
|
|
661
|
+
case 13:
|
|
564
662
|
license = this.props.data.license;
|
|
565
|
-
case
|
|
663
|
+
case 14:
|
|
566
664
|
if (!license) {
|
|
567
|
-
_context5.next =
|
|
665
|
+
_context5.next = 19;
|
|
568
666
|
break;
|
|
569
667
|
}
|
|
570
|
-
_context5.next =
|
|
668
|
+
_context5.next = 17;
|
|
571
669
|
return this.checkLicense(license, adapterName, this.props.schema.uuid);
|
|
572
|
-
case 15:
|
|
573
|
-
_context5.next = 18;
|
|
574
|
-
break;
|
|
575
670
|
case 17:
|
|
671
|
+
_context5.next = 20;
|
|
672
|
+
break;
|
|
673
|
+
case 19:
|
|
576
674
|
if (this.props.data.useLicenseManager) {
|
|
577
675
|
this.setState({
|
|
578
676
|
_error: _i18n["default"].t('ra_Suitable license not found in license manager'),
|
|
579
677
|
result: false,
|
|
580
|
-
running: false
|
|
678
|
+
running: false,
|
|
679
|
+
allLicenses: licenses
|
|
581
680
|
});
|
|
582
681
|
} else {
|
|
583
682
|
// this case could not happen
|
|
@@ -587,7 +686,7 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
587
686
|
running: false
|
|
588
687
|
});
|
|
589
688
|
}
|
|
590
|
-
case
|
|
689
|
+
case 20:
|
|
591
690
|
case "end":
|
|
592
691
|
return _context5.stop();
|
|
593
692
|
}
|
|
@@ -600,7 +699,8 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
600
699
|
}()
|
|
601
700
|
}, {
|
|
602
701
|
key: "renderItem",
|
|
603
|
-
value: function renderItem(error, disabled, defaultValue
|
|
702
|
+
value: function renderItem( /* error, disabled, defaultValue */
|
|
703
|
+
) {
|
|
604
704
|
var _this4 = this;
|
|
605
705
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
606
706
|
className: this.props.classes.fullWidth
|
|
@@ -609,7 +709,7 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
609
709
|
color: this.props.schema.color || 'primary',
|
|
610
710
|
className: this.props.classes.fullWidth,
|
|
611
711
|
disabled: !this.props.data.license && !this.props.data.useLicenseManager || this.state.running,
|
|
612
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(
|
|
712
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Send, null),
|
|
613
713
|
onClick: function onClick() {
|
|
614
714
|
return _this4._onClick();
|
|
615
715
|
}
|
|
@@ -673,15 +773,13 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
673
773
|
return new Promise(function (resolve, reject) {
|
|
674
774
|
socket.getRawSocket().emit('updateLicenses', null, null, function (err, licenses) {
|
|
675
775
|
if (err === 'permissionError') {
|
|
676
|
-
reject(_i18n["default"].t('
|
|
776
|
+
reject(_i18n["default"].t('ra_May not trigger "updateLicenses"'));
|
|
777
|
+
} else if (err && err.error) {
|
|
778
|
+
reject(_i18n["default"].t(err.error));
|
|
779
|
+
} else if (err) {
|
|
780
|
+
reject(_i18n["default"].t(err));
|
|
677
781
|
} else {
|
|
678
|
-
|
|
679
|
-
reject(_i18n["default"].t(err.error));
|
|
680
|
-
} else if (err) {
|
|
681
|
-
reject(_i18n["default"].t(err));
|
|
682
|
-
} else {
|
|
683
|
-
resolve(licenses);
|
|
684
|
-
}
|
|
782
|
+
resolve(licenses);
|
|
685
783
|
}
|
|
686
784
|
});
|
|
687
785
|
});
|