@iobroker/json-config 1.0.0 → 1.0.2
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/JsonConfigComponent/DeviceManager/Communication.d.ts +63 -0
- package/build/JsonConfigComponent/DeviceManager/Communication.js +247 -0
- package/build/JsonConfigComponent/DeviceManager/Communication.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +11 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceActionButton.js +10 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceActionButton.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +53 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceCard.js +308 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceCard.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +45 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceControl.js +119 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceControl.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +12 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +65 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceImageUpload.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceList.d.ts +51 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceList.js +235 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceList.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +13 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceStatus.js +106 -0
- package/build/JsonConfigComponent/DeviceManager/DeviceStatus.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +7 -0
- package/build/JsonConfigComponent/DeviceManager/InstanceActionButton.js +11 -0
- package/build/JsonConfigComponent/DeviceManager/InstanceActionButton.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +11 -0
- package/build/JsonConfigComponent/DeviceManager/JsonConfig.js +66 -0
- package/build/JsonConfigComponent/DeviceManager/JsonConfig.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +10 -0
- package/build/JsonConfigComponent/DeviceManager/TooltipButton.js +17 -0
- package/build/JsonConfigComponent/DeviceManager/TooltipButton.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/Utils.d.ts +12 -0
- package/build/JsonConfigComponent/DeviceManager/Utils.js +150 -0
- package/build/JsonConfigComponent/DeviceManager/Utils.js.map +1 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/de.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/en.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/es.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/fr.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/it.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/nl.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/pl.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/pt.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/ru.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/uk.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +21 -0
- package/build/JsonConfigComponent/DeviceManager/index.d.ts +2 -0
- package/build/JsonConfigComponent/DeviceManager/index.js +3 -0
- package/build/JsonConfigComponent/DeviceManager/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { Connection } from '@iobroker/socket-client';
|
|
3
|
+
import { ActionBase, ControlBase, ControlState } from '@iobroker/dm-utils/build/types/base';
|
|
4
|
+
export type CommunicationProps = {
|
|
5
|
+
socket: Connection;
|
|
6
|
+
selectedInstance: string;
|
|
7
|
+
registerHandler?: (handler: null | ((command: string) => void)) => void;
|
|
8
|
+
};
|
|
9
|
+
interface CommunicationForm {
|
|
10
|
+
title?: string | null | undefined;
|
|
11
|
+
schema?: Record<string, any>;
|
|
12
|
+
data?: Record<string, any>;
|
|
13
|
+
handleClose?: (data?: Record<string, any>) => void;
|
|
14
|
+
}
|
|
15
|
+
export type CommunicationState = {
|
|
16
|
+
showSpinner: boolean;
|
|
17
|
+
showToast: string | null;
|
|
18
|
+
message: {
|
|
19
|
+
message: string;
|
|
20
|
+
handleClose: () => void;
|
|
21
|
+
} | null;
|
|
22
|
+
confirm: {
|
|
23
|
+
message: string;
|
|
24
|
+
handleClose: (confirmation?: boolean) => void;
|
|
25
|
+
} | null;
|
|
26
|
+
form: CommunicationForm | null;
|
|
27
|
+
progress: {
|
|
28
|
+
open: boolean;
|
|
29
|
+
progress: number;
|
|
30
|
+
} | null;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Device List Component
|
|
34
|
+
* @param {object} params - Component parameters
|
|
35
|
+
* @param {object} params.socket - socket object
|
|
36
|
+
* @param {string} params.selectedInstance - Selected instance
|
|
37
|
+
* @returns {*[]} - Array of device cards
|
|
38
|
+
*/
|
|
39
|
+
declare class Communication<P extends CommunicationProps, S extends CommunicationState> extends Component<P, S> {
|
|
40
|
+
instanceHandler: (action: ActionBase<'api'>) => () => void;
|
|
41
|
+
deviceHandler: (deviceId: string, action: ActionBase<'api'>, refresh: () => void) => () => void;
|
|
42
|
+
controlHandler: (deviceId: string, control: ControlBase, state: ControlState) => () => Promise<ioBroker.State | null>;
|
|
43
|
+
controlStateHandler: (deviceId: string, control: ControlBase) => () => Promise<ioBroker.State | null>;
|
|
44
|
+
constructor(props: P);
|
|
45
|
+
loadData(): void;
|
|
46
|
+
sendActionToInstance: (command: string, messageToSend: any, refresh?: () => void) => void;
|
|
47
|
+
sendControlToInstance: (command: string, messageToSend: {
|
|
48
|
+
deviceId: string;
|
|
49
|
+
controlId: string;
|
|
50
|
+
state?: ControlState;
|
|
51
|
+
}) => Promise<ioBroker.State>;
|
|
52
|
+
loadDevices(): Promise<any>;
|
|
53
|
+
loadInstanceInfos(): Promise<any>;
|
|
54
|
+
renderMessageDialog(): React.JSX.Element | null;
|
|
55
|
+
renderConfirmDialog(): React.JSX.Element;
|
|
56
|
+
renderSnackbar(): React.JSX.Element;
|
|
57
|
+
renderFormDialog(): React.JSX.Element;
|
|
58
|
+
renderProgressDialog(): React.JSX.Element;
|
|
59
|
+
renderContent(): React.JSX.Element | React.JSX.Element[] | null;
|
|
60
|
+
renderSpinner(): React.JSX.Element;
|
|
61
|
+
render(): React.JSX.Element;
|
|
62
|
+
}
|
|
63
|
+
export default Communication;
|
|
@@ -0,0 +1,247 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,EACd,QAAQ,GACX,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,UAAU,MAAM,cAAc,CAAC;AAuEtC;;;;;;GAMG;AACH,MAAM,aAA0E,SAAQ,SAAe;IACnG,mEAAmE;IACnE,eAAe,CAA4C;IAE3D,mEAAmE;IACnE,aAAa,CAAmF;IAEhG,mEAAmE;IACnE,cAAc,CAAwG;IAEtH,mEAAmE;IACnE,mBAAmB,CAAmF;IAEtG,YAAY,KAAQ;QAChB,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,mBAAmB;QACnB,IAAI,CAAC,KAAK,GAAG;YACT,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI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E,CAC7B,CAAC;IACR,CAAC;CACJ;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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;
|