@iobroker/json-config 6.13.5 → 6.13.7
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/build/JsonConfig.js +1 -1
- package/build/JsonConfigComponent/ConfigAccordion.js +2 -2
- package/build/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/build/JsonConfigComponent/ConfigAlive.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigAlive.js +1 -1
- package/build/JsonConfigComponent/ConfigAlive.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCRON.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigCRON.js +1 -1
- package/build/JsonConfigComponent/ConfigCRON.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigCertificateSelect.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigCertificates.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigCheckLicense.js +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigChip.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigColor.js +1 -2
- package/build/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigDatePicker.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigDeviceManager.js +1 -1
- package/build/JsonConfigComponent/ConfigDeviceManager.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFile.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigFile.js +1 -1
- package/build/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFileSelector.js +1 -2
- package/build/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/build/JsonConfigComponent/ConfigFunc.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigFunc.js +1 -1
- package/build/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +1 -0
- package/build/JsonConfigComponent/ConfigGeneric.js +1 -3
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIP.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigImageSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigImageUpload.js +1 -1
- package/build/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/build/JsonConfigComponent/ConfigInstanceSelect.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigInterface.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigJsonEditor.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigObjectId.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigObjectId.js +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPanel.js +3 -2
- package/build/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPassword.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigPattern.js +2 -3
- package/build/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/build/JsonConfigComponent/ConfigRoom.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigRoom.js +1 -1
- package/build/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigSelect.js +2 -2
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigSendto.js +1 -3
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigSetState.js +1 -2
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSlider.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigStaticDivider.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigStaticDivider.js +1 -1
- package/build/JsonConfigComponent/ConfigStaticDivider.js.map +1 -1
- package/build/JsonConfigComponent/ConfigStaticHeader.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigStaticImage.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigStaticText.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigStaticText.js +1 -1
- package/build/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +1 -1
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTabs.js +1 -1
- package/build/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/build/JsonConfigComponent/ConfigText.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigTextSendTo.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigTextSendTo.js +2 -3
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTimePicker.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigTopic.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigUUID.js +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUser.d.ts +2 -2
- package/build/JsonConfigComponent/ConfigUser.js +1 -2
- package/build/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/package.json +5 -2
- package/build/JsonConfigComponent/DeviceManager/Communication.d.ts +0 -63
- package/build/JsonConfigComponent/DeviceManager/Communication.js +0 -247
- package/build/JsonConfigComponent/DeviceManager/Communication.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +0 -11
- package/build/JsonConfigComponent/DeviceManager/DeviceActionButton.js +0 -10
- package/build/JsonConfigComponent/DeviceManager/DeviceActionButton.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +0 -53
- package/build/JsonConfigComponent/DeviceManager/DeviceCard.js +0 -308
- package/build/JsonConfigComponent/DeviceManager/DeviceCard.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +0 -45
- package/build/JsonConfigComponent/DeviceManager/DeviceControl.js +0 -119
- package/build/JsonConfigComponent/DeviceManager/DeviceControl.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +0 -12
- package/build/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +0 -65
- package/build/JsonConfigComponent/DeviceManager/DeviceImageUpload.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/DeviceList.d.ts +0 -51
- package/build/JsonConfigComponent/DeviceManager/DeviceList.js +0 -235
- package/build/JsonConfigComponent/DeviceManager/DeviceList.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +0 -13
- package/build/JsonConfigComponent/DeviceManager/DeviceStatus.js +0 -106
- package/build/JsonConfigComponent/DeviceManager/DeviceStatus.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +0 -7
- package/build/JsonConfigComponent/DeviceManager/InstanceActionButton.js +0 -11
- package/build/JsonConfigComponent/DeviceManager/InstanceActionButton.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +0 -11
- package/build/JsonConfigComponent/DeviceManager/JsonConfig.js +0 -66
- package/build/JsonConfigComponent/DeviceManager/JsonConfig.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +0 -10
- package/build/JsonConfigComponent/DeviceManager/TooltipButton.js +0 -17
- package/build/JsonConfigComponent/DeviceManager/TooltipButton.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/Utils.d.ts +0 -12
- package/build/JsonConfigComponent/DeviceManager/Utils.js +0 -150
- package/build/JsonConfigComponent/DeviceManager/Utils.js.map +0 -1
- package/build/JsonConfigComponent/DeviceManager/i18n/de.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/en.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/es.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/fr.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/it.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/nl.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/pl.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/pt.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/ru.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/uk.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +0 -21
- package/build/JsonConfigComponent/DeviceManager/index.d.ts +0 -2
- package/build/JsonConfigComponent/DeviceManager/index.js +0 -3
- package/build/JsonConfigComponent/DeviceManager/index.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Components/ColorPicker.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Components/ColorPicker.js +0 -3
- package/build/JsonConfigComponent/wrapper/Components/ColorPicker.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Components/Icon.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Components/Icon.js +0 -3
- package/build/JsonConfigComponent/wrapper/Components/Icon.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Components/TextWithIcon.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Components/TextWithIcon.js +0 -3
- package/build/JsonConfigComponent/wrapper/Components/TextWithIcon.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Components/UploadImage.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Components/UploadImage.js +0 -3
- package/build/JsonConfigComponent/wrapper/Components/UploadImage.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Components/Utils.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Components/Utils.js +0 -3
- package/build/JsonConfigComponent/wrapper/Components/Utils.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Dialogs/Confirm.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Dialogs/Confirm.js +0 -3
- package/build/JsonConfigComponent/wrapper/Dialogs/Confirm.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Dialogs/Cron.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Dialogs/Cron.js +0 -3
- package/build/JsonConfigComponent/wrapper/Dialogs/Cron.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Dialogs/Error.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Dialogs/Error.js +0 -3
- package/build/JsonConfigComponent/wrapper/Dialogs/Error.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Dialogs/Message.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Dialogs/Message.js +0 -3
- package/build/JsonConfigComponent/wrapper/Dialogs/Message.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Dialogs/SelectFile.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Dialogs/SelectFile.js +0 -3
- package/build/JsonConfigComponent/wrapper/Dialogs/SelectFile.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/Dialogs/SelectID.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/Dialogs/SelectID.js +0 -3
- package/build/JsonConfigComponent/wrapper/Dialogs/SelectID.js.map +0 -1
- package/build/JsonConfigComponent/wrapper/icons/IconCopy.d.ts +0 -2
- package/build/JsonConfigComponent/wrapper/icons/IconCopy.js +0 -3
- package/build/JsonConfigComponent/wrapper/icons/IconCopy.js.map +0 -1
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { Backdrop, Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, LinearProgress, Snackbar, } from '@mui/material';
|
|
3
|
-
import { getTranslation } from './Utils';
|
|
4
|
-
import JsonConfig from './JsonConfig';
|
|
5
|
-
/**
|
|
6
|
-
* Device List Component
|
|
7
|
-
* @param {object} params - Component parameters
|
|
8
|
-
* @param {object} params.socket - socket object
|
|
9
|
-
* @param {string} params.selectedInstance - Selected instance
|
|
10
|
-
* @returns {*[]} - Array of device cards
|
|
11
|
-
*/
|
|
12
|
-
class Communication extends Component {
|
|
13
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
14
|
-
instanceHandler;
|
|
15
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
16
|
-
deviceHandler;
|
|
17
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
18
|
-
controlHandler;
|
|
19
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
20
|
-
controlStateHandler;
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
// @ts-expect-error
|
|
24
|
-
this.state = {
|
|
25
|
-
showSpinner: false,
|
|
26
|
-
showToast: null,
|
|
27
|
-
message: null,
|
|
28
|
-
confirm: null,
|
|
29
|
-
form: null,
|
|
30
|
-
progress: null,
|
|
31
|
-
};
|
|
32
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
33
|
-
this.instanceHandler = action => () => this.sendActionToInstance('dm:instanceAction', { actionId: action.id });
|
|
34
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
35
|
-
this.deviceHandler = (deviceId, action, refresh) => () => this.sendActionToInstance('dm:deviceAction', { deviceId, actionId: action.id }, refresh);
|
|
36
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
37
|
-
this.controlHandler = (deviceId, control, state) => () => this.sendControlToInstance('dm:deviceControl', { deviceId, controlId: control.id, state });
|
|
38
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
39
|
-
this.controlStateHandler = (deviceId, control) => () => this.sendControlToInstance('dm:deviceControlState', { deviceId, controlId: control.id });
|
|
40
|
-
this.props.registerHandler && this.props.registerHandler(() => this.loadData());
|
|
41
|
-
}
|
|
42
|
-
// eslint-disable-next-line class-methods-use-this
|
|
43
|
-
loadData() {
|
|
44
|
-
console.error('loadData not implemented');
|
|
45
|
-
}
|
|
46
|
-
sendActionToInstance = (command, messageToSend, refresh) => {
|
|
47
|
-
const send = async () => {
|
|
48
|
-
this.setState({ showSpinner: true });
|
|
49
|
-
/** @type {object} */
|
|
50
|
-
const response = await this.props.socket.sendTo(this.props.selectedInstance, command, messageToSend);
|
|
51
|
-
/** @type {string} */
|
|
52
|
-
const type = response.type;
|
|
53
|
-
console.log(`Response: ${response.type}`);
|
|
54
|
-
switch (type) {
|
|
55
|
-
case 'message':
|
|
56
|
-
console.log(`Message received: ${response.message}`);
|
|
57
|
-
if (response.message) {
|
|
58
|
-
this.setState({
|
|
59
|
-
message: {
|
|
60
|
-
message: response.message,
|
|
61
|
-
handleClose: () => this.setState({ message: null }, () => this.sendActionToInstance('dm:actionProgress', { origin: response.origin })),
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case 'confirm':
|
|
67
|
-
console.log(`Confirm received: ${response.confirm}`);
|
|
68
|
-
if (response.confirm) {
|
|
69
|
-
this.setState({
|
|
70
|
-
confirm: {
|
|
71
|
-
message: response.confirm,
|
|
72
|
-
handleClose: (confirm) => this.setState({ confirm: null }, () => this.sendActionToInstance('dm:actionProgress', {
|
|
73
|
-
origin: response.origin,
|
|
74
|
-
confirm,
|
|
75
|
-
})),
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
break;
|
|
80
|
-
case 'form':
|
|
81
|
-
console.log('Form received');
|
|
82
|
-
if (response.form) {
|
|
83
|
-
this.setState({
|
|
84
|
-
form: {
|
|
85
|
-
...response.form,
|
|
86
|
-
handleClose: (data) => this.setState({ form: null }, () => {
|
|
87
|
-
console.log(`Form ${JSON.stringify(data)}`);
|
|
88
|
-
this.sendActionToInstance('dm:actionProgress', {
|
|
89
|
-
origin: response.origin,
|
|
90
|
-
data,
|
|
91
|
-
});
|
|
92
|
-
}),
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
break;
|
|
97
|
-
case 'progress':
|
|
98
|
-
if (response.progress) {
|
|
99
|
-
if (this.state.progress) {
|
|
100
|
-
const progress = { ...this.state.progress, ...response.progress };
|
|
101
|
-
this.setState({ progress });
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
this.setState({ progress: response.progress });
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
this.sendActionToInstance('dm:actionProgress', { origin: response.origin });
|
|
108
|
-
break;
|
|
109
|
-
case 'result':
|
|
110
|
-
console.log('Response content', response.result);
|
|
111
|
-
if (response.result.refresh) {
|
|
112
|
-
if (response.result.refresh === true) {
|
|
113
|
-
this.loadData();
|
|
114
|
-
console.log('Refreshing all');
|
|
115
|
-
}
|
|
116
|
-
else if (response.result.refresh === 'instance') {
|
|
117
|
-
console.log(`Refreshing instance infos: ${this.props.selectedInstance}`);
|
|
118
|
-
}
|
|
119
|
-
else if (response.result.refresh === 'device') {
|
|
120
|
-
if (refresh) {
|
|
121
|
-
console.log(`Refreshing device infos: ${this.props.selectedInstance}`);
|
|
122
|
-
refresh();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
console.log('Not refreshing anything');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (response.result.error) {
|
|
130
|
-
console.error(`Error: ${response.result.error}`);
|
|
131
|
-
this.setState({ showToast: response.result.error.message });
|
|
132
|
-
}
|
|
133
|
-
this.setState({ showSpinner: false });
|
|
134
|
-
break;
|
|
135
|
-
default:
|
|
136
|
-
console.log(`Unknown response type: ${type}`);
|
|
137
|
-
this.setState({ showSpinner: false });
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
send().catch(console.error);
|
|
142
|
-
};
|
|
143
|
-
sendControlToInstance = async (command, messageToSend) => {
|
|
144
|
-
const response = await this.props.socket.sendTo(this.props.selectedInstance, command, messageToSend);
|
|
145
|
-
const type = response.type;
|
|
146
|
-
console.log(`Response: ${response.type}`);
|
|
147
|
-
if (response.type === 'result') {
|
|
148
|
-
console.log('Response content', response.result);
|
|
149
|
-
if (response.result.error) {
|
|
150
|
-
console.error(`Error: ${response.result.error}`);
|
|
151
|
-
this.setState({ showToast: response.result.error.message });
|
|
152
|
-
}
|
|
153
|
-
else if (response.result.state !== undefined) {
|
|
154
|
-
return response.result.state;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
console.warn('Unexpected response type', type);
|
|
159
|
-
}
|
|
160
|
-
return null;
|
|
161
|
-
};
|
|
162
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
163
|
-
loadDevices() {
|
|
164
|
-
return this.props.socket.sendTo(this.props.selectedInstance, 'dm:listDevices');
|
|
165
|
-
}
|
|
166
|
-
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
167
|
-
loadInstanceInfos() {
|
|
168
|
-
return this.props.socket.sendTo(this.props.selectedInstance, 'dm:instanceInfo');
|
|
169
|
-
}
|
|
170
|
-
renderMessageDialog() {
|
|
171
|
-
if (!this.state.message) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
return React.createElement(Dialog, { open: !0, onClose: () => this.state.message?.handleClose(), hideBackdrop: true, "aria-describedby": "message-dialog-description" },
|
|
175
|
-
React.createElement(DialogContent, null,
|
|
176
|
-
React.createElement(DialogContentText, { id: "message-dialog-description" }, this.state.message?.message)),
|
|
177
|
-
React.createElement(DialogActions, null,
|
|
178
|
-
React.createElement(Button, { onClick: () => this.state.message?.handleClose(), autoFocus: true }, getTranslation('okButtonText'))));
|
|
179
|
-
}
|
|
180
|
-
renderConfirmDialog() {
|
|
181
|
-
if (!this.state.confirm) {
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
return React.createElement(Dialog, { open: !0, onClose: () => this.state.confirm?.handleClose(), hideBackdrop: true, "aria-describedby": "confirm-dialog-description" },
|
|
185
|
-
React.createElement(DialogContent, null,
|
|
186
|
-
React.createElement(DialogContentText, { id: "confirm-dialog-description" }, getTranslation(this.state.confirm?.message))),
|
|
187
|
-
React.createElement(DialogActions, null,
|
|
188
|
-
React.createElement(Button, { variant: "contained", color: "primary", onClick: () => this.state.confirm?.handleClose(true), autoFocus: true }, getTranslation('yesButtonText')),
|
|
189
|
-
React.createElement(Button, { variant: "contained",
|
|
190
|
-
// @ts-expect-error
|
|
191
|
-
color: "grey", onClick: () => this.state.confirm?.handleClose(false), autoFocus: true, hideBackdrop: true }, getTranslation('noButtonText'))));
|
|
192
|
-
}
|
|
193
|
-
renderSnackbar() {
|
|
194
|
-
return React.createElement(Snackbar, { open: !!this.state.showToast, autoHideDuration: 6000, onClose: () => this.setState({ showToast: null }), message: this.state.showToast });
|
|
195
|
-
}
|
|
196
|
-
renderFormDialog() {
|
|
197
|
-
if (!this.state.form || !this.state.form.schema || !this.state.form.data) {
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
return React.createElement(Dialog, { open: !0, onClose: () => this.state.form?.handleClose && this.state.form.handleClose(), hideBackdrop: true },
|
|
201
|
-
this.state.form?.title ? React.createElement(DialogTitle, null, getTranslation(this.state.form?.title)) : null,
|
|
202
|
-
React.createElement(DialogContent, null,
|
|
203
|
-
React.createElement(JsonConfig, { instanceId: this.props.selectedInstance, schema: this.state.form.schema, data: this.state.form.data, socket: this.props.socket, onChange: (data) => {
|
|
204
|
-
console.log('handleFormChange', { data });
|
|
205
|
-
const form = { ...this.state.form };
|
|
206
|
-
if (form) {
|
|
207
|
-
form.data = data;
|
|
208
|
-
this.setState({ form });
|
|
209
|
-
}
|
|
210
|
-
} })),
|
|
211
|
-
React.createElement(DialogActions, null,
|
|
212
|
-
React.createElement(Button, { variant: "contained", color: "primary", onClick: () => this.state.form?.handleClose && this.state.form.handleClose(this.state.form?.data), autoFocus: true }, getTranslation('okButtonText')),
|
|
213
|
-
React.createElement(Button, { variant: "contained",
|
|
214
|
-
// @ts-expect-error
|
|
215
|
-
color: "grey", onClick: () => this.state.form?.handleClose && this.state.form.handleClose(), hideBackdrop: true }, getTranslation('cancelButtonText'))));
|
|
216
|
-
}
|
|
217
|
-
renderProgressDialog() {
|
|
218
|
-
if (!this.state.progress?.open) {
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
return React.createElement(Dialog, { open: !0, onClose: () => { }, hideBackdrop: true },
|
|
222
|
-
React.createElement(LinearProgress, { variant: "determinate", value: this.state.progress?.progress || 0 }));
|
|
223
|
-
}
|
|
224
|
-
// eslint-disable-next-line class-methods-use-this
|
|
225
|
-
renderContent() {
|
|
226
|
-
return null;
|
|
227
|
-
}
|
|
228
|
-
renderSpinner() {
|
|
229
|
-
if (!this.state.showSpinner && !this.state.progress?.open && !this.state.message && !this.state.confirm && !this.state.form) {
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
return React.createElement(Backdrop, { style: { zIndex: 1000 }, open: !0 },
|
|
233
|
-
React.createElement(CircularProgress, null));
|
|
234
|
-
}
|
|
235
|
-
render() {
|
|
236
|
-
return React.createElement(React.Fragment, null,
|
|
237
|
-
this.renderSnackbar(),
|
|
238
|
-
this.renderContent(),
|
|
239
|
-
this.renderSpinner(),
|
|
240
|
-
this.renderConfirmDialog(),
|
|
241
|
-
this.renderMessageDialog(),
|
|
242
|
-
this.renderFormDialog(),
|
|
243
|
-
this.renderProgressDialog());
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
export default Communication;
|
|
247
|
-
//# sourceMappingURL=Communication.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Communication.js","sourceRoot":"./src/","sources":["JsonConfigComponent/DeviceManager/Communication.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACH,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,E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KAAK,CAAC,QAAQ,EAAE,QAAQ,IAAI,CAAC,GAAI,CAC9E,CAAC;IACd,CAAC;IAED,kDAAkD;IAClD,aAAa;QACT,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,aAAa;QACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC1H,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,oBAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,oBAAC,gBAAgB,OAAG,CACb,CAAC;IAChB,CAAC;IAED,MAAM;QACF,OAAO;YACF,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,CAAC,oBAAoB,EAAE,CAC7B,CAAC;IACR,CAAC;CACJ;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ActionBase } from '@iobroker/dm-utils/build/types/base';
|
|
3
|
-
interface DeviceActionButtonProps {
|
|
4
|
-
deviceId: string;
|
|
5
|
-
action: any;
|
|
6
|
-
refresh: () => void;
|
|
7
|
-
deviceHandler: (deviceId: string, action: ActionBase<'api'>, refresh: () => void) => () => void;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export default function DeviceActionButton(props: DeviceActionButtonProps): React.JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import TooltipButton from './TooltipButton.js';
|
|
3
|
-
import { renderIcon, getTranslation } from './Utils.js';
|
|
4
|
-
export default function DeviceActionButton(props) {
|
|
5
|
-
const { deviceId, action, refresh, deviceHandler, disabled, } = props;
|
|
6
|
-
const tooltip = getTranslation(action.description);
|
|
7
|
-
const icon = renderIcon(action);
|
|
8
|
-
return React.createElement(TooltipButton, { label: action.label || (icon ? null : action.id), tooltip: tooltip, disabled: disabled || action.disabled, Icon: icon, onClick: deviceHandler(deviceId, action, refresh) });
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=DeviceActionButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceActionButton.js","sourceRoot":"./src/","sources":["JsonConfigComponent/DeviceManager/DeviceActionButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUxD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAA8B;IACrE,MAAM,EACF,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,GACrD,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAEhC,OAAO,oBAAC,aAAa,IACjB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAChD,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,EACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,GACnD,CAAC;AACP,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { Connection } from '@iobroker/socket-client';
|
|
3
|
-
import { DeviceDetails, DeviceInfo } from '@iobroker/dm-utils';
|
|
4
|
-
import { ActionBase, ControlBase, ControlState } from '@iobroker/dm-utils/build/types/base';
|
|
5
|
-
interface DeviceCardProps {
|
|
6
|
-
title?: string;
|
|
7
|
-
id: string;
|
|
8
|
-
device: DeviceInfo;
|
|
9
|
-
instanceId: string;
|
|
10
|
-
socket: Connection;
|
|
11
|
-
uploadImagesToInstance?: string;
|
|
12
|
-
deviceHandler: (deviceId: string, action: ActionBase<'api'>, refresh: () => void) => () => void;
|
|
13
|
-
controlHandler: (deviceId: string, control: ControlBase, state: ControlState) => () => Promise<ioBroker.State | null>;
|
|
14
|
-
controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;
|
|
15
|
-
smallCards?: boolean;
|
|
16
|
-
alive: boolean;
|
|
17
|
-
}
|
|
18
|
-
interface DeviceCardState {
|
|
19
|
-
open: boolean;
|
|
20
|
-
details: DeviceDetails | null;
|
|
21
|
-
data: Record<string, any>;
|
|
22
|
-
icon: string | undefined;
|
|
23
|
-
showControlDialog: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Device Card Component
|
|
27
|
-
*/
|
|
28
|
-
declare class DeviceCard extends Component<DeviceCardProps, DeviceCardState> {
|
|
29
|
-
constructor(props: DeviceCardProps);
|
|
30
|
-
fetchIcon(): Promise<void>;
|
|
31
|
-
componentDidMount(): void;
|
|
32
|
-
/**
|
|
33
|
-
* Load the device details
|
|
34
|
-
*/
|
|
35
|
-
loadDetails(): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Refresh the device details
|
|
38
|
-
*/
|
|
39
|
-
refresh: () => void;
|
|
40
|
-
/**
|
|
41
|
-
* Copy the device ID to the clipboard
|
|
42
|
-
* @returns {void}
|
|
43
|
-
*/
|
|
44
|
-
copyToClipboard: () => Promise<void>;
|
|
45
|
-
renderDialog(): React.JSX.Element;
|
|
46
|
-
renderControlDialog(): React.JSX.Element;
|
|
47
|
-
renderControls(): React.JSX.Element;
|
|
48
|
-
renderActions(): React.JSX.Element[];
|
|
49
|
-
renderSmall(): React.JSX.Element;
|
|
50
|
-
renderBig(): React.JSX.Element;
|
|
51
|
-
render(): React.JSX.Element;
|
|
52
|
-
}
|
|
53
|
-
export default DeviceCard;
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import { Button, Typography, Dialog, DialogActions, DialogContent, IconButton, Fab, DialogTitle, Card, CardActions, CardHeader, CardContent, Paper, } from '@mui/material';
|
|
3
|
-
import { MoreVert as MoreVertIcon, VideogameAsset as ControlIcon, Close as CloseIcon, } from '@mui/icons-material';
|
|
4
|
-
import Utils from '@/Utils';
|
|
5
|
-
import I18n from '@/JsonConfigComponent/wrapper/i18n';
|
|
6
|
-
import { Icon } from '@iobroker/adapter-react-v5';
|
|
7
|
-
import DeviceActionButton from './DeviceActionButton';
|
|
8
|
-
import DeviceControlComponent from './DeviceControl';
|
|
9
|
-
import DeviceStatus from './DeviceStatus';
|
|
10
|
-
import JsonConfig from './JsonConfig';
|
|
11
|
-
import DeviceImageUpload from './DeviceImageUpload';
|
|
12
|
-
import { getTranslation } from './Utils';
|
|
13
|
-
const NoImageIcon = (props) => React.createElement("svg", { viewBox: "0 0 24 24", width: "24", height: "24", style: props.style, className: props.className },
|
|
14
|
-
React.createElement("path", { fill: "currentColor", d: "M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z" }));
|
|
15
|
-
function getText(text) {
|
|
16
|
-
if (typeof text === 'object') {
|
|
17
|
-
return text[I18n.getLanguage()] || text.en;
|
|
18
|
-
}
|
|
19
|
-
return text;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Device Card Component
|
|
23
|
-
*/
|
|
24
|
-
class DeviceCard extends Component {
|
|
25
|
-
constructor(props) {
|
|
26
|
-
super(props);
|
|
27
|
-
this.state = {
|
|
28
|
-
open: false,
|
|
29
|
-
details: null,
|
|
30
|
-
data: {},
|
|
31
|
-
icon: props.device.icon,
|
|
32
|
-
showControlDialog: false,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
async fetchIcon() {
|
|
36
|
-
if (!this.props.device.icon) {
|
|
37
|
-
// try to load the icon from file storage
|
|
38
|
-
const fileName = `${this.props.device.manufacturer ? `${this.props.device.manufacturer}_` : ''}${this.props.device.model ? this.props.device.model : this.props.device.id}`;
|
|
39
|
-
try {
|
|
40
|
-
const file = await this.props.socket.readFile(this.props.instanceId.replace('system.adapter.', ''), `${fileName}.webp`, true);
|
|
41
|
-
this.setState({ icon: `data:image/${file.mimeType},${file}` });
|
|
42
|
-
// const response = await fetch(url);
|
|
43
|
-
// if (response.ok) {
|
|
44
|
-
// const blob = await response.blob();
|
|
45
|
-
// const reader = new FileReader();
|
|
46
|
-
// reader.onloadend = () => {
|
|
47
|
-
// setIcon(reader.result);
|
|
48
|
-
// };
|
|
49
|
-
// reader.readAsDataURL(blob);
|
|
50
|
-
// } else {
|
|
51
|
-
// throw new Error('Response not ok');
|
|
52
|
-
// }
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
this.state.icon && this.setState({ icon: '' });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
componentDidMount() {
|
|
60
|
-
this.fetchIcon()
|
|
61
|
-
.catch(e => console.error(e));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Load the device details
|
|
65
|
-
*/
|
|
66
|
-
async loadDetails() {
|
|
67
|
-
console.log(`Loading device details for ${this.props.device.id}... from ${this.props.instanceId}`);
|
|
68
|
-
const details = await this.props.socket.sendTo(this.props.instanceId, 'dm:deviceDetails', this.props.device.id);
|
|
69
|
-
console.log(`Got device details for ${this.props.device.id}:`, details);
|
|
70
|
-
this.setState({ details, data: details?.data || {} });
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Refresh the device details
|
|
74
|
-
*/
|
|
75
|
-
refresh = () => {
|
|
76
|
-
this.setState({ details: null });
|
|
77
|
-
this.loadDetails().catch(console.error);
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Copy the device ID to the clipboard
|
|
81
|
-
* @returns {void}
|
|
82
|
-
*/
|
|
83
|
-
copyToClipboard = async () => {
|
|
84
|
-
const textToCopy = this.props.device.id;
|
|
85
|
-
Utils.copyToClipboard(textToCopy);
|
|
86
|
-
alert(`${getTranslation('copied')} ${textToCopy} ${getTranslation('toClipboard')}!`);
|
|
87
|
-
};
|
|
88
|
-
renderDialog() {
|
|
89
|
-
if (!this.state.open || !this.state.details) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return React.createElement(Dialog, { open: !0, maxWidth: "md", onClose: () => this.setState({ open: false }) },
|
|
93
|
-
React.createElement(DialogContent, null,
|
|
94
|
-
React.createElement(JsonConfig, { instanceId: this.props.instanceId, socket: this.props.socket, schema: this.state.details.schema, data: this.state.data, onChange: (data) => this.setState({ data }) })),
|
|
95
|
-
React.createElement(DialogActions, null,
|
|
96
|
-
React.createElement(Button, { disabled: !this.props.alive, variant: "contained", color: "primary", onClick: () => this.setState({ open: false }), autoFocus: true }, getTranslation('closeButtonText'))));
|
|
97
|
-
}
|
|
98
|
-
renderControlDialog() {
|
|
99
|
-
if (!this.state.showControlDialog || !this.props.alive) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
const colors = { primary: '#111', secondary: '#888' };
|
|
103
|
-
return React.createElement(Dialog, { open: !0, onClose: () => this.setState({ showControlDialog: false }) },
|
|
104
|
-
React.createElement(DialogTitle, null,
|
|
105
|
-
this.props.title,
|
|
106
|
-
React.createElement(IconButton, { style: {
|
|
107
|
-
position: 'absolute',
|
|
108
|
-
top: 5,
|
|
109
|
-
right: 5,
|
|
110
|
-
zIndex: 10,
|
|
111
|
-
}, onClick: () => this.setState({ showControlDialog: false }) },
|
|
112
|
-
React.createElement(CloseIcon, null))),
|
|
113
|
-
React.createElement(DialogContent, { style: { display: 'flex', flexDirection: 'column' } }, this.props.device.controls?.map(control => React.createElement(DeviceControlComponent, { disabled: false, key: control.id, control: control, socket: this.props.socket, colors: colors, deviceId: this.props.device.id, controlHandler: this.props.controlHandler, controlStateHandler: this.props.controlStateHandler }))));
|
|
114
|
-
}
|
|
115
|
-
renderControls() {
|
|
116
|
-
const colors = { primary: '#111', secondary: '#888' };
|
|
117
|
-
const firstControl = this.props.device.controls?.[0];
|
|
118
|
-
if (this.props.device.controls?.length === 1 && firstControl && ((firstControl.type === 'icon' || firstControl.type === 'switch') && !firstControl.label)) {
|
|
119
|
-
// control can be placed in button icon
|
|
120
|
-
return React.createElement(DeviceControlComponent, { disabled: !this.props.alive, control: firstControl, colors: colors, socket: this.props.socket, deviceId: this.props.device.id, controlHandler: this.props.controlHandler, controlStateHandler: this.props.controlStateHandler });
|
|
121
|
-
}
|
|
122
|
-
if (this.props.device.controls?.length) {
|
|
123
|
-
// place button and show controls dialog
|
|
124
|
-
return React.createElement(Fab, { size: "small", disabled: !this.props.alive, onClick: () => this.setState({ showControlDialog: true }) },
|
|
125
|
-
React.createElement(ControlIcon, null));
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
renderActions() {
|
|
130
|
-
return this.props.device.actions?.length ? this.props.device.actions.map(a => React.createElement(DeviceActionButton, { disabled: !this.props.alive, key: a.id, deviceId: this.props.device.id, action: a, deviceHandler: this.props.deviceHandler, refresh: this.refresh })) : null;
|
|
131
|
-
}
|
|
132
|
-
renderSmall() {
|
|
133
|
-
const hasDetails = this.props.device.hasDetails;
|
|
134
|
-
const status = !this.props.device.status ? [] : Array.isArray(this.props.device.status) ? this.props.device.status : [this.props.device.status];
|
|
135
|
-
return React.createElement(Card, { sx: {
|
|
136
|
-
maxWidth: 345,
|
|
137
|
-
minWidth: 200,
|
|
138
|
-
} },
|
|
139
|
-
React.createElement(CardHeader, { sx: theme => ({
|
|
140
|
-
backgroundColor: this.props.device.color || theme.palette.secondary.main,
|
|
141
|
-
color: this.props.device.color ? Utils.invertColor(this.props.device.color, true) : theme.palette.secondary.contrastText,
|
|
142
|
-
maxWidth: 345,
|
|
143
|
-
}), avatar: React.createElement("div", null,
|
|
144
|
-
this.props.uploadImagesToInstance ? React.createElement(DeviceImageUpload, { uploadImagesToInstance: this.props.uploadImagesToInstance, deviceId: this.props.device.id, manufacturer: getText(this.props.device.manufacturer), model: getText(this.props.device.model), onImageSelect: async (imageData) => imageData && this.setState({ icon: imageData }), socket: this.props.socket }) : null,
|
|
145
|
-
this.state.icon ? React.createElement(Icon, { src: this.state.icon }) : React.createElement(NoImageIcon, null)), action: hasDetails ? React.createElement(IconButton, { "aria-label": "settings", onClick: () => {
|
|
146
|
-
if (!this.state.open) {
|
|
147
|
-
this.loadDetails().catch(console.error);
|
|
148
|
-
this.setState({ open: true });
|
|
149
|
-
}
|
|
150
|
-
} },
|
|
151
|
-
React.createElement(MoreVertIcon, null)) : null, title: this.props.title, subheader: this.props.device.manufacturer ? React.createElement("span", null,
|
|
152
|
-
React.createElement("b", { style: { marginRight: 4 } },
|
|
153
|
-
getTranslation('manufacturer'),
|
|
154
|
-
":"),
|
|
155
|
-
getText(this.props.device.manufacturer)) : null }),
|
|
156
|
-
React.createElement(CardContent, { style: { position: 'relative' } },
|
|
157
|
-
status?.length ? React.createElement("div", { style: {
|
|
158
|
-
display: 'flex',
|
|
159
|
-
position: 'absolute',
|
|
160
|
-
top: -11,
|
|
161
|
-
background: '#88888880',
|
|
162
|
-
padding: '0 8px',
|
|
163
|
-
borderRadius: 5,
|
|
164
|
-
width: 'calc(100% - 46px)',
|
|
165
|
-
} }, status.map((s, i) => React.createElement(DeviceStatus, { key: i, status: s }))) : null,
|
|
166
|
-
React.createElement("div", null,
|
|
167
|
-
React.createElement(Typography, { variant: "body1" },
|
|
168
|
-
React.createElement("div", { onClick: this.copyToClipboard },
|
|
169
|
-
React.createElement("b", null, "ID:"),
|
|
170
|
-
React.createElement("span", { style: { marginLeft: 4 } }, this.props.device.id.replace(/.*\.\d\./, ''))),
|
|
171
|
-
this.props.device.manufacturer ? React.createElement("div", null,
|
|
172
|
-
React.createElement("b", { style: { marginRight: 4 } },
|
|
173
|
-
getTranslation('manufacturer'),
|
|
174
|
-
":"),
|
|
175
|
-
getText(this.props.device.manufacturer)) : null,
|
|
176
|
-
this.props.device.model ? React.createElement("div", null,
|
|
177
|
-
React.createElement("b", { style: { marginRight: 4 } },
|
|
178
|
-
getTranslation('model'),
|
|
179
|
-
":"),
|
|
180
|
-
getText(this.props.device.model)) : null))),
|
|
181
|
-
React.createElement(CardActions, { disableSpacing: true },
|
|
182
|
-
this.renderActions(),
|
|
183
|
-
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
184
|
-
this.renderControls()),
|
|
185
|
-
this.renderDialog(),
|
|
186
|
-
this.renderControlDialog());
|
|
187
|
-
}
|
|
188
|
-
renderBig() {
|
|
189
|
-
const cardStyle = {
|
|
190
|
-
// backgroundColor: '#fafafa',
|
|
191
|
-
width: 300,
|
|
192
|
-
minHeight: 280,
|
|
193
|
-
margin: 10,
|
|
194
|
-
overflow: 'hidden',
|
|
195
|
-
display: 'inline-block',
|
|
196
|
-
};
|
|
197
|
-
/** @type {CSSProperties} */
|
|
198
|
-
const headerStyle = {
|
|
199
|
-
display: 'flex',
|
|
200
|
-
position: 'relative',
|
|
201
|
-
justifyContent: 'space-between',
|
|
202
|
-
minHeight: 60,
|
|
203
|
-
color: '#000',
|
|
204
|
-
padding: '0 10px 0 10px',
|
|
205
|
-
backgroundColor: '#77c7ff8c',
|
|
206
|
-
borderRadius: '4px 4px 0 0',
|
|
207
|
-
};
|
|
208
|
-
/** @type {CSSProperties} */
|
|
209
|
-
const imgAreaStyle = {
|
|
210
|
-
height: 45,
|
|
211
|
-
width: 45,
|
|
212
|
-
margin: 'auto',
|
|
213
|
-
justifyContent: 'center',
|
|
214
|
-
display: 'grid',
|
|
215
|
-
};
|
|
216
|
-
/** @type {CSSProperties} */
|
|
217
|
-
const imgStyle = {
|
|
218
|
-
zIndex: 2,
|
|
219
|
-
maxWidth: '100%',
|
|
220
|
-
maxHeight: '100%',
|
|
221
|
-
};
|
|
222
|
-
/** @type {CSSProperties} */
|
|
223
|
-
const titleStyle = {
|
|
224
|
-
color: '#333',
|
|
225
|
-
width: '100%',
|
|
226
|
-
fontSize: 16,
|
|
227
|
-
fontWeight: 'bold',
|
|
228
|
-
paddingTop: 16,
|
|
229
|
-
paddingLeft: 8,
|
|
230
|
-
whiteSpace: 'nowrap',
|
|
231
|
-
overflow: 'hidden',
|
|
232
|
-
textOverflow: 'ellipsis',
|
|
233
|
-
};
|
|
234
|
-
/** @type {CSSProperties} */
|
|
235
|
-
const detailsButtonStyle = {
|
|
236
|
-
right: 20,
|
|
237
|
-
bottom: -20,
|
|
238
|
-
position: 'absolute',
|
|
239
|
-
};
|
|
240
|
-
/** @type {CSSProperties} */
|
|
241
|
-
const bodyStyle = {
|
|
242
|
-
height: 'calc(100% - 116px)',
|
|
243
|
-
};
|
|
244
|
-
/** @type {CSSProperties} */
|
|
245
|
-
const deviceInfoStyle = {
|
|
246
|
-
padding: '20px 16px 0 16px',
|
|
247
|
-
height: 133,
|
|
248
|
-
};
|
|
249
|
-
/** @type {CSSProperties} */
|
|
250
|
-
const statusStyle = {
|
|
251
|
-
padding: '15px 15px 0 15px',
|
|
252
|
-
height: 41,
|
|
253
|
-
};
|
|
254
|
-
const status = !this.props.device.status ? [] : Array.isArray(this.props.device.status) ? this.props.device.status : [this.props.device.status];
|
|
255
|
-
return React.createElement(Paper, { style: cardStyle, key: this.props.id },
|
|
256
|
-
React.createElement("div", { style: headerStyle },
|
|
257
|
-
React.createElement("div", { style: imgAreaStyle },
|
|
258
|
-
this.props.uploadImagesToInstance ? React.createElement(DeviceImageUpload, { uploadImagesToInstance: this.props.uploadImagesToInstance, deviceId: this.props.device.id, manufacturer: getText(this.props.device.manufacturer), model: getText(this.props.device.model), onImageSelect: async (imageData) => imageData && this.setState({ icon: imageData }), socket: this.props.socket }) : null,
|
|
259
|
-
React.createElement(Icon, { src: this.state.icon, style: imgStyle })),
|
|
260
|
-
React.createElement("div", { style: titleStyle }, this.props.title),
|
|
261
|
-
this.props.device.hasDetails ? React.createElement(Fab, { disabled: !this.props.alive, size: "small", style: detailsButtonStyle, onClick: () => {
|
|
262
|
-
if (!this.state.open) {
|
|
263
|
-
this.loadDetails().catch(console.error);
|
|
264
|
-
this.setState({ open: true });
|
|
265
|
-
}
|
|
266
|
-
}, color: "primary" },
|
|
267
|
-
React.createElement(MoreVertIcon, null)) : null),
|
|
268
|
-
React.createElement("div", { style: statusStyle }, status.map((s, i) => React.createElement(DeviceStatus, { key: i, status: s }))),
|
|
269
|
-
React.createElement("div", { style: bodyStyle },
|
|
270
|
-
React.createElement(Typography, { variant: "body1", style: deviceInfoStyle },
|
|
271
|
-
React.createElement("div", { onClick: this.copyToClipboard },
|
|
272
|
-
React.createElement("b", { style: { marginRight: 4 } }, "ID:"),
|
|
273
|
-
this.props.device.id.replace(/.*\.\d\./, '')),
|
|
274
|
-
this.props.device.manufacturer ? React.createElement("div", null,
|
|
275
|
-
React.createElement("b", { style: { marginRight: 4 } },
|
|
276
|
-
getTranslation('manufacturer'),
|
|
277
|
-
":"),
|
|
278
|
-
getText(this.props.device.manufacturer)) : null,
|
|
279
|
-
this.props.device.model ? React.createElement("div", null,
|
|
280
|
-
React.createElement("b", { style: { marginRight: 4 } },
|
|
281
|
-
getTranslation('model'),
|
|
282
|
-
":"),
|
|
283
|
-
getText(this.props.device.model)) : null),
|
|
284
|
-
!!this.props.device.actions?.length && React.createElement("div", { style: {
|
|
285
|
-
flex: 1,
|
|
286
|
-
position: 'relative',
|
|
287
|
-
display: 'flex',
|
|
288
|
-
gap: 8,
|
|
289
|
-
paddingBottom: 5,
|
|
290
|
-
height: 34,
|
|
291
|
-
paddingLeft: 10,
|
|
292
|
-
paddingRight: 10,
|
|
293
|
-
} },
|
|
294
|
-
this.renderActions(),
|
|
295
|
-
React.createElement("div", { style: { flexGrow: 1 } }),
|
|
296
|
-
this.renderControls())),
|
|
297
|
-
this.renderDialog(),
|
|
298
|
-
this.renderControlDialog());
|
|
299
|
-
}
|
|
300
|
-
render() {
|
|
301
|
-
if (this.props.smallCards) {
|
|
302
|
-
return this.renderSmall();
|
|
303
|
-
}
|
|
304
|
-
return this.renderBig();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
export default DeviceCard;
|
|
308
|
-
//# sourceMappingURL=DeviceCard.js.map
|