@iobroker/dm-gui-components 8.0.8 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +6 -0
  2. package/build/Communication.d.ts +12 -38
  3. package/build/Communication.js +91 -69
  4. package/build/Communication.js.map +1 -1
  5. package/build/DeviceActionButton.d.ts +3 -3
  6. package/build/DeviceActionButton.js +2 -2
  7. package/build/DeviceActionButton.js.map +1 -1
  8. package/build/DeviceCard.d.ts +28 -9
  9. package/build/DeviceCard.js +161 -63
  10. package/build/DeviceCard.js.map +1 -1
  11. package/build/DeviceControl.d.ts +5 -5
  12. package/build/DeviceControl.js.map +1 -1
  13. package/build/DeviceImageUpload.d.ts +2 -1
  14. package/build/DeviceImageUpload.js +1 -1
  15. package/build/DeviceImageUpload.js.map +1 -1
  16. package/build/DeviceList.d.ts +6 -7
  17. package/build/DeviceList.js +102 -91
  18. package/build/DeviceList.js.map +1 -1
  19. package/build/DeviceStatus.d.ts +7 -4
  20. package/build/DeviceStatus.js +37 -30
  21. package/build/DeviceStatus.js.map +1 -1
  22. package/build/InstanceActionButton.d.ts +1 -1
  23. package/build/InstanceActionButton.js.map +1 -1
  24. package/build/StateOrObjectHandler.d.ts +10 -0
  25. package/build/StateOrObjectHandler.js +141 -0
  26. package/build/StateOrObjectHandler.js.map +1 -0
  27. package/build/TooltipButton.d.ts +1 -0
  28. package/build/TooltipButton.js +4 -3
  29. package/build/TooltipButton.js.map +1 -1
  30. package/build/Utils.d.ts +1 -2
  31. package/build/Utils.js.map +1 -1
  32. package/build/hooks.d.ts +3 -0
  33. package/build/hooks.js +10 -0
  34. package/build/hooks.js.map +1 -0
  35. package/build/i18n/de.json +2 -0
  36. package/build/i18n/en.json +2 -0
  37. package/build/i18n/es.json +2 -0
  38. package/build/i18n/fr.json +2 -0
  39. package/build/i18n/it.json +2 -0
  40. package/build/i18n/nl.json +2 -0
  41. package/build/i18n/pl.json +2 -0
  42. package/build/i18n/pt.json +2 -0
  43. package/build/i18n/ru.json +2 -0
  44. package/build/i18n/uk.json +2 -0
  45. package/build/i18n/zh-cn.json +2 -0
  46. package/build/protocol/DmProtocolBase.d.ts +29 -0
  47. package/build/protocol/DmProtocolBase.js +12 -0
  48. package/build/protocol/DmProtocolBase.js.map +1 -0
  49. package/build/protocol/DmProtocolV1.d.ts +12 -0
  50. package/build/protocol/DmProtocolV1.js +22 -0
  51. package/build/protocol/DmProtocolV1.js.map +1 -0
  52. package/build/protocol/DmProtocolV2.d.ts +5 -0
  53. package/build/protocol/DmProtocolV2.js +11 -0
  54. package/build/protocol/DmProtocolV2.js.map +1 -0
  55. package/build/protocol/DmProtocolV3.d.ts +12 -0
  56. package/build/protocol/DmProtocolV3.js +28 -0
  57. package/build/protocol/DmProtocolV3.js.map +1 -0
  58. package/build/protocol/UnknownDmProtocol.d.ts +13 -0
  59. package/build/protocol/UnknownDmProtocol.js +20 -0
  60. package/build/protocol/UnknownDmProtocol.js.map +1 -0
  61. package/build/protocol/api.d.ts +2 -0
  62. package/build/protocol/api.js +2 -0
  63. package/build/protocol/api.js.map +1 -0
  64. package/package.json +8 -8
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { IconButton, InputAdornment, TextField, Toolbar, Tooltip, LinearProgress, Select, MenuItem, FormControl, InputLabel, } from '@mui/material';
2
+ import { IconButton, InputAdornment, TextField, Toolbar, Tooltip, LinearProgress, Select, MenuItem, FormControl, InputLabel, Box, } from '@mui/material';
3
3
  import { Clear, QuestionMark, Refresh, FilterAltOff } from '@mui/icons-material';
4
4
  import { I18n, DeviceTypeIcon } from '@iobroker/adapter-react-v5';
5
- import DeviceCard from './DeviceCard';
5
+ import DeviceCard, { DeviceCardSkeleton } from './DeviceCard';
6
6
  import { getTranslation } from './Utils';
7
7
  import Communication from './Communication';
8
8
  import InstanceActionButton from './InstanceActionButton';
@@ -22,11 +22,11 @@ import zhCn from './i18n/zh-cn.json';
22
22
  */
23
23
  export default class DeviceList extends Communication {
24
24
  static i18nInitialized = false;
25
- lastPropsFilter;
26
25
  lastInstance;
26
+ lastAliveSubscribe = '';
27
27
  lastTriggerLoad = 0;
28
- filterTimeout;
29
- language;
28
+ filterTimeout = null;
29
+ language = I18n.getLanguage();
30
30
  constructor(props) {
31
31
  super(props);
32
32
  if (!DeviceList.i18nInitialized) {
@@ -45,29 +45,19 @@ export default class DeviceList extends Communication {
45
45
  'zh-cn': zhCn,
46
46
  });
47
47
  }
48
- let selectedInstance;
49
- if (this.props.selectedInstance === undefined) {
50
- selectedInstance = window.localStorage.getItem('dmSelectedInstance') || '';
51
- }
52
- else {
53
- selectedInstance = this.props.selectedInstance;
54
- }
55
- Object.assign(this.state, {
48
+ this.state = {
49
+ ...this.state,
56
50
  devices: [],
57
- filteredDevices: [],
58
51
  filter: '',
59
52
  instanceInfo: null,
60
53
  loading: null,
61
54
  alive: null,
62
55
  groupKey: '',
63
56
  dmInstances: null,
64
- selectedInstance,
65
- });
66
- this.lastPropsFilter = this.props.filter;
67
- this.lastInstance = selectedInstance;
57
+ apiVersionError: false,
58
+ };
59
+ this.lastInstance = this.state.selectedInstance;
68
60
  this.lastTriggerLoad = this.props.triggerLoad || 0;
69
- this.filterTimeout = null;
70
- this.language = I18n.getLanguage();
71
61
  }
72
62
  async loadAdapters() {
73
63
  await this.props.socket.waitForFirstConnection();
@@ -75,9 +65,6 @@ export default class DeviceList extends Communication {
75
65
  const res = await this.props.socket.getObjectViewSystem('instance', 'system.adapter.', 'system.adapter.\u9999');
76
66
  const dmInstances = {};
77
67
  for (const id in res) {
78
- if (!res[id]?.common?.messagebox) {
79
- continue;
80
- }
81
68
  if (!res[id].common.supportedMessages?.deviceManager) {
82
69
  continue;
83
70
  }
@@ -102,14 +89,15 @@ export default class DeviceList extends Communication {
102
89
  }
103
90
  async componentDidMount() {
104
91
  let alive = false;
92
+ // If an instance selector must be shown
105
93
  if (this.props.selectedInstance === undefined) {
106
94
  // show instance selector
107
95
  await this.loadAdapters();
108
96
  }
109
- if (this.state.alive === null) {
97
+ if (this.state.alive === null && this.state.selectedInstance) {
110
98
  try {
111
99
  // check if the instance is alive
112
- const stateAlive = await this.props.socket.getState(`system.adapter.${this.props.selectedInstance}.alive`);
100
+ const stateAlive = await this.props.socket.getState(`system.adapter.${this.state.selectedInstance}.alive`);
113
101
  if (stateAlive?.val) {
114
102
  alive = true;
115
103
  }
@@ -117,18 +105,16 @@ export default class DeviceList extends Communication {
117
105
  catch (error) {
118
106
  console.error(error);
119
107
  }
120
- this.setState({ alive }, () => this.props.socket.subscribeState(`system.adapter.${this.props.selectedInstance}.alive`, this.aliveHandler));
121
- if (!alive) {
122
- return;
123
- }
108
+ this.lastAliveSubscribe = this.state.selectedInstance;
109
+ this.setState({ alive }, () => this.props.socket.subscribeState(`system.adapter.${this.state.selectedInstance}.alive`, this.aliveHandler));
124
110
  }
125
- else {
111
+ else if (this.state.alive !== null) {
126
112
  alive = this.state.alive;
127
113
  }
128
114
  if (!this.props.embedded && alive) {
129
115
  try {
130
116
  const instanceInfo = await this.loadInstanceInfos();
131
- this.setState({ instanceInfo });
117
+ this.setState({ instanceInfo, apiVersionError: !['v1', 'v2', 'v3'].includes(instanceInfo.apiVersion) });
132
118
  }
133
119
  catch (error) {
134
120
  console.error(error);
@@ -139,10 +125,12 @@ export default class DeviceList extends Communication {
139
125
  }
140
126
  }
141
127
  componentWillUnmount() {
142
- this.props.socket.unsubscribeState(`system.adapter.${this.props.selectedInstance}.alive`, this.aliveHandler);
128
+ if (this.state.selectedInstance) {
129
+ this.props.socket.unsubscribeState(`system.adapter.${this.state.selectedInstance}.alive`, this.aliveHandler);
130
+ }
143
131
  }
144
132
  aliveHandler = (id, state) => {
145
- if (id === `system.adapter.${this.props.selectedInstance}.alive`) {
133
+ if (this.state.selectedInstance && id === `system.adapter.${this.state.selectedInstance}.alive`) {
146
134
  const alive = !!state?.val;
147
135
  if (alive !== this.state.alive) {
148
136
  this.setState({ alive }, () => {
@@ -158,20 +146,48 @@ export default class DeviceList extends Communication {
158
146
  */
159
147
  loadData() {
160
148
  this.setState({ loading: true }, async () => {
161
- console.log(`Loading devices for ${this.props.selectedInstance}...`);
149
+ console.log(`Loading devices for ${this.state.selectedInstance}...`);
150
+ let alive = this.state.alive;
151
+ if (this.state.selectedInstance !== this.lastAliveSubscribe) {
152
+ if (this.lastAliveSubscribe) {
153
+ // unsubscribe from the old instance
154
+ this.props.socket.unsubscribeState(`system.adapter.${this.lastAliveSubscribe}.alive`, this.aliveHandler);
155
+ }
156
+ this.lastAliveSubscribe = this.state.selectedInstance;
157
+ if (this.state.selectedInstance) {
158
+ try {
159
+ // check if the instance is alive
160
+ const stateAlive = await this.props.socket.getState(`system.adapter.${this.state.selectedInstance}.alive`);
161
+ if (stateAlive?.val) {
162
+ alive = true;
163
+ }
164
+ }
165
+ catch (error) {
166
+ console.error(error);
167
+ }
168
+ await this.props.socket.subscribeState(`system.adapter.${this.state.selectedInstance}.alive`, this.aliveHandler);
169
+ }
170
+ else {
171
+ alive = false;
172
+ }
173
+ }
162
174
  let devices = [];
163
175
  try {
164
- devices = await this.loadDevices();
165
- if (!devices || !Array.isArray(devices)) {
166
- console.error(`Message returned from sendTo() doesn't look like one from DeviceManagement, did you accidentally handle the message in your adapter? ${JSON.stringify(devices)}`);
167
- devices = [];
176
+ this.setState({ devices, loading: !!alive, alive });
177
+ if (alive) {
178
+ await this.loadDevices((batch, total) => {
179
+ devices = devices.concat(batch);
180
+ this.setState({ devices, loading: true, totalDevices: total });
181
+ console.log(`Loaded ${devices.length} of ${total} devices...`);
182
+ });
168
183
  }
169
184
  }
170
185
  catch (error) {
171
186
  console.error(error);
172
187
  devices = [];
173
188
  }
174
- this.setState({ devices, loading: false }, () => this.applyFilter());
189
+ this.setState({ devices, loading: false, totalDevices: devices.length });
190
+ console.log(`Loaded ${devices.length} devices for ${this.state.selectedInstance}`);
175
191
  });
176
192
  }
177
193
  getText(text) {
@@ -180,27 +196,14 @@ export default class DeviceList extends Communication {
180
196
  }
181
197
  return text;
182
198
  }
183
- applyFilter() {
184
- const filter = this.props.embedded ? this.props.filter : this.state.filter;
185
- // filter devices name
186
- if (filter) {
187
- const filteredDevices = this.state.devices.filter(device => this.getText(device.name).toLowerCase().includes(filter.toLowerCase()));
188
- this.setState({ filteredDevices });
189
- }
190
- else {
191
- this.setState({ filteredDevices: this.state.devices });
192
- }
193
- }
194
199
  handleFilterChange(filter) {
195
- this.setState({ filter }, () => {
196
- if (this.filterTimeout) {
197
- clearTimeout(this.filterTimeout);
198
- }
199
- this.filterTimeout = setTimeout(() => {
200
- this.filterTimeout = null;
201
- this.applyFilter();
202
- }, 250);
203
- });
200
+ if (this.filterTimeout) {
201
+ clearTimeout(this.filterTimeout);
202
+ }
203
+ this.filterTimeout = setTimeout(() => {
204
+ this.filterTimeout = null;
205
+ this.setState({ filter });
206
+ }, 250);
204
207
  }
205
208
  renderGroups(groups) {
206
209
  if (!groups?.length) {
@@ -226,15 +229,14 @@ export default class DeviceList extends Communication {
226
229
  this.lastTriggerLoad = this.props.triggerLoad || 0;
227
230
  setTimeout(() => this.loadData(), 50);
228
231
  }
229
- if (this.props.embedded && this.lastPropsFilter !== this.props.filter) {
230
- this.lastPropsFilter = this.props.filter;
231
- setTimeout(() => this.applyFilter(), 50);
232
- }
233
232
  // if instance changed
234
- if (this.props.embedded && this.lastInstance !== this.props.selectedInstance && this.props.selectedInstance) {
235
- this.lastInstance = this.props.selectedInstance;
233
+ if (this.lastInstance !== this.state.selectedInstance) {
234
+ this.lastInstance = this.state.selectedInstance;
236
235
  setTimeout(() => this.loadData(), 50);
237
236
  }
237
+ if (this.props.selectedInstance && this.props.selectedInstance !== this.state.selectedInstance) {
238
+ setTimeout(() => this.setState({ selectedInstance: this.props.selectedInstance }), 50);
239
+ }
238
240
  const deviceGroups = [];
239
241
  let list;
240
242
  if (!this.props.embedded && !this.state.alive) {
@@ -243,22 +245,16 @@ export default class DeviceList extends Communication {
243
245
  React.createElement("span", null, getTranslation('instanceNotAlive'))),
244
246
  ];
245
247
  }
246
- else if (!this.state.devices.length && this.props.selectedInstance) {
248
+ else if (!this.state.devices.length && this.state.selectedInstance && !this.state.loading) {
247
249
  list = [
248
250
  React.createElement("div", { style: emptyStyle, key: "notFound" },
249
251
  React.createElement("span", null, getTranslation('noDevicesFoundText'))),
250
252
  ];
251
253
  }
252
- else if (this.state.devices.length && !this.state.filteredDevices.length) {
253
- list = [
254
- React.createElement("div", { style: emptyStyle, key: "filtered" },
255
- React.createElement("span", null, getTranslation('allDevicesFilteredOut'))),
256
- ];
257
- }
258
254
  else {
259
255
  // build a device types list
260
- let filteredDevices = this.state.filteredDevices;
261
- if (!this.props.embedded && filteredDevices.find(device => device.group)) {
256
+ let filteredDevices = this.state.devices;
257
+ if (!this.state.loading && !this.props.embedded && filteredDevices.find(device => device.group)) {
262
258
  deviceGroups.push({
263
259
  name: I18n.t('All'),
264
260
  value: '',
@@ -299,16 +295,31 @@ export default class DeviceList extends Communication {
299
295
  else {
300
296
  filteredDevices = filteredDevices.filter(device => device.group?.key === this.state.groupKey);
301
297
  }
302
- if (!filteredDevices.length) {
303
- list = [
304
- React.createElement("div", { style: emptyStyle, key: "filtered" },
305
- React.createElement("span", null, getTranslation('allDevicesFilteredOut'))),
306
- ];
298
+ }
299
+ }
300
+ if (this.state.selectedInstance) {
301
+ list = filteredDevices.map(device => (React.createElement(DeviceCard, { key: JSON.stringify(device.id), smallCards: this.props.smallCards, filter: this.props.embedded ? this.props.filter : this.state.filter, alive: !!this.state.alive, id: device.id, identifierLabel: this.state.instanceInfo?.identifierLabel ?? 'ID', device: device, instanceId: this.state.selectedInstance, uploadImagesToInstance: this.props.uploadImagesToInstance, deviceHandler: this.deviceHandler, controlHandler: this.controlHandler, controlStateHandler: this.controlStateHandler, socket: this.props.socket, themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, isFloatComma: this.props.isFloatComma, dateFormat: this.props.dateFormat })));
302
+ if (this.state.loading) {
303
+ const skeletons = (this.state.totalDevices ?? list.length + 1) - list.length;
304
+ for (let i = 0; i < skeletons; i++) {
305
+ list.push(React.createElement(DeviceCardSkeleton, { key: `skeleton-${i}`, smallCards: this.props.smallCards, theme: this.props.theme }));
307
306
  }
308
307
  }
308
+ else if (this.state.devices.length > 0) {
309
+ list.push(React.createElement(Box, { key: "filtered", sx: {
310
+ padding: '25px',
311
+ '&:not(:first-child)': {
312
+ display: 'none',
313
+ },
314
+ } },
315
+ React.createElement("span", null, getTranslation('allDevicesFilteredOut'))));
316
+ }
309
317
  }
310
- if (filteredDevices.length && this.props.selectedInstance) {
311
- list = filteredDevices.map(device => (React.createElement(DeviceCard, { alive: !!this.state.alive, key: device.id, id: device.id, title: this.getText(device.name), device: device, instanceId: this.props.selectedInstance, uploadImagesToInstance: this.props.uploadImagesToInstance, deviceHandler: this.deviceHandler, controlHandler: this.controlHandler, controlStateHandler: this.controlStateHandler, socket: this.props.socket, themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, isFloatComma: this.props.isFloatComma, dateFormat: this.props.dateFormat })));
318
+ else {
319
+ list = [
320
+ React.createElement("div", { style: emptyStyle, key: "selectInstance" },
321
+ React.createElement("span", null, getTranslation('selectInstanceText'))),
322
+ ];
312
323
  }
313
324
  }
314
325
  if (this.props.embedded) {
@@ -319,20 +330,20 @@ export default class DeviceList extends Communication {
319
330
  return (React.createElement("div", { style: { width: '100%', height: '100%', overflow: 'hidden' } },
320
331
  React.createElement(Toolbar, { variant: "dense", style: { backgroundColor: '#777', display: 'flex' } },
321
332
  this.props.title,
322
- this.props.selectedInstance === null && this.state.dmInstances ? (React.createElement(FormControl, null,
323
- React.createElement(InputLabel, { id: "instance-select-label" }, getTranslation('instanceLabelText')),
324
- React.createElement(Select, { labelId: "instance-select-label", id: "instance-select", value: this.state.selectedInstance, onChange: event => {
333
+ this.props.selectedInstance === undefined && this.state.dmInstances ? (React.createElement(FormControl, null,
334
+ React.createElement(InputLabel, { id: "instance-select-label", style: { transform: 'translate(0, -9px) scale(0.75)' } }, getTranslation('instanceLabelText')),
335
+ React.createElement(Select, { style: { marginTop: 0, minWidth: 120 }, labelId: "instance-select-label", id: "instance-select", value: this.state.selectedInstance, onChange: event => {
325
336
  window.localStorage.setItem('dmSelectedInstance', event.target.value);
326
337
  this.setState({ selectedInstance: event.target.value });
327
- }, displayEmpty: true, variant: "standard", sx: { minWidth: 120 } }, Object.keys(this.state.dmInstances).map(([id]) => (React.createElement(MenuItem, { key: id, value: id }, id)))))) : null,
328
- this.props.selectedInstance ? (React.createElement(Tooltip, { title: getTranslation('refreshTooltip'), slotProps: { popper: { sx: { pointerEvents: 'none' } } } },
338
+ }, displayEmpty: true, variant: "standard" }, Object.keys(this.state.dmInstances).map(id => (React.createElement(MenuItem, { key: id, value: id }, id)))))) : null,
339
+ this.state.selectedInstance ? (React.createElement(Tooltip, { title: getTranslation('refreshTooltip'), slotProps: { popper: { sx: { pointerEvents: 'none' } } } },
329
340
  React.createElement("span", null,
330
- React.createElement(IconButton, { onClick: () => this.loadData(), disabled: !this.state.alive, size: "small" },
341
+ React.createElement(IconButton, { onClick: () => this.loadData(), disabled: !this.state.alive || this.state.apiVersionError, size: "small" },
331
342
  React.createElement(Refresh, null))))) : null,
332
- this.state.alive && this.state.instanceInfo?.actions?.length ? (React.createElement("div", { style: { marginLeft: 20 } }, this.state.instanceInfo.actions.map(action => (React.createElement(InstanceActionButton, { key: action.id, action: action, instanceHandler: this.instanceHandler }))))) : null,
343
+ !this.state.apiVersionError && this.state.alive && this.state.instanceInfo?.actions?.length ? (React.createElement("div", { style: { marginLeft: 20 } }, this.state.instanceInfo.actions.map(action => (React.createElement(InstanceActionButton, { key: action.id, action: action, instanceHandler: this.instanceHandler }))))) : null,
333
344
  React.createElement("div", { style: { flexGrow: 1 } }),
334
- this.renderGroups(deviceGroups),
335
- this.state.alive ? (React.createElement(TextField, { variant: "standard", style: { width: 200 }, size: "small", label: getTranslation('filterLabelText'), onChange: e => this.handleFilterChange(e.target.value), value: this.state.filter, autoComplete: "off", slotProps: {
345
+ !this.state.apiVersionError && this.renderGroups(deviceGroups),
346
+ !this.state.apiVersionError && this.state.alive ? (React.createElement(TextField, { variant: "standard", style: { width: 200 }, size: "small", label: getTranslation('filterLabelText'), onChange: e => this.handleFilterChange(e.target.value), value: this.state.filter, autoComplete: "off", slotProps: {
336
347
  input: {
337
348
  autoComplete: 'new-password',
338
349
  endAdornment: this.state.filter ? (React.createElement(InputAdornment, { position: "end" },
@@ -356,7 +367,7 @@ export default class DeviceList extends Communication {
356
367
  ...this.props.style,
357
368
  } },
358
369
  this.state.loading ? React.createElement(LinearProgress, { style: { width: '100%' } }) : null,
359
- list)));
370
+ this.state.apiVersionError ? React.createElement("div", null, I18n.t('apiVersionError')) : list)));
360
371
  }
361
372
  }
362
373
  //# sourceMappingURL=DeviceList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeviceList.js","sourceRoot":"./src/","sources":["DeviceList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EACH,UAAU,EACV,cAAc,EACd,SAAS,EACT,OAAO,EACP,OAAO,EACP,cAAc,EACd,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OA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AEA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI;gBACxE,IAAI,CACH,CACJ,CACT,CAAC;IACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport {\n IconButton,\n InputAdornment,\n TextField,\n Toolbar,\n Tooltip,\n LinearProgress,\n Select,\n MenuItem,\n FormControl,\n InputLabel,\n} from '@mui/material';\n\nimport { Clear, QuestionMark, Refresh, FilterAltOff } from '@mui/icons-material';\n\nimport { I18n, DeviceTypeIcon } from '@iobroker/adapter-react-v5';\nimport type { DeviceInfo, InstanceDetails } from '@iobroker/dm-utils';\n\nimport DeviceCard from './DeviceCard';\nimport { getTranslation } from './Utils';\nimport Communication, { type CommunicationProps, type CommunicationState } from './Communication';\nimport InstanceActionButton from './InstanceActionButton';\n\nimport de from './i18n/de.json';\nimport en from './i18n/en.json';\nimport ru from './i18n/ru.json';\nimport pt from './i18n/pt.json';\nimport nl from './i18n/nl.json';\nimport fr from './i18n/fr.json';\nimport it from './i18n/it.json';\nimport es from './i18n/es.json';\nimport pl from './i18n/pl.json';\nimport uk from './i18n/uk.json';\nimport zhCn from './i18n/zh-cn.json';\n\ninterface DeviceListProps extends CommunicationProps {\n /** Instance to upload images to, like `adapterName.X` */\n uploadImagesToInstance?: string;\n /** Filter devices with this string */\n filter?: string;\n /** If this component is used in GUI with own toolbar. `false` if this list is used with multiple instances and true if only with one (in this case, it will monitor alive itself */\n embedded?: boolean;\n /** If embedded, this text is shown in the toolbar */\n title?: string;\n /** Style of a component that displays all devices */\n style?: React.CSSProperties;\n /** Use small cards for devices */\n smallCards?: boolean;\n /** To trigger the reload of devices, just change this variable */\n triggerLoad?: number;\n}\n\ninterface DeviceListState extends CommunicationState {\n devices: DeviceInfo[];\n filteredDevices: DeviceInfo[];\n filter: string;\n instanceInfo: InstanceDetails;\n loading: boolean;\n alive: boolean | null;\n triggerLoad: number;\n groupKey: string;\n dmInstances: { [instanceName: string]: { title: string; instance: number } } | null;\n selectedInstance: string;\n}\n\n/**\n * Device List Component\n */\nexport default class DeviceList extends Communication<DeviceListProps, DeviceListState> {\n static i18nInitialized = false;\n\n private lastPropsFilter: string | undefined;\n\n private lastInstance: string;\n\n private lastTriggerLoad = 0;\n\n private filterTimeout: ReturnType<typeof setTimeout> | null;\n\n private readonly language: ioBroker.Languages;\n\n constructor(props: DeviceListProps) {\n super(props);\n\n if (!DeviceList.i18nInitialized) {\n DeviceList.i18nInitialized = true;\n I18n.extendTranslations({\n en,\n de,\n ru,\n pt,\n nl,\n fr,\n it,\n es,\n pl,\n uk,\n 'zh-cn': zhCn,\n });\n }\n\n let selectedInstance: string;\n if (this.props.selectedInstance === undefined) {\n selectedInstance = window.localStorage.getItem('dmSelectedInstance') || '';\n } else {\n selectedInstance = this.props.selectedInstance;\n }\n\n Object.assign(this.state, {\n devices: [],\n filteredDevices: [],\n filter: '',\n instanceInfo: null,\n loading: null,\n alive: null,\n groupKey: '',\n dmInstances: null,\n selectedInstance,\n });\n\n this.lastPropsFilter = this.props.filter;\n this.lastInstance = selectedInstance;\n this.lastTriggerLoad = this.props.triggerLoad || 0;\n this.filterTimeout = null;\n this.language = I18n.getLanguage();\n }\n\n private async loadAdapters(): Promise<void> {\n await this.props.socket.waitForFirstConnection();\n\n console.log('Loading adapters...');\n const res = await this.props.socket.getObjectViewSystem('instance', 'system.adapter.', 'system.adapter.\\u9999');\n const dmInstances: { [instanceName: string]: { title: string; instance: number } } = {};\n for (const id in res) {\n if (!res[id]?.common?.messagebox) {\n continue;\n }\n if (!res[id].common.supportedMessages?.deviceManager) {\n continue;\n }\n\n const instanceName = id.substring('system.adapter.'.length);\n try {\n // Check if the instance is alive by getting the state alive\n const alive = await this.props.socket.getState(`system.adapter.${instanceName}.alive`);\n if (!alive?.val) {\n continue;\n }\n\n const instance = parseInt(instanceName.split('.').pop() || '0') || 0;\n dmInstances[instanceName] = {\n title: '',\n instance,\n };\n } catch (error) {\n console.error(error);\n }\n }\n\n this.setState({ dmInstances });\n }\n\n async componentDidMount(): Promise<void> {\n let alive = false;\n if (this.props.selectedInstance === undefined) {\n // show instance selector\n await this.loadAdapters();\n }\n\n if (this.state.alive === null) {\n try {\n // check if the instance is alive\n const stateAlive = await this.props.socket.getState(\n `system.adapter.${this.props.selectedInstance}.alive`,\n );\n if (stateAlive?.val) {\n alive = true;\n }\n } catch (error) {\n console.error(error);\n }\n this.setState({ alive }, () =>\n this.props.socket.subscribeState(\n `system.adapter.${this.props.selectedInstance}.alive`,\n this.aliveHandler,\n ),\n );\n if (!alive) {\n return;\n }\n } else {\n alive = this.state.alive;\n }\n\n if (!this.props.embedded && alive) {\n try {\n const instanceInfo = await this.loadInstanceInfos();\n this.setState({ instanceInfo });\n } catch (error) {\n console.error(error);\n }\n }\n if (alive) {\n this.loadData();\n }\n }\n\n componentWillUnmount(): void {\n this.props.socket.unsubscribeState(`system.adapter.${this.props.selectedInstance}.alive`, this.aliveHandler);\n }\n\n aliveHandler: ioBroker.StateChangeHandler = (id: string, state: ioBroker.State | null | undefined): void => {\n if (id === `system.adapter.${this.props.selectedInstance}.alive`) {\n const alive = !!state?.val;\n if (alive !== this.state.alive) {\n this.setState({ alive }, () => {\n if (alive) {\n this.componentDidMount().catch(console.error);\n }\n });\n }\n }\n };\n\n /**\n * Load devices\n */\n override loadData(): void {\n this.setState({ loading: true }, async () => {\n console.log(`Loading devices for ${this.props.selectedInstance}...`);\n let devices: DeviceInfo[] = [];\n try {\n devices = await this.loadDevices();\n\n if (!devices || !Array.isArray(devices)) {\n console.error(\n `Message returned from sendTo() doesn't look like one from DeviceManagement, did you accidentally handle the message in your adapter? ${JSON.stringify(\n devices,\n )}`,\n );\n devices = [];\n }\n } catch (error) {\n console.error(error);\n devices = [];\n }\n\n this.setState({ devices, loading: false }, () => this.applyFilter());\n });\n }\n\n getText(text: ioBroker.StringOrTranslated): string {\n if (typeof text === 'object') {\n return text[this.language] || text.en;\n }\n\n return text;\n }\n\n applyFilter(): void {\n const filter = this.props.embedded ? this.props.filter : this.state.filter;\n\n // filter devices name\n if (filter) {\n const filteredDevices = this.state.devices.filter(device =>\n this.getText(device.name).toLowerCase().includes(filter.toLowerCase()),\n );\n this.setState({ filteredDevices });\n } else {\n this.setState({ filteredDevices: this.state.devices });\n }\n }\n\n handleFilterChange(filter: string): void {\n this.setState({ filter }, () => {\n if (this.filterTimeout) {\n clearTimeout(this.filterTimeout);\n }\n this.filterTimeout = setTimeout(() => {\n this.filterTimeout = null;\n this.applyFilter();\n }, 250);\n });\n }\n\n renderGroups(\n groups: { name: string; value: string; count: number; icon?: React.JSX.Element | string | null }[] | undefined,\n ): React.JSX.Element | null {\n if (!groups?.length) {\n return null;\n }\n\n return (\n <Select\n style={{ minWidth: 120, marginRight: 8, marginTop: 12.5 }}\n variant=\"standard\"\n value={this.state.groupKey || '_'}\n renderValue={value => {\n if (value === '_') {\n value = '';\n }\n const g = groups.find(g => g.value === value);\n return (\n <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n {g?.icon || <div style={{ width: 24 }} />}\n {g?.name || value}\n </div>\n );\n }}\n onChange={e => this.setState({ groupKey: e.target.value === '_' ? '' : e.target.value })}\n >\n {groups.map(g => (\n <MenuItem\n value={g.value || '_'}\n key={g.value || '_'}\n style={{ display: 'flex', alignItems: 'center', gap: 8 }}\n >\n {g.icon || <div style={{ width: 24 }} />}\n {g.name}\n </MenuItem>\n ))}\n </Select>\n );\n }\n\n renderContent(): JSX.Element | JSX.Element[] | null {\n const emptyStyle: React.CSSProperties = {\n padding: 25,\n };\n\n if ((this.props.triggerLoad || 0) !== this.lastTriggerLoad) {\n this.lastTriggerLoad = this.props.triggerLoad || 0;\n setTimeout(() => this.loadData(), 50);\n }\n\n if (this.props.embedded && this.lastPropsFilter !== this.props.filter) {\n this.lastPropsFilter = this.props.filter;\n setTimeout(() => this.applyFilter(), 50);\n }\n // if instance changed\n if (this.props.embedded && this.lastInstance !== this.props.selectedInstance && this.props.selectedInstance) {\n this.lastInstance = this.props.selectedInstance;\n setTimeout(() => this.loadData(), 50);\n }\n const deviceGroups: { name: string; value: string; count: number; icon?: React.JSX.Element | string | null }[] =\n [];\n let list: React.JSX.Element[] | undefined;\n if (!this.props.embedded && !this.state.alive) {\n list = [\n <div\n style={emptyStyle}\n key=\"notAlive\"\n >\n <span>{getTranslation('instanceNotAlive')}</span>\n </div>,\n ];\n } else if (!this.state.devices.length && this.props.selectedInstance) {\n list = [\n <div\n style={emptyStyle}\n key=\"notFound\"\n >\n <span>{getTranslation('noDevicesFoundText')}</span>\n </div>,\n ];\n } else if (this.state.devices.length && !this.state.filteredDevices.length) {\n list = [\n <div\n style={emptyStyle}\n key=\"filtered\"\n >\n <span>{getTranslation('allDevicesFilteredOut')}</span>\n </div>,\n ];\n } else {\n // build a device types list\n let filteredDevices = this.state.filteredDevices;\n if (!this.props.embedded && filteredDevices.find(device => device.group)) {\n deviceGroups.push({\n name: I18n.t('All'),\n value: '',\n count: filteredDevices.length,\n icon: <FilterAltOff />,\n });\n filteredDevices.forEach(device => {\n if (device.group) {\n const type = deviceGroups.find(t => t.value === device.group?.key);\n if (type) {\n type.count++;\n } else {\n const icon = device.group.icon ? <DeviceTypeIcon src={device.group.icon} /> : null;\n\n deviceGroups.push({\n name: this.getText(device.group.name || device.group.key),\n value: device.group.key,\n count: 1,\n icon,\n });\n }\n }\n });\n const unknown = filteredDevices.filter(device => !device.group);\n if (unknown.length) {\n deviceGroups.push({\n name: I18n.t('Unknown'),\n value: '?',\n count: unknown.length,\n icon: <QuestionMark />,\n });\n }\n\n if (this.state.groupKey) {\n // filter out all devices belonging to this group\n if (this.state.groupKey === '?') {\n filteredDevices = filteredDevices.filter(device => !device.group?.key);\n } else {\n filteredDevices = filteredDevices.filter(device => device.group?.key === this.state.groupKey);\n }\n if (!filteredDevices.length) {\n list = [\n <div\n style={emptyStyle}\n key=\"filtered\"\n >\n <span>{getTranslation('allDevicesFilteredOut')}</span>\n </div>,\n ];\n }\n }\n }\n\n if (filteredDevices.length && this.props.selectedInstance) {\n list = filteredDevices.map(device => (\n <DeviceCard\n alive={!!this.state.alive}\n key={device.id}\n id={device.id}\n title={this.getText(device.name)}\n device={device}\n instanceId={this.props.selectedInstance!}\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceHandler={this.deviceHandler}\n controlHandler={this.controlHandler}\n controlStateHandler={this.controlStateHandler}\n socket={this.props.socket}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n />\n ));\n }\n }\n\n if (this.props.embedded) {\n return (\n <>\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </>\n );\n }\n\n return (\n <div style={{ width: '100%', height: '100%', overflow: 'hidden' }}>\n <Toolbar\n variant=\"dense\"\n style={{ backgroundColor: '#777', display: 'flex' }}\n >\n {this.props.title}\n {this.props.selectedInstance === null && this.state.dmInstances ? (\n <FormControl>\n <InputLabel id=\"instance-select-label\">{getTranslation('instanceLabelText')}</InputLabel>\n <Select\n labelId=\"instance-select-label\"\n id=\"instance-select\"\n value={this.state.selectedInstance}\n onChange={event => {\n window.localStorage.setItem('dmSelectedInstance', event.target.value);\n this.setState({ selectedInstance: event.target.value });\n }}\n displayEmpty\n variant=\"standard\"\n sx={{ minWidth: 120 }}\n >\n {Object.keys(this.state.dmInstances).map(([id]) => (\n <MenuItem\n key={id}\n value={id}\n >\n {id}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n ) : null}\n {this.props.selectedInstance ? (\n <Tooltip\n title={getTranslation('refreshTooltip')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <span>\n <IconButton\n onClick={() => this.loadData()}\n disabled={!this.state.alive}\n size=\"small\"\n >\n <Refresh />\n </IconButton>\n </span>\n </Tooltip>\n ) : null}\n {this.state.alive && this.state.instanceInfo?.actions?.length ? (\n <div style={{ marginLeft: 20 }}>\n {this.state.instanceInfo.actions.map(action => (\n <InstanceActionButton\n key={action.id}\n action={action}\n instanceHandler={this.instanceHandler}\n />\n ))}\n </div>\n ) : null}\n\n <div style={{ flexGrow: 1 }} />\n\n {this.renderGroups(deviceGroups)}\n {this.state.alive ? (\n <TextField\n variant=\"standard\"\n style={{ width: 200 }}\n size=\"small\"\n label={getTranslation('filterLabelText')}\n onChange={e => this.handleFilterChange(e.target.value)}\n value={this.state.filter}\n autoComplete=\"off\"\n slotProps={{\n input: {\n autoComplete: 'new-password',\n endAdornment: this.state.filter ? (\n <InputAdornment position=\"end\">\n <IconButton\n tabIndex={-1}\n onClick={() => this.handleFilterChange('')}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n htmlInput: {\n autoComplete: 'off',\n },\n }}\n />\n ) : null}\n </Toolbar>\n <div\n style={{\n width: '100%',\n height: 'calc(100% - 56px)',\n marginTop: 8,\n overflow: 'auto',\n // justifyContent: 'center',\n // alignItems: 'stretch',\n // display: 'grid',\n // columnGap: 8,\n // rowGap: 8,\n ...this.props.style,\n }}\n >\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </div>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"DeviceList.js","sourceRoot":"./src/","sources":["DeviceList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EACH,UAAU,EACV,cAAc,EACd,SAAS,EACT,OAAO,EACP,OAAO,EACP,cAAc,EACd,MAAM,EACN,QAAQ,EACR,WAAW,EACX,UAAU,EACV,GAAG,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO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AQ,EAAC,KAAK;gCAC1B,oBAAC,UAAU,IACP,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAC1C,IAAI,EAAC,KAAK;oCAEV,oBAAC,KAAK,OAAG,CACA,CACA,CACpB,CAAC,CAAC,CAAC,IAAI;yBACX;wBACD,SAAS,EAAE;4BACP,YAAY,EAAE,KAAK;yBACtB;qBACJ,GACH,CACL,CAAC,CAAC,CAAC,IAAI,CACF;YACV,6BACI,KAAK,EAAE;oBACH,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,mBAAmB;oBAC3B,SAAS,EAAE,CAAC;oBACZ,QAAQ,EAAE,MAAM;oBAChB,4BAA4B;oBAC5B,yBAAyB;oBACzB,mBAAmB;oBACnB,gBAAgB;oBAChB,aAAa;oBACb,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK;iBACtB;gBAEA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAC,cAAc,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAI,CAAC,CAAC,CAAC,IAAI;gBACxE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,iCAAM,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAO,CAAC,CAAC,CAAC,IAAI,CACzE,CACJ,CACT,CAAC;IACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\nimport {\n IconButton,\n InputAdornment,\n TextField,\n Toolbar,\n Tooltip,\n LinearProgress,\n Select,\n MenuItem,\n FormControl,\n InputLabel,\n Box,\n} from '@mui/material';\n\nimport { Clear, QuestionMark, Refresh, FilterAltOff } from '@mui/icons-material';\n\nimport { I18n, DeviceTypeIcon } from '@iobroker/adapter-react-v5';\nimport type { DeviceInfo, InstanceDetails } from './protocol/api';\n\nimport DeviceCard, { DeviceCardSkeleton } from './DeviceCard';\nimport { getTranslation } from './Utils';\nimport Communication, { type CommunicationProps, type CommunicationState } from './Communication';\nimport InstanceActionButton from './InstanceActionButton';\n\nimport de from './i18n/de.json';\nimport en from './i18n/en.json';\nimport ru from './i18n/ru.json';\nimport pt from './i18n/pt.json';\nimport nl from './i18n/nl.json';\nimport fr from './i18n/fr.json';\nimport it from './i18n/it.json';\nimport es from './i18n/es.json';\nimport pl from './i18n/pl.json';\nimport uk from './i18n/uk.json';\nimport zhCn from './i18n/zh-cn.json';\n\ninterface DeviceListProps extends CommunicationProps {\n /** Instance to upload images to, like `adapterName.X` */\n uploadImagesToInstance?: string;\n /** Filter devices with this string */\n filter?: string;\n /** If this component is used in GUI with own toolbar. `false` if this list is used with multiple instances and true if only with one (in this case, it will monitor alive itself */\n embedded?: boolean;\n /** If embedded, this text is shown in the toolbar */\n title?: string;\n /** Style of a component that displays all devices */\n style?: React.CSSProperties;\n /** Use small cards for devices */\n smallCards?: boolean;\n /** To trigger the reload of devices, just change this variable */\n triggerLoad?: number;\n}\n\ninterface DeviceListState extends CommunicationState {\n devices: DeviceInfo[];\n totalDevices?: number;\n filter: string;\n instanceInfo: InstanceDetails | null;\n loading: boolean | null;\n alive: boolean | null;\n triggerLoad: number;\n groupKey: string;\n dmInstances: { [instanceName: string]: { title: string; instance: number } } | null;\n apiVersionError: boolean;\n}\n\n/**\n * Device List Component\n */\nexport default class DeviceList extends Communication<DeviceListProps, DeviceListState> {\n static i18nInitialized = false;\n\n private lastInstance: string;\n\n private lastAliveSubscribe = '';\n\n private lastTriggerLoad = 0;\n\n private filterTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private readonly language: ioBroker.Languages = I18n.getLanguage();\n\n constructor(props: DeviceListProps) {\n super(props);\n\n if (!DeviceList.i18nInitialized) {\n DeviceList.i18nInitialized = true;\n I18n.extendTranslations({\n en,\n de,\n ru,\n pt,\n nl,\n fr,\n it,\n es,\n pl,\n uk,\n 'zh-cn': zhCn,\n });\n }\n\n this.state = {\n ...this.state,\n devices: [],\n filter: '',\n instanceInfo: null,\n loading: null,\n alive: null,\n groupKey: '',\n dmInstances: null,\n apiVersionError: false,\n };\n\n this.lastInstance = this.state.selectedInstance;\n this.lastTriggerLoad = this.props.triggerLoad || 0;\n }\n\n private async loadAdapters(): Promise<void> {\n await this.props.socket.waitForFirstConnection();\n\n console.log('Loading adapters...');\n const res = await this.props.socket.getObjectViewSystem('instance', 'system.adapter.', 'system.adapter.\\u9999');\n const dmInstances: { [instanceName: string]: { title: string; instance: number } } = {};\n for (const id in res) {\n if (!res[id].common.supportedMessages?.deviceManager) {\n continue;\n }\n\n const instanceName = id.substring('system.adapter.'.length);\n try {\n // Check if the instance is alive by getting the state alive\n const alive = await this.props.socket.getState(`system.adapter.${instanceName}.alive`);\n if (!alive?.val) {\n continue;\n }\n\n const instance = parseInt(instanceName.split('.').pop() || '0') || 0;\n dmInstances[instanceName] = {\n title: '',\n instance,\n };\n } catch (error) {\n console.error(error);\n }\n }\n\n this.setState({ dmInstances });\n }\n\n async componentDidMount(): Promise<void> {\n let alive = false;\n // If an instance selector must be shown\n if (this.props.selectedInstance === undefined) {\n // show instance selector\n await this.loadAdapters();\n }\n\n if (this.state.alive === null && this.state.selectedInstance) {\n try {\n // check if the instance is alive\n const stateAlive = await this.props.socket.getState(\n `system.adapter.${this.state.selectedInstance}.alive`,\n );\n if (stateAlive?.val) {\n alive = true;\n }\n } catch (error) {\n console.error(error);\n }\n this.lastAliveSubscribe = this.state.selectedInstance;\n this.setState({ alive }, () =>\n this.props.socket.subscribeState(\n `system.adapter.${this.state.selectedInstance}.alive`,\n this.aliveHandler,\n ),\n );\n } else if (this.state.alive !== null) {\n alive = this.state.alive;\n }\n\n if (!this.props.embedded && alive) {\n try {\n const instanceInfo = await this.loadInstanceInfos();\n this.setState({ instanceInfo, apiVersionError: !['v1', 'v2', 'v3'].includes(instanceInfo.apiVersion) });\n } catch (error) {\n console.error(error);\n }\n }\n if (alive) {\n this.loadData();\n }\n }\n\n componentWillUnmount(): void {\n if (this.state.selectedInstance) {\n this.props.socket.unsubscribeState(\n `system.adapter.${this.state.selectedInstance}.alive`,\n this.aliveHandler,\n );\n }\n }\n\n aliveHandler: ioBroker.StateChangeHandler = (id: string, state: ioBroker.State | null | undefined): void => {\n if (this.state.selectedInstance && id === `system.adapter.${this.state.selectedInstance}.alive`) {\n const alive = !!state?.val;\n if (alive !== this.state.alive) {\n this.setState({ alive }, () => {\n if (alive) {\n this.componentDidMount().catch(console.error);\n }\n });\n }\n }\n };\n\n /**\n * Load devices\n */\n override loadData(): void {\n this.setState({ loading: true }, async () => {\n console.log(`Loading devices for ${this.state.selectedInstance}...`);\n let alive = this.state.alive;\n\n if (this.state.selectedInstance !== this.lastAliveSubscribe) {\n if (this.lastAliveSubscribe) {\n // unsubscribe from the old instance\n this.props.socket.unsubscribeState(\n `system.adapter.${this.lastAliveSubscribe}.alive`,\n this.aliveHandler,\n );\n }\n\n this.lastAliveSubscribe = this.state.selectedInstance;\n\n if (this.state.selectedInstance) {\n try {\n // check if the instance is alive\n const stateAlive = await this.props.socket.getState(\n `system.adapter.${this.state.selectedInstance}.alive`,\n );\n if (stateAlive?.val) {\n alive = true;\n }\n } catch (error) {\n console.error(error);\n }\n await this.props.socket.subscribeState(\n `system.adapter.${this.state.selectedInstance}.alive`,\n this.aliveHandler,\n );\n } else {\n alive = false;\n }\n }\n\n let devices: DeviceInfo[] = [];\n try {\n this.setState({ devices, loading: !!alive, alive });\n if (alive) {\n await this.loadDevices((batch, total) => {\n devices = devices.concat(batch);\n this.setState({ devices, loading: true, totalDevices: total });\n console.log(`Loaded ${devices.length} of ${total} devices...`);\n });\n }\n } catch (error) {\n console.error(error);\n devices = [];\n }\n\n this.setState({ devices, loading: false, totalDevices: devices.length });\n console.log(`Loaded ${devices.length} devices for ${this.state.selectedInstance}`);\n });\n }\n\n getText(text: ioBroker.StringOrTranslated): string {\n if (typeof text === 'object') {\n return text[this.language] || text.en;\n }\n\n return text;\n }\n\n handleFilterChange(filter: string): void {\n if (this.filterTimeout) {\n clearTimeout(this.filterTimeout);\n }\n this.filterTimeout = setTimeout(() => {\n this.filterTimeout = null;\n this.setState({ filter });\n }, 250);\n }\n\n renderGroups(\n groups: { name: string; value: string; count: number; icon?: React.JSX.Element | string | null }[] | undefined,\n ): React.JSX.Element | null {\n if (!groups?.length) {\n return null;\n }\n\n return (\n <Select\n style={{ minWidth: 120, marginRight: 8, marginTop: 12.5 }}\n variant=\"standard\"\n value={this.state.groupKey || '_'}\n renderValue={value => {\n if (value === '_') {\n value = '';\n }\n const g = groups.find(g => g.value === value);\n return (\n <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>\n {g?.icon || <div style={{ width: 24 }} />}\n {g?.name || value}\n </div>\n );\n }}\n onChange={e => this.setState({ groupKey: e.target.value === '_' ? '' : e.target.value })}\n >\n {groups.map(g => (\n <MenuItem\n value={g.value || '_'}\n key={g.value || '_'}\n style={{ display: 'flex', alignItems: 'center', gap: 8 }}\n >\n {g.icon || <div style={{ width: 24 }} />}\n {g.name}\n </MenuItem>\n ))}\n </Select>\n );\n }\n\n renderContent(): JSX.Element | JSX.Element[] | null {\n const emptyStyle: React.CSSProperties = {\n padding: 25,\n };\n\n if ((this.props.triggerLoad || 0) !== this.lastTriggerLoad) {\n this.lastTriggerLoad = this.props.triggerLoad || 0;\n setTimeout(() => this.loadData(), 50);\n }\n\n // if instance changed\n if (this.lastInstance !== this.state.selectedInstance) {\n this.lastInstance = this.state.selectedInstance;\n setTimeout(() => this.loadData(), 50);\n }\n if (this.props.selectedInstance && this.props.selectedInstance !== this.state.selectedInstance) {\n setTimeout(() => this.setState({ selectedInstance: this.props.selectedInstance! }), 50);\n }\n const deviceGroups: { name: string; value: string; count: number; icon?: React.JSX.Element | string | null }[] =\n [];\n let list: React.JSX.Element[] | undefined;\n if (!this.props.embedded && !this.state.alive) {\n list = [\n <div\n style={emptyStyle}\n key=\"notAlive\"\n >\n <span>{getTranslation('instanceNotAlive')}</span>\n </div>,\n ];\n } else if (!this.state.devices.length && this.state.selectedInstance && !this.state.loading) {\n list = [\n <div\n style={emptyStyle}\n key=\"notFound\"\n >\n <span>{getTranslation('noDevicesFoundText')}</span>\n </div>,\n ];\n } else {\n // build a device types list\n let filteredDevices = this.state.devices;\n if (!this.state.loading && !this.props.embedded && filteredDevices.find(device => device.group)) {\n deviceGroups.push({\n name: I18n.t('All'),\n value: '',\n count: filteredDevices.length,\n icon: <FilterAltOff />,\n });\n filteredDevices.forEach(device => {\n if (device.group) {\n const type = deviceGroups.find(t => t.value === device.group?.key);\n if (type) {\n type.count++;\n } else {\n const icon = device.group.icon ? <DeviceTypeIcon src={device.group.icon} /> : null;\n\n deviceGroups.push({\n name: this.getText(device.group.name || device.group.key),\n value: device.group.key,\n count: 1,\n icon,\n });\n }\n }\n });\n const unknown = filteredDevices.filter(device => !device.group);\n if (unknown.length) {\n deviceGroups.push({\n name: I18n.t('Unknown'),\n value: '?',\n count: unknown.length,\n icon: <QuestionMark />,\n });\n }\n\n if (this.state.groupKey) {\n // filter out all devices belonging to this group\n if (this.state.groupKey === '?') {\n filteredDevices = filteredDevices.filter(device => !device.group?.key);\n } else {\n filteredDevices = filteredDevices.filter(device => device.group?.key === this.state.groupKey);\n }\n }\n }\n\n if (this.state.selectedInstance) {\n list = filteredDevices.map(device => (\n <DeviceCard\n key={JSON.stringify(device.id)}\n smallCards={this.props.smallCards}\n filter={this.props.embedded ? this.props.filter : this.state.filter}\n alive={!!this.state.alive}\n id={device.id}\n identifierLabel={this.state.instanceInfo?.identifierLabel ?? 'ID'}\n device={device}\n instanceId={this.state.selectedInstance}\n uploadImagesToInstance={this.props.uploadImagesToInstance}\n deviceHandler={this.deviceHandler}\n controlHandler={this.controlHandler}\n controlStateHandler={this.controlStateHandler}\n socket={this.props.socket}\n themeName={this.props.themeName}\n themeType={this.props.themeType}\n theme={this.props.theme}\n isFloatComma={this.props.isFloatComma}\n dateFormat={this.props.dateFormat}\n />\n ));\n if (this.state.loading) {\n const skeletons = (this.state.totalDevices ?? list.length + 1) - list.length;\n for (let i = 0; i < skeletons; i++) {\n list.push(\n <DeviceCardSkeleton\n key={`skeleton-${i}`}\n smallCards={this.props.smallCards}\n theme={this.props.theme}\n />,\n );\n }\n } else if (this.state.devices.length > 0) {\n list.push(\n <Box\n key=\"filtered\"\n sx={{\n padding: '25px',\n '&:not(:first-child)': {\n display: 'none',\n },\n }}\n >\n <span>{getTranslation('allDevicesFilteredOut')}</span>\n </Box>,\n );\n }\n } else {\n list = [\n <div\n style={emptyStyle}\n key=\"selectInstance\"\n >\n <span>{getTranslation('selectInstanceText')}</span>\n </div>,\n ];\n }\n }\n\n if (this.props.embedded) {\n return (\n <>\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {list}\n </>\n );\n }\n\n return (\n <div style={{ width: '100%', height: '100%', overflow: 'hidden' }}>\n <Toolbar\n variant=\"dense\"\n style={{ backgroundColor: '#777', display: 'flex' }}\n >\n {this.props.title}\n {this.props.selectedInstance === undefined && this.state.dmInstances ? (\n <FormControl>\n <InputLabel\n id=\"instance-select-label\"\n style={{ transform: 'translate(0, -9px) scale(0.75)' }}\n >\n {getTranslation('instanceLabelText')}\n </InputLabel>\n <Select\n style={{ marginTop: 0, minWidth: 120 }}\n labelId=\"instance-select-label\"\n id=\"instance-select\"\n value={this.state.selectedInstance}\n onChange={event => {\n window.localStorage.setItem('dmSelectedInstance', event.target.value);\n this.setState({ selectedInstance: event.target.value });\n }}\n displayEmpty\n variant=\"standard\"\n >\n {Object.keys(this.state.dmInstances).map(id => (\n <MenuItem\n key={id}\n value={id}\n >\n {id}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n ) : null}\n {this.state.selectedInstance ? (\n <Tooltip\n title={getTranslation('refreshTooltip')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <span>\n <IconButton\n onClick={() => this.loadData()}\n disabled={!this.state.alive || this.state.apiVersionError}\n size=\"small\"\n >\n <Refresh />\n </IconButton>\n </span>\n </Tooltip>\n ) : null}\n {!this.state.apiVersionError && this.state.alive && this.state.instanceInfo?.actions?.length ? (\n <div style={{ marginLeft: 20 }}>\n {this.state.instanceInfo.actions.map(action => (\n <InstanceActionButton\n key={action.id}\n action={action}\n instanceHandler={this.instanceHandler}\n />\n ))}\n </div>\n ) : null}\n\n <div style={{ flexGrow: 1 }} />\n\n {!this.state.apiVersionError && this.renderGroups(deviceGroups)}\n {!this.state.apiVersionError && this.state.alive ? (\n <TextField\n variant=\"standard\"\n style={{ width: 200 }}\n size=\"small\"\n label={getTranslation('filterLabelText')}\n onChange={e => this.handleFilterChange(e.target.value)}\n value={this.state.filter}\n autoComplete=\"off\"\n slotProps={{\n input: {\n autoComplete: 'new-password',\n endAdornment: this.state.filter ? (\n <InputAdornment position=\"end\">\n <IconButton\n tabIndex={-1}\n onClick={() => this.handleFilterChange('')}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n htmlInput: {\n autoComplete: 'off',\n },\n }}\n />\n ) : null}\n </Toolbar>\n <div\n style={{\n width: '100%',\n height: 'calc(100% - 56px)',\n marginTop: 8,\n overflow: 'auto',\n // justifyContent: 'center',\n // alignItems: 'stretch',\n // display: 'grid',\n // columnGap: 8,\n // rowGap: 8,\n ...this.props.style,\n }}\n >\n {this.state.loading ? <LinearProgress style={{ width: '100%' }} /> : null}\n {this.state.apiVersionError ? <div>{I18n.t('apiVersionError')}</div> : list}\n </div>\n </div>\n );\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
+ import type { Connection, IobTheme } from '@iobroker/adapter-react-v5';
1
2
  import React, { type CSSProperties, type MouseEvent } from 'react';
2
- import type { DeviceStatus, DeviceAction, ActionBase, ConfigConnectionType } from '@iobroker/dm-utils';
3
- import type { IobTheme } from '@iobroker/adapter-react-v5';
3
+ import type { ActionBase, ConfigConnectionType, DeviceAction, DeviceId, DeviceStatus } from './protocol/api';
4
+ import type { StateOrObjectHandler } from './StateOrObjectHandler';
4
5
  export declare const ACTIONS: {
5
6
  STATUS: string;
6
7
  DISABLE: string;
@@ -21,15 +22,17 @@ export interface IconProps {
21
22
  fontSize?: 'small';
22
23
  }
23
24
  interface DeviceStatusProps {
25
+ socket: Connection;
24
26
  status: DeviceStatus | null;
25
- deviceId: string;
27
+ deviceId: DeviceId;
26
28
  connectionType?: ConfigConnectionType;
27
29
  statusAction?: DeviceAction;
28
30
  enabled?: boolean;
29
31
  disableEnableAction?: DeviceAction;
30
- deviceHandler: (deviceId: string, action: ActionBase, refresh: () => void) => () => void;
32
+ deviceHandler: (deviceId: DeviceId, action: ActionBase, refresh: () => void) => () => void;
31
33
  refresh: () => void;
32
34
  theme: IobTheme;
35
+ stateOrObjectHandler: StateOrObjectHandler;
33
36
  }
34
37
  /**
35
38
  * Device Status component