@iobroker/json-config 8.3.9 → 8.3.10
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/README.md +10 -0
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +1 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js +2 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js +2 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +2 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/index.js +1 -1
- package/build/JsonConfigComponent/index.js.map +1 -1
- package/build/types.d.ts +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -694,6 +694,7 @@ Button that sends a request to the current instance (<https://github.com/iobroke
|
|
|
694
694
|
| `timeout` | timeout for request in ms. Default: none. |
|
|
695
695
|
| `onLoaded` | execute the button logic once initially |
|
|
696
696
|
| `controlStyle` | Styles for the button. |
|
|
697
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
697
698
|
|
|
698
699
|
### `setState`
|
|
699
700
|
|
|
@@ -953,6 +954,7 @@ shows the image received from the backend as base64 string
|
|
|
953
954
|
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
|
|
954
955
|
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
|
|
955
956
|
| `sendFirstByClick` | show image first when clicked. `true` - standard text (Click to show) or specific text |
|
|
957
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
956
958
|
|
|
957
959
|
#### Example of code in back-end for `imageSendTo`
|
|
958
960
|
|
|
@@ -985,6 +987,7 @@ The backend must return a plain string (the data to encode).
|
|
|
985
987
|
| `fgColor` | foreground color (default: `"#000000"`) |
|
|
986
988
|
| `bgColor` | background color (default: `"#ffffff"`) |
|
|
987
989
|
| `level` | error correction level: `L`, `M`, `Q`, or `H` (default: `L`) |
|
|
990
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
988
991
|
|
|
989
992
|
#### Example of code in back-end for `qrCodeSendTo`
|
|
990
993
|
|
|
@@ -1032,6 +1035,7 @@ Shows an iframe with a URL received from the backend. (from Admin 7.7.28)
|
|
|
1032
1035
|
| `command` | sendTo command |
|
|
1033
1036
|
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to backend |
|
|
1034
1037
|
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to backend if jsonData is not defined. |
|
|
1038
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
1035
1039
|
|
|
1036
1040
|
The backend must return a URL as a string.
|
|
1037
1041
|
|
|
@@ -1071,6 +1075,7 @@ Shows the drop-down menu with the given from the instance values.
|
|
|
1071
1075
|
| `showAllValues` | show item even if no label was found for it (by multiple), default=`true` |
|
|
1072
1076
|
| `noTranslation` | do not translate label of selects. To use this option, your adapter must implement message handler.The result of command must be an array in form `[{"value": 1, "label": "one"}, ...]` |
|
|
1073
1077
|
| `alsoDependsOn` | by change of which attributes, the command must be resent |
|
|
1078
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
1074
1079
|
|
|
1075
1080
|
The backend handler can return items with an optional `description` field: `[{"value": 1, "label": "one", "description": "Some hint"}, ...]`. The description is shown below the label in the dropdown.
|
|
1076
1081
|
|
|
@@ -1140,6 +1145,7 @@ Shows autocomplete control with the given from the instance values.
|
|
|
1140
1145
|
| `freeSolo` | Set `freeSolo` to `true`, so the textbox can contain any arbitrary value. |
|
|
1141
1146
|
| `alsoDependsOn` | by change of which attributes, the command must be resent |
|
|
1142
1147
|
| `maxLength` | max length of the text in field |
|
|
1148
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
1143
1149
|
|
|
1144
1150
|
To use this option, your adapter must implement a message handler:
|
|
1145
1151
|
|
|
@@ -1158,6 +1164,7 @@ Shows readonly control with the given from the instance values.
|
|
|
1158
1164
|
| `command` | sendTo command |
|
|
1159
1165
|
| `jsonData` | string - `{"subject1": "${data.subject}", "options1": {"host": "${data.host}"}}`. This data will be sent to the backend |
|
|
1160
1166
|
| `data` | object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to the backend if jsonData is not defined. |
|
|
1167
|
+
| `instance` | Instance where to send the request to (e.g. `"admin.0"`). Overrides `oContext.instance`. If not defined, the request is sent to the current adapter instance. |
|
|
1161
1168
|
|
|
1162
1169
|
To use this option, your adapter must implement a message handler:
|
|
1163
1170
|
The result of command must be a string or object with the following parameters:
|
|
@@ -1768,6 +1775,9 @@ The schema is used here: https://github.com/SchemaStore/schemastore/blob/6da29cd
|
|
|
1768
1775
|
### **WORK IN PROGRESS**
|
|
1769
1776
|
-->
|
|
1770
1777
|
## Changelog
|
|
1778
|
+
### 8.3.10 (2026-04-28)
|
|
1779
|
+
- (@GermanBluefox) Added `instance` option for all `sendTo` components to override the target adapter instance
|
|
1780
|
+
|
|
1771
1781
|
### 8.3.9 (2026-04-17)
|
|
1772
1782
|
- (@GermanBluefox) Updated packages
|
|
1773
1783
|
|
|
@@ -29,7 +29,7 @@ export default class ConfigAutocompleteSendTo extends ConfigGeneric {
|
|
|
29
29
|
// Set loading state during sendTo request
|
|
30
30
|
this.setState({ loading: true });
|
|
31
31
|
void this.props.oContext.socket
|
|
32
|
-
.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
32
|
+
.sendTo(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
33
33
|
.then((list) => {
|
|
34
34
|
if (list && Array.isArray(list)) {
|
|
35
35
|
list.forEach(item => selectOptions.push(typeof item === 'string'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigAutocompleteSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigAutocompleteSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAA0C,MAAM,iBAAiB,CAAC;AAWzE,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,aAGrD;IACW,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvE,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;YAC3C,CAAC,C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,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EACxD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,UAAU,EAAE,IAAI,CAAC,UAAU,CACvB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,EACD,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE;oBACP,KAAK,EAAE;wBACH,GAAG,MAAM,CAAC,UAAU;wBACpB,YAAY,EAAE,CACV;4BACK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;gCAC1B,oBAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,CACjB,CACpB,CAAC,CAAC,CAAC,IAAI;4BACP,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAClD,CACN;qBACJ;iBACJ,GACH,CACL,GACH,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, CircularProgress, InputAdornment } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemAutocompleteSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps } from './ConfigGeneric';\nimport type { ConfigAutocompleteState } from './ConfigAutocomplete';\n\ninterface ConfigAutocompleteSendToProps extends ConfigGenericProps {\n schema: ConfigItemAutocompleteSendTo;\n}\n\ninterface ConfigAutocompleteSendToState extends ConfigAutocompleteState {\n loading?: boolean;\n}\n\nexport default class ConfigAutocompleteSendTo extends ConfigGeneric<\n ConfigAutocompleteSendToProps,\n ConfigAutocompleteSendToState\n> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const selectOptions = this.props.schema.options\n ? this.props.schema.options.map((item: any) =>\n typeof item === 'string' ? { label: item, value: item } : JSON.parse(JSON.stringify(item)),\n )\n : [];\n\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n if (typeof dataStr === 'string') {\n data = JSON.parse(dataStr);\n }\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n // Set loading state during sendTo request\n this.setState({ loading: true });\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then((list: unknown) => {\n if (list && Array.isArray(list)) {\n list.forEach(item =>\n selectOptions.push(\n typeof item === 'string'\n ? { label: item, value: item }\n : JSON.parse(JSON.stringify(item)),\n ),\n );\n }\n\n this.reportFilterLabels(selectOptions);\n\n // if __different\n if (Array.isArray(value)) {\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions, loading: false });\n } else {\n this.setState({ value, selectOptions, loading: false });\n }\n })\n .catch(error => {\n console.error('Error in autocompleteSendTo:', error);\n // Clear loading state on error\n this.setState({ loading: false });\n });\n } else if (Array.isArray(value)) {\n // if __different\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.reportFilterLabels(selectOptions);\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.reportFilterLabels(selectOptions);\n this.setState({ value, selectOptions });\n }\n }\n\n /** Report value-to-label mapping to parent table for filtering */\n reportFilterLabels(options: { value: string; label: string }[]): void {\n if (this.props.onFilterLabelUpdate && this.props.table) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of options) {\n if (opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element | null {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n let item;\n const options: { value: string; label: string }[] = this.state.selectOptions\n ? JSON.parse(JSON.stringify(this.state.selectOptions))\n : [];\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_LABEL;\n\n if (isIndeterminate) {\n [...this.state.value]\n .filter(val => !options.find((it: any) => it.value === val))\n .forEach(it => options.push({ label: it.toString(), value: it }));\n\n item = { label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE };\n options.unshift(item);\n } else {\n item =\n this.state.value !== null &&\n this.state.value !== undefined &&\n options.find((item: any) => item.value == this.state.value); // let \"==\" be and not ===\n\n if (this.state.value !== null && this.state.value !== undefined && !item && this.props.schema.freeSolo) {\n item = { value: this.state.value, label: this.state.value };\n options.push(item);\n }\n item = item || null;\n }\n\n if (!options.length) {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value ?? ''}\n error={!!error}\n disabled={disabled}\n slotProps={{\n htmlInput: { maxLength: this.props.schema.maxLength || this.props.schema.max || undefined },\n input: {\n endAdornment: this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n this.setState({ value }, () => this.onChange(this.props.attr, (value || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <Autocomplete\n value={item}\n fullWidth\n freeSolo={!!this.props.schema.freeSolo}\n options={options}\n disabled={disabled}\n isOptionEqualToValue={(option, value) => option.value === value.value}\n filterOptions={(options: { value: string; label: string }[], params) => {\n const filtered = options.filter(option => {\n if (params.inputValue === '') {\n return true;\n }\n return (\n option.label.toLowerCase().includes(params.inputValue.toLowerCase()) ||\n option.value.toLowerCase().includes(params.inputValue.toLowerCase())\n );\n });\n\n if (this.props.schema.freeSolo && params.inputValue !== '') {\n filtered.push({\n label: params.inputValue,\n value: params.inputValue,\n });\n }\n\n return filtered;\n }}\n getOptionLabel={(option: { value: string; label: string }): string => option?.label ?? ''}\n onInputChange={e => {\n if (!e || !this.props.schema.freeSolo) {\n return;\n }\n\n const val = (e.target as HTMLInputElement).value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n onChange={(_, value) => {\n const val = typeof value === 'object' ? (value ? value.value : '') : value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n // inputProps are important and will be given in params\n // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n disabled={disabled}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null}\n {disabled ? null : params.InputProps.endAdornment}\n </>\n ),\n },\n }}\n />\n )}\n />\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigAutocompleteSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigAutocompleteSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAA0C,MAAM,iBAAiB,CAAC;AAWzE,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,aAGrD;IACW,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACvE,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;YAC3C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CACxC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAC7F;YACH,CAAC,CAAC,EAAE,CAAC;QAET,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YAClC,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G,MAAM,CAAC,UAAU;wBACpB,YAAY,EAAE,CACV;4BACK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;gCAC1B,oBAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,CACjB,CACpB,CAAC,CAAC,CAAC,IAAI;4BACP,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAClD,CACN;qBACJ;iBACJ,GACH,CACL,GACH,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Autocomplete, TextField, CircularProgress, InputAdornment } from '@mui/material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemAutocompleteSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps } from './ConfigGeneric';\nimport type { ConfigAutocompleteState } from './ConfigAutocomplete';\n\ninterface ConfigAutocompleteSendToProps extends ConfigGenericProps {\n schema: ConfigItemAutocompleteSendTo;\n}\n\ninterface ConfigAutocompleteSendToState extends ConfigAutocompleteState {\n loading?: boolean;\n}\n\nexport default class ConfigAutocompleteSendTo extends ConfigGeneric<\n ConfigAutocompleteSendToProps,\n ConfigAutocompleteSendToState\n> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n const selectOptions = this.props.schema.options\n ? this.props.schema.options.map((item: any) =>\n typeof item === 'string' ? { label: item, value: item } : JSON.parse(JSON.stringify(item)),\n )\n : [];\n\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n if (typeof dataStr === 'string') {\n data = JSON.parse(dataStr);\n }\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n // Set loading state during sendTo request\n this.setState({ loading: true });\n\n void this.props.oContext.socket\n .sendTo(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then((list: unknown) => {\n if (list && Array.isArray(list)) {\n list.forEach(item =>\n selectOptions.push(\n typeof item === 'string'\n ? { label: item, value: item }\n : JSON.parse(JSON.stringify(item)),\n ),\n );\n }\n\n this.reportFilterLabels(selectOptions);\n\n // if __different\n if (Array.isArray(value)) {\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions, loading: false });\n } else {\n this.setState({ value, selectOptions, loading: false });\n }\n })\n .catch(error => {\n console.error('Error in autocompleteSendTo:', error);\n // Clear loading state on error\n this.setState({ loading: false });\n });\n } else if (Array.isArray(value)) {\n // if __different\n selectOptions.unshift({\n label: I18n.t(ConfigGeneric.DIFFERENT_LABEL),\n value: ConfigGeneric.DIFFERENT_VALUE,\n });\n this.reportFilterLabels(selectOptions);\n this.setState({ value: ConfigGeneric.DIFFERENT_VALUE, selectOptions });\n } else {\n this.reportFilterLabels(selectOptions);\n this.setState({ value, selectOptions });\n }\n }\n\n /** Report value-to-label mapping to parent table for filtering */\n reportFilterLabels(options: { value: string; label: string }[]): void {\n if (this.props.onFilterLabelUpdate && this.props.table) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of options) {\n if (opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(error: unknown, disabled: boolean): JSX.Element | null {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n let item;\n const options: { value: string; label: string }[] = this.state.selectOptions\n ? JSON.parse(JSON.stringify(this.state.selectOptions))\n : [];\n const isIndeterminate = Array.isArray(this.state.value) || this.state.value === ConfigGeneric.DIFFERENT_LABEL;\n\n if (isIndeterminate) {\n [...this.state.value]\n .filter(val => !options.find((it: any) => it.value === val))\n .forEach(it => options.push({ label: it.toString(), value: it }));\n\n item = { label: I18n.t(ConfigGeneric.DIFFERENT_LABEL), value: ConfigGeneric.DIFFERENT_VALUE };\n options.unshift(item);\n } else {\n item =\n this.state.value !== null &&\n this.state.value !== undefined &&\n options.find((item: any) => item.value == this.state.value); // let \"==\" be and not ===\n\n if (this.state.value !== null && this.state.value !== undefined && !item && this.props.schema.freeSolo) {\n item = { value: this.state.value, label: this.state.value };\n options.push(item);\n }\n item = item || null;\n }\n\n if (!options.length) {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={this.state.value ?? ''}\n error={!!error}\n disabled={disabled}\n slotProps={{\n htmlInput: { maxLength: this.props.schema.maxLength || this.props.schema.max || undefined },\n input: {\n endAdornment: this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null,\n },\n }}\n onChange={e => {\n const value = e.target.value;\n this.setState({ value }, () => this.onChange(this.props.attr, (value || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <Autocomplete\n value={item}\n fullWidth\n freeSolo={!!this.props.schema.freeSolo}\n options={options}\n disabled={disabled}\n isOptionEqualToValue={(option, value) => option.value === value.value}\n filterOptions={(options: { value: string; label: string }[], params) => {\n const filtered = options.filter(option => {\n if (params.inputValue === '') {\n return true;\n }\n return (\n option.label.toLowerCase().includes(params.inputValue.toLowerCase()) ||\n option.value.toLowerCase().includes(params.inputValue.toLowerCase())\n );\n });\n\n if (this.props.schema.freeSolo && params.inputValue !== '') {\n filtered.push({\n label: params.inputValue,\n value: params.inputValue,\n });\n }\n\n return filtered;\n }}\n getOptionLabel={(option: { value: string; label: string }): string => option?.label ?? ''}\n onInputChange={e => {\n if (!e || !this.props.schema.freeSolo) {\n return;\n }\n\n const val = (e.target as HTMLInputElement).value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n onChange={(_, value) => {\n const val = typeof value === 'object' ? (value ? value.value : '') : value;\n if (val !== this.state.value) {\n this.setState({ value: val }, () => this.onChange(this.props.attr, val));\n }\n }}\n renderInput={params => (\n <TextField\n variant=\"standard\"\n {...params}\n // inputProps are important and will be given in params\n // inputProps={{maxLength: this.props.schema.maxLength || this.props.schema.max || undefined}}\n error={!!error}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n disabled={disabled}\n slotProps={{\n input: {\n ...params.InputProps,\n endAdornment: (\n <>\n {this.state.loading ? (\n <InputAdornment position=\"end\">\n <CircularProgress size={20} />\n </InputAdornment>\n ) : null}\n {disabled ? null : params.InputProps.endAdornment}\n </>\n ),\n },\n }}\n />\n )}\n />\n );\n }\n}\n"]}
|
|
@@ -44,7 +44,7 @@ export default class ConfigIFrameSendTo extends ConfigGeneric {
|
|
|
44
44
|
data = null;
|
|
45
45
|
}
|
|
46
46
|
void this.props.oContext.socket
|
|
47
|
-
.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
47
|
+
.sendTo(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
48
48
|
.then(url => this.setState({ url: url || '' }));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigIFrameSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigIFrameSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAWlG,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,aAA+D;IACnG,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEjC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAqB,CAAC;IACjD,QAAQ,GAAgC,IAAI,CAAC;IAErD,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE;gBACjD,IAAI,KAAK,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;oBACnF,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC;oBAC9C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,GAAG,EAAE,CAAC;oBAChC,UAAU,CAAC,GAAG,EAAE;wBACZ,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;4BACzB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,GAAG,UAAU,CAAC;wBAC5C,CAAC;oBACL,CAAC,EAAE,CAAC,CAAC,CAAC;gBACV,CAAC;gBACD,IAA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oBACb,MAAM,EAAE,MAAM;oBACd,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC;oBAC/C,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU;oBAC/B,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;iBAC9C,EACD,GAAG,EAAE,IAAI,CAAC,SAAS,EACnB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EACnB,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,IAAI,KAAK,EAC3D,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,GAC/C;YACD,QAAQ,IAAI,CACT,6BACI,KAAK,EAAE;oBACH,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,CAAC;oBACN,IAAI,EAAE,CAAC;oBACP,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;oBACd,eAAe,EAAE,0BAA0B;oBAC3C,MAAM,EAAE,aAAa;oBACrB,MAAM,EAAE,CAAC;iBACZ,GACH,CACL,CACC,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport type { ConfigItemIFrameSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigIFrameSendToProps extends ConfigGenericProps {\n schema: ConfigItemIFrameSendTo;\n}\n\ninterface ConfigIFrameSendToState extends ConfigGenericState {\n url?: string;\n isVisible?: boolean;\n}\n\nexport default class ConfigIFrameSendTo extends ConfigGeneric<ConfigIFrameSendToProps, ConfigIFrameSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n private iframeRef = React.createRef<HTMLIFrameElement>();\n private observer: IntersectionObserver | null = null;\n\n componentDidMount(): void {\n super.componentDidMount();\n\n this.askInstance();\n\n if (this.props.schema.reloadOnShow) {\n this.observer = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting && this.state.isVisible === false && this.iframeRef.current) {\n const currentSrc = this.iframeRef.current.src;\n this.iframeRef.current.src = '';\n setTimeout(() => {\n if (this.iframeRef.current) {\n this.iframeRef.current.src = currentSrc;\n }\n }, 0);\n }\n this.setState({ isVisible: entry.isIntersecting });\n });\n if (this.iframeRef.current) {\n this.observer.observe(this.iframeRef.current);\n }\n }\n }\n\n askInstance(): void {\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n if (dataStr) {\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n\n void this.props.oContext.socket\n .sendTo(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(url => this.setState({ url: url || '' }));\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n renderItem(error: boolean, disabled: boolean /*, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.url === undefined) {\n return null;\n }\n\n return (\n <div style={{ position: 'relative', width: '100%', height: '100%' }}>\n <iframe\n style={{\n width: '100%',\n height: '100%',\n borderWidth: this.props.schema.frameBorder ?? 0,\n ...this.props.schema.innerStyle,\n border: error ? '1px solid red' : undefined,\n }}\n ref={this.iframeRef}\n src={this.state.url}\n allowFullScreen={this.props.schema.allowFullscreen ?? false}\n sandbox={this.props.schema.sandbox}\n loading={this.props.schema.lazyLoad ?? 'lazy'}\n />\n {disabled && (\n <div\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'rgba(255, 255, 255, 0.3)',\n cursor: 'not-allowed',\n zIndex: 1,\n }}\n />\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -29,7 +29,8 @@ export default class ConfigImageSendTo extends ConfigGeneric {
|
|
|
29
29
|
data = null;
|
|
30
30
|
}
|
|
31
31
|
this.setState({ loading: true }, () => this.props.oContext.socket
|
|
32
|
-
.sendTo(
|
|
32
|
+
.sendTo(this.props.schema.instance ||
|
|
33
|
+
`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
33
34
|
.then(image => this.setState({ image: image || '' })));
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigImageSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigImageSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGxD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAWlG,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,aAA6D;IAChG,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,iBAAiB;QACb,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACtC,IAAI,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;IACL,CAAC;IAED,W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AED,OAAO,CACH,oBAAC,IAAI,IACD,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAC9C,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACrB,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GACvF,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { CircularProgress } from '@mui/material';\nimport { I18n, Icon } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemImageSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigImageSendToProps extends ConfigGenericProps {\n schema: ConfigItemImageSendTo;\n}\n\ninterface ConfigImageSendToState extends ConfigGenericState {\n image?: string;\n loading?: boolean;\n}\n\nexport default class ConfigImageSendTo extends ConfigGeneric<ConfigImageSendToProps, ConfigImageSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n componentDidMount(): void {\n super.componentDidMount();\n\n if (!this.props.schema.sendFirstByClick) {\n this.askInstance();\n }\n }\n\n askInstance(): void {\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n if (dataStr) {\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n this.setState({ loading: true }, () =>\n this.props.oContext.socket\n .sendTo(\n this.props.schema.instance ||\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(image => this.setState({ image: image || '' })),\n );\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n if (!this.props.schema.sendFirstByClick || this.state.image !== undefined) {\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n }\n this.initialized = true;\n }\n }\n\n if (!this.state.image && this.props.schema.sendFirstByClick) {\n return (\n <div\n style={{\n width: this.props.schema.width || '100%',\n height: this.props.schema.height,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n cursor: this.state.loading ? 'default' : 'pointer',\n }}\n onClick={() => !this.state.loading && this.askInstance()}\n >\n {this.state.loading ? (\n <CircularProgress />\n ) : typeof this.props.schema.sendFirstByClick === 'boolean' ? (\n I18n.t('ra_Click to show')\n ) : (\n this.getText(this.props.schema.sendFirstByClick, this.props.schema.noTranslation)\n )}\n </div>\n );\n }\n\n if (this.state.image === undefined) {\n return null;\n }\n\n return (\n <Icon\n title={this.getText(this.props.schema.tooltip)}\n src={this.state.image}\n style={{ width: this.props.schema.width || '100%', height: this.props.schema.height }}\n />\n );\n }\n}\n"]}
|
|
@@ -31,7 +31,8 @@ export default class ConfigQrCodeSendTo extends ConfigGeneric {
|
|
|
31
31
|
data = null;
|
|
32
32
|
}
|
|
33
33
|
this.setState({ loading: true }, () => this.props.oContext.socket
|
|
34
|
-
.sendTo(
|
|
34
|
+
.sendTo(this.props.schema.instance ||
|
|
35
|
+
`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
35
36
|
.then(qrData => this.setState({ qrData: qrData || '', loading: false })));
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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CAAC,OAAO,IAAI,OAAO;gBACrD,OAAO;gBACP,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;aACjB;YAED,oBAAC,eAAe,IACZ,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,EAC9C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACxB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAC5B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAClC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAChC,CACA,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { CircularProgress } from '@mui/material';\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type QRCode from 'react-qr-code';\nimport type { ConfigItemQrCodeSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\ninterface ConfigQrCodeSendToProps extends ConfigGenericProps {\n schema: ConfigItemQrCodeSendTo;\n}\n\ninterface ConfigQrCodeSendToState extends ConfigGenericState {\n qrData?: string;\n loading?: boolean;\n QRCode: typeof QRCode | null;\n}\n\nexport default class ConfigQrCodeSendTo extends ConfigGeneric<ConfigQrCodeSendToProps, ConfigQrCodeSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n const module = await import('react-qr-code');\n this.setState({ QRCode: module.default });\n if (!this.props.schema.sendFirstByClick) {\n this.askInstance();\n }\n }\n\n askInstance(): void {\n if (this.props.alive) {\n let data = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n if (dataStr) {\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${JSON.stringify(data)}`);\n }\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n this.setState({ loading: true }, () =>\n this.props.oContext.socket\n .sendTo(\n this.props.schema.instance ||\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(qrData => this.setState({ qrData: qrData || '', loading: false })),\n );\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n renderItem(): JSX.Element | null {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n if (!this.props.schema.sendFirstByClick || this.state.qrData !== undefined) {\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n }\n this.initialized = true;\n }\n }\n\n if (!this.state.qrData && this.props.schema.sendFirstByClick) {\n return (\n <div\n style={{\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n cursor: this.state.loading ? 'default' : 'pointer',\n }}\n onClick={() => !this.state.loading && this.askInstance()}\n >\n {this.state.loading ? (\n <CircularProgress />\n ) : typeof this.props.schema.sendFirstByClick === 'boolean' ? (\n I18n.t('ra_Click to show')\n ) : (\n this.getText(this.props.schema.sendFirstByClick, this.props.schema.noTranslation)\n )}\n </div>\n );\n }\n\n const QRCodeComponent = this.state.QRCode;\n if (!QRCodeComponent || this.state.qrData === undefined) {\n return null;\n }\n // Quiet zone: QR spec (ISO 18004) requires min 4 modules.\n // ~15% of size ensures sufficient quiet zone, minimum 32px\n const padding = Math.max(32, Math.round((this.props.schema.size || 256) * 0.15));\n\n return (\n <div\n style={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: this.props.schema.bgColor || 'white',\n padding,\n width: '100%',\n height: '100%',\n }}\n >\n <QRCodeComponent\n title={this.getText(this.props.schema.tooltip)}\n value={this.state.qrData}\n size={this.props.schema.size}\n fgColor={this.props.schema.fgColor}\n bgColor={this.props.schema.bgColor}\n level={this.props.schema.level}\n />\n </div>\n );\n }\n}\n"]}
|
|
@@ -28,7 +28,8 @@ class ConfigSelectSendTo extends ConfigGeneric {
|
|
|
28
28
|
}
|
|
29
29
|
this.setState({ running: true }, () => {
|
|
30
30
|
void this.props.oContext.socket
|
|
31
|
-
.sendTo(
|
|
31
|
+
.sendTo(this.props.schema.instance ||
|
|
32
|
+
`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
32
33
|
.then(list => {
|
|
33
34
|
this.reportFilterLabels(list);
|
|
34
35
|
this.setState({ list, running: false });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSelectSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelectSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,cAAc,EACd,UAAU,EACV,aAAa,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,SAAS,EAAE,GAAG;KACjB;CACJ,CAAC;AAgDF,MAAM,kBAAmB,SAAQ,aAA+D;IACpF,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP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,oBAAC,YAAY,IACT,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAC/B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EACvC,SAAS,EAAE;4BACP,SAAS,EAAE;gCACP,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;6BACpE;yBACJ,GACH,CACK,CACd,CAAC;YACN,CAAC,CAAC,CACG;YACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n MenuItem,\n FormHelperText,\n FormControl,\n Select,\n TextField,\n CircularProgress,\n ListItemText,\n Checkbox,\n Chip,\n Box,\n InputAdornment,\n IconButton,\n ListSubheader,\n} from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelectSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n menuPaper: {\n maxHeight: 800,\n },\n};\n\n/*\nto use this option, your adapter must implement listUart message\n\nadapter.on('message', obj => {\n if (obj) {\n switch (obj.command) {\n case 'command':\n if (obj.callback) {\n try {\n const serialport = require('serialport');\n if (serialport) {\n // read all found serial ports\n serialport.list()\n .then(ports => {\n adapter.log.info('List of port: ' + JSON.stringify(ports));\n adapter.sendTo(obj.from, obj.command, ports.map(item =>\n ({label: item.path, value: item.path})), obj.callback);\n })\n .catch(e => {\n adapter.sendTo(obj.from, obj.command, [], obj.callback);\n adapter.log.error(e)\n });\n } else {\n adapter.log.warn('Module serialport is not available');\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n } catch (e) {\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n }\n\n break;\n }\n }\n});\n */\n\ninterface ConfigSelectSendToProps extends ConfigGenericProps {\n schema: ConfigItemSelectSendTo;\n}\n\ninterface ConfigSelectSendToState extends ConfigGenericState {\n list?: { label: string; value: string; hidden?: boolean; group?: boolean; description?: string }[];\n running?: boolean;\n}\n\nclass ConfigSelectSendTo extends ConfigGeneric<ConfigSelectSendToProps, ConfigSelectSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n if (this.props.alive) {\n let data: Record<string, any> | undefined = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n this.setState({ running: true }, () => {\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(list => {\n this.reportFilterLabels(list);\n this.setState({ list, running: false });\n })\n .catch(e => {\n console.error(`Cannot send command: ${e}`);\n });\n });\n } else {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n this.setState({ value, running: false });\n }\n }\n\n /** Report value-to-label mapping to parent table for filtering */\n reportFilterLabels(list: { label: string; value: string }[] | undefined): void {\n if (this.props.onFilterLabelUpdate && this.props.table && Array.isArray(list)) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of list) {\n if (opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n _getValue(): string | string[] {\n let value: string | string[] | null | undefined =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n renderItem(error: unknown, disabled: boolean /* , defaultValue */): JSX.Element | string {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n const value = this._getValue();\n\n if (!this.props.alive || (!this.state.running && !Array.isArray(this.state.list))) {\n if (this.props.schema.multiple || this.props.schema.manual === false) {\n return I18n.t('ra_Cannot retrieve options, as instance is offline');\n }\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={value}\n error={!!error}\n disabled={!!disabled}\n onChange={e => {\n const value_ = e.target.value;\n this.setState({ value: value_ }, () => this.onChange(this.props.attr, (value_ || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n slotProps={{\n input: {\n endAdornment:\n this.state.value && !this.props.schema.noClearButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={() =>\n this.setState({ value: '' }, () => this.onChange(this.props.attr, ''))\n }\n >\n <CloseIcon />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n />\n );\n }\n\n if (this.state.running) {\n return <CircularProgress size=\"24\" />;\n }\n\n const selectOptions = this.state.list.filter(item => {\n if (!item.hidden) {\n return true;\n }\n if (this.props.custom) {\n return !this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n return !this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n });\n\n const item = selectOptions.find(it => it.value === value);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n // MenuProps={this.props.schema.multiple ? { classes: { paper: this.props.classes.menuPaper } } : undefined}\n sx={{\n '&.MuiSelect-paper': this.props.schema.multiple ? styles.menuPaper : undefined,\n }}\n value={value}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </Box>\n ) : (\n this.getText(item?.label || (val as string), this.props.schema.noTranslation)\n )\n }\n onChange={e => {\n const mayBePromise = this.onChange(this.props.attr, e.target.value);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader key={i}>\n <div>{this.getText(it.label, this.props.schema.noTranslation)}</div>\n {it.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {this.getText(it.description)}\n </div>\n ) : null}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n <ListItemText\n primary={this.getText(it.label)}\n secondary={this.getText(it.description)}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\n />\n </MenuItem>\n );\n })}\n </Select>\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n );\n }\n}\n\nexport default ConfigSelectSendTo;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigSelectSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSelectSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,WAAW,EACX,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,cAAc,EACd,UAAU,EACV,aAAa,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,SAAS,EAAE,GAAG;KACjB;CACJ,CAAC;AAgDF,MAAM,kBAA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IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CACzC,CAAC;wBACN,CAAC,GACH,CACL,CAAC,CAAC,CAAC,IAAI;oBACR,oBAAC,YAAY,IACT,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAC/B,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EACvC,SAAS,EAAE;4BACP,SAAS,EAAE;gCACP,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;6BACpE;yBACJ,GACH,CACK,CACd,CAAC;YACN,CAAC,CAAC,CACG;YACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACtB,oBAAC,cAAc,QACV,IAAI,CAAC,UAAU,CACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAC1B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAClC,CACY,CACpB,CAAC,CAAC,CAAC,IAAI,CACE,CACjB,CAAC;IACN,CAAC;CACJ;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport {\n InputLabel,\n MenuItem,\n FormHelperText,\n FormControl,\n Select,\n TextField,\n CircularProgress,\n ListItemText,\n Checkbox,\n Chip,\n Box,\n InputAdornment,\n IconButton,\n ListSubheader,\n} from '@mui/material';\n\nimport { Close as CloseIcon } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSelectSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n menuPaper: {\n maxHeight: 800,\n },\n};\n\n/*\nto use this option, your adapter must implement listUart message\n\nadapter.on('message', obj => {\n if (obj) {\n switch (obj.command) {\n case 'command':\n if (obj.callback) {\n try {\n const serialport = require('serialport');\n if (serialport) {\n // read all found serial ports\n serialport.list()\n .then(ports => {\n adapter.log.info('List of port: ' + JSON.stringify(ports));\n adapter.sendTo(obj.from, obj.command, ports.map(item =>\n ({label: item.path, value: item.path})), obj.callback);\n })\n .catch(e => {\n adapter.sendTo(obj.from, obj.command, [], obj.callback);\n adapter.log.error(e)\n });\n } else {\n adapter.log.warn('Module serialport is not available');\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n } catch (e) {\n adapter.sendTo(obj.from, obj.command, [{label: 'Not available', value: ''}], obj.callback);\n }\n }\n\n break;\n }\n }\n});\n */\n\ninterface ConfigSelectSendToProps extends ConfigGenericProps {\n schema: ConfigItemSelectSendTo;\n}\n\ninterface ConfigSelectSendToState extends ConfigGenericState {\n list?: { label: string; value: string; hidden?: boolean; group?: boolean; description?: string }[];\n running?: boolean;\n}\n\nclass ConfigSelectSendTo extends ConfigGeneric<ConfigSelectSendToProps, ConfigSelectSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n if (this.props.alive) {\n let data: Record<string, any> | undefined = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n\n if (data === undefined) {\n data = null;\n }\n this.setState({ running: true }, () => {\n void this.props.oContext.socket\n .sendTo(\n this.props.schema.instance ||\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(list => {\n this.reportFilterLabels(list);\n this.setState({ list, running: false });\n })\n .catch(e => {\n console.error(`Cannot send command: ${e}`);\n });\n });\n } else {\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n\n this.setState({ value, running: false });\n }\n }\n\n /** Report value-to-label mapping to parent table for filtering */\n reportFilterLabels(list: { label: string; value: string }[] | undefined): void {\n if (this.props.onFilterLabelUpdate && this.props.table && Array.isArray(list)) {\n const valueToLabel: Record<string, string> = {};\n for (const opt of list) {\n if (opt.value !== ConfigGeneric.DIFFERENT_VALUE) {\n valueToLabel[opt.value] = opt.label;\n }\n }\n this.props.onFilterLabelUpdate(this.props.attr, valueToLabel);\n }\n }\n\n getContext(): string {\n const localContext: Record<string, any> = {};\n\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n\n return JSON.stringify(localContext);\n }\n\n _getValue(): string | string[] {\n let value: string | string[] | null | undefined =\n this.state.value === null || this.state.value === undefined\n ? ConfigGeneric.getValue(this.props.data, this.props.attr)\n : this.state.value;\n\n if (this.props.schema.multiple) {\n if (typeof value === 'string') {\n value = [value];\n } else if (value === null || value === undefined) {\n value = [];\n }\n }\n\n return value;\n }\n\n renderItem(error: unknown, disabled: boolean /* , defaultValue */): JSX.Element | string {\n if (this.props.alive) {\n const localContext = this.getContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n const value = this._getValue();\n\n if (!this.props.alive || (!this.state.running && !Array.isArray(this.state.list))) {\n if (this.props.schema.multiple || this.props.schema.manual === false) {\n return I18n.t('ra_Cannot retrieve options, as instance is offline');\n }\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n value={value}\n error={!!error}\n disabled={!!disabled}\n onChange={e => {\n const value_ = e.target.value;\n this.setState({ value: value_ }, () => this.onChange(this.props.attr, (value_ || '').trim()));\n }}\n placeholder={this.getText(this.props.schema.placeholder)}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n slotProps={{\n input: {\n endAdornment:\n this.state.value && !this.props.schema.noClearButton ? (\n <InputAdornment position=\"end\">\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={() =>\n this.setState({ value: '' }, () => this.onChange(this.props.attr, ''))\n }\n >\n <CloseIcon />\n </IconButton>\n </InputAdornment>\n ) : null,\n },\n }}\n />\n );\n }\n\n if (this.state.running) {\n return <CircularProgress size=\"24\" />;\n }\n\n const selectOptions = this.state.list.filter(item => {\n if (!item.hidden) {\n return true;\n }\n if (this.props.custom) {\n return !this.executeCustom(\n item.hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.arrayIndex,\n this.props.globalData,\n );\n }\n return !this.execute(\n item.hidden,\n this.props.schema.default,\n this.props.data,\n this.props.arrayIndex,\n this.props.globalData,\n );\n });\n\n const item = selectOptions.find(it => it.value === value);\n\n return (\n <FormControl\n variant=\"standard\"\n fullWidth\n >\n {this.props.schema.label ? <InputLabel>{this.getText(this.props.schema.label)}</InputLabel> : null}\n <Select\n variant=\"standard\"\n error={!!error}\n multiple={this.props.schema.multiple}\n disabled={!!disabled}\n // MenuProps={this.props.schema.multiple ? { classes: { paper: this.props.classes.menuPaper } } : undefined}\n sx={{\n '&.MuiSelect-paper': this.props.schema.multiple ? styles.menuPaper : undefined,\n }}\n value={value}\n renderValue={(val: string | string[]) =>\n this.props.schema.multiple ? (\n <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>\n {(val as string[]).map((v: string) => {\n const it = selectOptions.find(_item => _item.value === v);\n if (it || this.props.schema.showAllValues !== false) {\n const label = it?.label || v;\n return (\n <Chip\n key={v}\n label={label}\n />\n );\n }\n return null;\n })}\n </Box>\n ) : (\n this.getText(item?.label || (val as string), this.props.schema.noTranslation)\n )\n }\n onChange={e => {\n const mayBePromise = this.onChange(this.props.attr, e.target.value);\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n }}\n >\n {selectOptions.map((it, i) => {\n if (it.group) {\n return (\n <ListSubheader key={i}>\n <div>{this.getText(it.label, this.props.schema.noTranslation)}</div>\n {it.description ? (\n <div style={{ opacity: 0.7, fontStyle: 'italic', fontSize: 'smaller' }}>\n {this.getText(it.description)}\n </div>\n ) : null}\n </ListSubheader>\n );\n }\n return (\n <MenuItem\n key={i}\n value={it.value}\n >\n {this.props.schema.multiple ? (\n <Checkbox\n checked={value.includes(it.value)}\n onClick={() => {\n const _value = JSON.parse(JSON.stringify(this._getValue()));\n const pos = value.indexOf(it.value);\n if (pos !== -1) {\n _value.splice(pos, 1);\n } else {\n _value.push(it.value);\n _value.sort();\n }\n this.setState({ value: _value }, () =>\n this.onChange(this.props.attr, _value),\n );\n }}\n />\n ) : null}\n <ListItemText\n primary={this.getText(it.label)}\n secondary={this.getText(it.description)}\n slotProps={{\n secondary: {\n style: { fontSize: 'smaller', fontStyle: 'italic', opacity: 0.7 },\n },\n }}\n />\n </MenuItem>\n );\n })}\n </Select>\n {this.props.schema.help ? (\n <FormHelperText>\n {this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n </FormHelperText>\n ) : null}\n </FormControl>\n );\n }\n}\n\nexport default ConfigSelectSendTo;\n"]}
|
|
@@ -204,7 +204,7 @@ export default class ConfigSendto extends ConfigGeneric {
|
|
|
204
204
|
}, parseInt(this.props.schema.timeout, 10) || 10000);
|
|
205
205
|
}
|
|
206
206
|
void this.props.oContext.socket
|
|
207
|
-
.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
207
|
+
.sendTo(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
208
208
|
.then(async (response) => {
|
|
209
209
|
if (timeout) {
|
|
210
210
|
clearTimeout(timeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSendto.js","sourceRoot":"./src/","sources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AC,MAAM,CAAC,YAAY,IAAI,SAAS,CAAC,EAAE,EAChF,QAAQ,EAAE,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EACvC,SAAS,EAAE,IAAI,EACf,KAAK,EACD,IAAI,CAAC,KAAK,CAAC,KAAK;oBACZ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE;oBAC7C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAE5C,OAAO,EAAE,GAAG,EAAE;oBACV,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;wBAC5B,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC3C,CAAC;yBAAM,CAAC;wBACJ,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACpB,CAAC;gBACL,CAAC;gBAEA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CACnD,oBAAC,gBAAgB,IACb,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,GAC3B,CACL,CAAC,CAAC,CAAC,IAAI;gBACP,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAClE;YACR,IAAI,CAAC,iBAAiB,EAAE;YACxB,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,gBAAgB,EAAE,CACtB,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Button, CircularProgress } from '@mui/material';\n\nimport { Warning as IconWarning, Error as IconError, Info as IconInfo } from '@mui/icons-material';\n\nimport { DialogConfirm, DialogError, DialogMessage, I18n, copy } from '@iobroker/adapter-react-v5';\n\nimport type { BackEndCommand, ConfigItemSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport Editor from './wrapper/Components/Editor';\nimport CustomModal from './wrapper/Components/CustomModal';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\nfunction ip2int(ip: string): number {\n return ip.split('.').reduce((ipInt, octet) => (ipInt << 8) + parseInt(octet, 10), 0) >>> 0;\n}\n\n// copied from iobroker.admin/src-rx/src/Utils.js\nfunction findNetworkAddressOfHost(obj: Record<string, any>, localIp: string): string {\n const networkInterfaces = obj?.native?.hardware?.networkInterfaces;\n if (!networkInterfaces) {\n return null;\n }\n\n let hostIp: string | undefined;\n\n // check ipv4 addresses\n Object.keys(networkInterfaces).forEach(inter =>\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n if (localIp.includes(':') && ip.family !== 'IPv6') {\n return;\n }\n if (localIp.includes('.') && !localIp.match(/[^.\\d]/) && ip.family !== 'IPv4') {\n return;\n }\n // if ip4 and not docker or wsl\n if (\n ip.family === 'IPv4' &&\n !ip.address.startsWith('172') &&\n (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\\d]/))\n ) {\n // if DNS name\n hostIp = ip.address;\n } else if (!hostIp) {\n if (\n ip.family === 'IPv4' &&\n localIp.includes('.') &&\n (ip2int(localIp) & ip2int(ip.netmask)) === (ip2int(ip.address) & ip2int(ip.netmask))\n ) {\n hostIp = ip.address;\n } else {\n hostIp = ip.address;\n }\n }\n }),\n );\n\n // check ipv6 addresses\n if (!hostIp) {\n Object.keys(networkInterfaces).forEach(inter =>\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n if (localIp.includes(':') && ip.family !== 'IPv6') {\n return;\n }\n if (localIp.includes('.') && !localIp.match(/[^.\\d]/) && ip.family !== 'IPv4') {\n return;\n }\n if (\n ip.family === 'IPv6' &&\n (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\\d]/))\n ) {\n // if DNS name\n hostIp = ip.address;\n } else if (!hostIp) {\n if (\n ip.family === 'IPv4' &&\n localIp.includes('.') &&\n (ip2int(localIp) & ip2int(ip.netmask)) === (ip2int(ip.address) & ip2int(ip.netmask))\n ) {\n hostIp = ip.address;\n } else {\n hostIp = ip.address;\n }\n }\n }),\n );\n }\n\n if (!hostIp) {\n Object.keys(networkInterfaces).forEach(inter => {\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n if (localIp.includes(':') && ip.family !== 'IPv6') {\n return;\n }\n if (localIp.includes('.') && !localIp.match(/[^.\\d]/) && ip.family !== 'IPv4') {\n return;\n }\n if (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\\d]/)) {\n // if DNS name\n hostIp = ip.address;\n } else {\n hostIp = ip.address;\n }\n });\n });\n }\n\n if (!hostIp) {\n Object.keys(networkInterfaces).forEach(inter => {\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n hostIp = ip.address;\n });\n });\n }\n\n return hostIp;\n}\n\ninterface ConfigSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigSendToState extends ConfigGenericState {\n _error: string;\n _message: string;\n _copyDialog: {\n text: string;\n title?: ioBroker.StringOrTranslated;\n type?: 'json' | 'css' | 'html' | 'json5' | 'yaml';\n };\n hostname: string;\n running?: boolean;\n}\n\nexport default class ConfigSendto extends ConfigGeneric<ConfigSendToProps, ConfigSendToState> {\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n\n let hostname = window.location.hostname;\n if (this.props.schema.openUrl) {\n // read admin host\n const adminInstance = await this.props.oContext.socket.getCurrentInstance();\n const instanceObj = await this.props.oContext.socket.getObject(\n `system.adapter.${adminInstance}` as ioBroker.ObjectIDs.Instance,\n );\n\n if (instanceObj) {\n const hostObj = await this.props.oContext.socket.getObject(`system.host.${instanceObj?.common?.host}`);\n if (hostObj) {\n const ip = findNetworkAddressOfHost(hostObj, window.location.hostname);\n if (ip) {\n hostname = `${ip}:${window.location.port}`;\n } else {\n console.warn(\n `Cannot find suitable IP in host ${instanceObj.common.host} for ${instanceObj._id}`,\n );\n return;\n }\n }\n }\n }\n\n await new Promise<void>(resolve => {\n this.setState({ _error: '', _message: '', hostname }, resolve);\n });\n\n if (this.props.schema.onLoaded) {\n this._onClick();\n }\n }\n\n renderErrorDialog(): JSX.Element | null {\n if (this.state._error) {\n return (\n <DialogError\n text={this.state._error}\n onClose={() => this.setState({ _error: '' })}\n />\n );\n }\n return null;\n }\n\n renderMessageDialog(): JSX.Element | null {\n if (this.state._message) {\n return (\n <DialogMessage\n text={this.state._message}\n onClose={() => this.setState({ _message: '' })}\n />\n );\n }\n return null;\n }\n\n renderCopyDialog(): JSX.Element | null {\n if (this.state._copyDialog) {\n return (\n <CustomModal\n title={this.getText(this.state._copyDialog.title || I18n.t('ra_Result'))}\n overflowHidden\n onClose={() => {\n this.setState({ _copyDialog: null });\n }}\n onApply={() => {\n // Copy to clipboard\n copy(this.state._copyDialog.text);\n window.alert(I18n.t('ra_Copied'));\n this.setState({ _copyDialog: null });\n }}\n titleButtonApply={I18n.t('ra_Copy content')}\n >\n <div style={{ width: 'calc(100vw - 40px)', height: 'calc(100vh - 188px)' }}>\n <Editor\n mode={this.state._copyDialog.type}\n value={this.state._copyDialog.text}\n name=\"CopyDialog\"\n themeType={this.props.oContext.themeType}\n />\n </div>\n </CustomModal>\n );\n }\n return null;\n }\n\n _onClick(): void {\n this.props.oContext.onCommandRunning(true);\n this.setState({ running: true });\n\n const _origin = `${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\\/index\\.html$/, '')}`;\n const _originIp = `${window.location.protocol}//${this.state.hostname.split(':').length > 3 ? `[${this.state.hostname}]` : this.state.hostname}${window.location.pathname.replace(/\\/index\\.html$/, '')}`;\n\n let data: Record<string, any> = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr = this.getPattern(\n this.props.schema.jsonData,\n {\n _origin,\n _originIp,\n ...this.props.data,\n },\n true,\n );\n\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n if (data === undefined) {\n data = null;\n }\n if (this.props.schema.openUrl && !data) {\n data = {\n _origin,\n _originIp,\n };\n }\n let timeout: ReturnType<typeof setTimeout> | undefined;\n if (this.props.schema.timeout) {\n timeout = setTimeout(\n () => {\n this.props.oContext.onCommandRunning(false);\n this.setState({ _error: I18n.t('ra_Request timed out'), running: false });\n },\n parseInt(this.props.schema.timeout as any as string, 10) || 10000,\n );\n }\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(\n async (response: {\n error?: string;\n args?: string[];\n command?: BackEndCommand;\n reloadBrowser?: boolean;\n openUrl?: string;\n window?: string;\n result?: string;\n native?: Record<string, any>;\n saveConfig?: boolean;\n /** Title for copy dialog */\n copyDialog?: {\n title?: ioBroker.StringOrTranslated;\n text: string;\n type?: 'json' | 'css' | 'html' | 'json5' | 'yaml';\n };\n }) => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n if (response?.error) {\n if (this.props.schema.error?.[response.error]) {\n let error = this.getText(this.props.schema.error[response.error]);\n response.args?.forEach((arg: string) => (error = error.replace('%s', arg)));\n this.setState({ _error: error });\n } else {\n this.setState({\n _error: response.error\n ? typeof response.error === 'string'\n ? I18n.t(response.error)\n : JSON.stringify(response.error)\n : I18n.t('ra_Error'),\n });\n }\n } else {\n if (response?.command) {\n // If backend requested to refresh the config\n this.props.oContext.onBackEndCommand?.(response.command);\n return;\n }\n if (response?.reloadBrowser && this.props.schema.reloadBrowser) {\n window.location.reload();\n } else if (response?.openUrl && this.props.schema.openUrl) {\n window.open(response.openUrl, response.window || this.props.schema.window || '_blank');\n } else if (response?.result && this.props.schema.result?.[response.result]) {\n let text = this.getText(this.props.schema.result[response.result]);\n response.args?.forEach((arg: string) => (text = text.replace('%s', arg)));\n window.alert(text);\n }\n\n if (response?.native && this.props.schema.useNative) {\n for (const [attr, val] of Object.entries(response.native)) {\n await this.onChangeAsync(attr, val);\n }\n\n setTimeout(\n () => this.props.oContext.forceUpdate(Object.keys(response.native), this.props.data),\n 300,\n );\n } else if (response?.result) {\n window.alert(\n typeof response.result === 'object' ? JSON.stringify(response.result) : response.result,\n );\n } else if (response?.copyDialog) {\n this.setState({ _copyDialog: response.copyDialog });\n } else {\n window.alert(I18n.t('ra_Ok'));\n }\n\n if (response?.saveConfig) {\n this.props.onChange(null, null, null, true);\n }\n }\n },\n )\n .catch((e: any) => {\n if (this.props.schema.error && this.props.schema.error[e.toString()]) {\n this.setState({ _error: this.getText(this.props.schema.error[e.toString()]) });\n } else {\n this.setState({ _error: I18n.t(e.toString()) || I18n.t('ra_Error') });\n }\n })\n .then(() => {\n this.props.oContext.onCommandRunning(false);\n this.setState({ running: false });\n });\n }\n\n renderDialogConfirm(): JSX.Element | null {\n if (!this.state.confirmDialog) {\n return null;\n }\n const confirm = this.state.confirmData || this.props.schema.confirm;\n let icon = null;\n if (confirm.type === 'warning') {\n icon = <IconWarning />;\n } else if (confirm.type === 'error') {\n icon = <IconError />;\n } else if (confirm.type === 'info') {\n icon = <IconInfo />;\n }\n\n return (\n <DialogConfirm\n title={this.getText(confirm.title) || I18n.t('ra_Please confirm')}\n text={this.getText(confirm.text)}\n ok={this.getText(confirm.ok) || I18n.t('ra_Ok')}\n cancel={this.getText(confirm.cancel) || I18n.t('ra_Cancel')}\n icon={icon || undefined}\n onClose={isOk => this.setState({ confirmDialog: false }, () => isOk && this._onClick())}\n />\n );\n }\n\n renderItem(error: Error | undefined, disabled: boolean): JSX.Element {\n const icon = this.getIcon();\n\n return (\n <div style={styles.fullWidth}>\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={{ ...styles.fullWidth, ...(this.props.schema.controlStyle || undefined) }}\n disabled={disabled || !this.props.alive}\n startIcon={icon}\n title={\n this.props.alive\n ? this.getText(this.props.schema.title) || ''\n : I18n.t('ra_Instance is not alive')\n }\n onClick={() => {\n if (this.props.schema.confirm) {\n this.setState({ confirmDialog: true });\n } else {\n this._onClick();\n }\n }}\n >\n {this.props.schema.showProcess && this.state.running ? (\n <CircularProgress\n size={20}\n style={{ marginRight: 8 }}\n />\n ) : null}\n {this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n {this.renderErrorDialog()}\n {this.renderMessageDialog()}\n {this.renderCopyDialog()}\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigSendto.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigSendto.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEnG,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGnG,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,MAAM,MAAM,6BAA6B,CAAC;AACjD,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAE3D,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAEF,SAAS,MAAM,CAAC,EAAU;IACtB,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,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IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CACnD,oBAAC,gBAAgB,IACb,IAAI,EAAE,EAAE,EACR,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,GAC3B,CACL,CAAC,CAAC,CAAC,IAAI;gBACP,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAClE;YACR,IAAI,CAAC,iBAAiB,EAAE;YACxB,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,gBAAgB,EAAE,CACtB,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Button, CircularProgress } from '@mui/material';\n\nimport { Warning as IconWarning, Error as IconError, Info as IconInfo } from '@mui/icons-material';\n\nimport { DialogConfirm, DialogError, DialogMessage, I18n, copy } from '@iobroker/adapter-react-v5';\n\nimport type { BackEndCommand, ConfigItemSendTo } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport Editor from './wrapper/Components/Editor';\nimport CustomModal from './wrapper/Components/CustomModal';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\nfunction ip2int(ip: string): number {\n return ip.split('.').reduce((ipInt, octet) => (ipInt << 8) + parseInt(octet, 10), 0) >>> 0;\n}\n\n// copied from iobroker.admin/src-rx/src/Utils.js\nfunction findNetworkAddressOfHost(obj: Record<string, any>, localIp: string): string {\n const networkInterfaces = obj?.native?.hardware?.networkInterfaces;\n if (!networkInterfaces) {\n return null;\n }\n\n let hostIp: string | undefined;\n\n // check ipv4 addresses\n Object.keys(networkInterfaces).forEach(inter =>\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n if (localIp.includes(':') && ip.family !== 'IPv6') {\n return;\n }\n if (localIp.includes('.') && !localIp.match(/[^.\\d]/) && ip.family !== 'IPv4') {\n return;\n }\n // if ip4 and not docker or wsl\n if (\n ip.family === 'IPv4' &&\n !ip.address.startsWith('172') &&\n (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\\d]/))\n ) {\n // if DNS name\n hostIp = ip.address;\n } else if (!hostIp) {\n if (\n ip.family === 'IPv4' &&\n localIp.includes('.') &&\n (ip2int(localIp) & ip2int(ip.netmask)) === (ip2int(ip.address) & ip2int(ip.netmask))\n ) {\n hostIp = ip.address;\n } else {\n hostIp = ip.address;\n }\n }\n }),\n );\n\n // check ipv6 addresses\n if (!hostIp) {\n Object.keys(networkInterfaces).forEach(inter =>\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n if (localIp.includes(':') && ip.family !== 'IPv6') {\n return;\n }\n if (localIp.includes('.') && !localIp.match(/[^.\\d]/) && ip.family !== 'IPv4') {\n return;\n }\n if (\n ip.family === 'IPv6' &&\n (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\\d]/))\n ) {\n // if DNS name\n hostIp = ip.address;\n } else if (!hostIp) {\n if (\n ip.family === 'IPv4' &&\n localIp.includes('.') &&\n (ip2int(localIp) & ip2int(ip.netmask)) === (ip2int(ip.address) & ip2int(ip.netmask))\n ) {\n hostIp = ip.address;\n } else {\n hostIp = ip.address;\n }\n }\n }),\n );\n }\n\n if (!hostIp) {\n Object.keys(networkInterfaces).forEach(inter => {\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n if (localIp.includes(':') && ip.family !== 'IPv6') {\n return;\n }\n if (localIp.includes('.') && !localIp.match(/[^.\\d]/) && ip.family !== 'IPv4') {\n return;\n }\n if (localIp === '127.0.0.0' || localIp === 'localhost' || localIp.match(/[^.\\d]/)) {\n // if DNS name\n hostIp = ip.address;\n } else {\n hostIp = ip.address;\n }\n });\n });\n }\n\n if (!hostIp) {\n Object.keys(networkInterfaces).forEach(inter => {\n networkInterfaces[inter].forEach((ip: Record<string, any>) => {\n if (ip.internal) {\n return;\n }\n hostIp = ip.address;\n });\n });\n }\n\n return hostIp;\n}\n\ninterface ConfigSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigSendToState extends ConfigGenericState {\n _error: string;\n _message: string;\n _copyDialog: {\n text: string;\n title?: ioBroker.StringOrTranslated;\n type?: 'json' | 'css' | 'html' | 'json5' | 'yaml';\n };\n hostname: string;\n running?: boolean;\n}\n\nexport default class ConfigSendto extends ConfigGeneric<ConfigSendToProps, ConfigSendToState> {\n async componentDidMount(): Promise<void> {\n super.componentDidMount();\n\n let hostname = window.location.hostname;\n if (this.props.schema.openUrl) {\n // read admin host\n const adminInstance = await this.props.oContext.socket.getCurrentInstance();\n const instanceObj = await this.props.oContext.socket.getObject(\n `system.adapter.${adminInstance}` as ioBroker.ObjectIDs.Instance,\n );\n\n if (instanceObj) {\n const hostObj = await this.props.oContext.socket.getObject(`system.host.${instanceObj?.common?.host}`);\n if (hostObj) {\n const ip = findNetworkAddressOfHost(hostObj, window.location.hostname);\n if (ip) {\n hostname = `${ip}:${window.location.port}`;\n } else {\n console.warn(\n `Cannot find suitable IP in host ${instanceObj.common.host} for ${instanceObj._id}`,\n );\n return;\n }\n }\n }\n }\n\n await new Promise<void>(resolve => {\n this.setState({ _error: '', _message: '', hostname }, resolve);\n });\n\n if (this.props.schema.onLoaded) {\n this._onClick();\n }\n }\n\n renderErrorDialog(): JSX.Element | null {\n if (this.state._error) {\n return (\n <DialogError\n text={this.state._error}\n onClose={() => this.setState({ _error: '' })}\n />\n );\n }\n return null;\n }\n\n renderMessageDialog(): JSX.Element | null {\n if (this.state._message) {\n return (\n <DialogMessage\n text={this.state._message}\n onClose={() => this.setState({ _message: '' })}\n />\n );\n }\n return null;\n }\n\n renderCopyDialog(): JSX.Element | null {\n if (this.state._copyDialog) {\n return (\n <CustomModal\n title={this.getText(this.state._copyDialog.title || I18n.t('ra_Result'))}\n overflowHidden\n onClose={() => {\n this.setState({ _copyDialog: null });\n }}\n onApply={() => {\n // Copy to clipboard\n copy(this.state._copyDialog.text);\n window.alert(I18n.t('ra_Copied'));\n this.setState({ _copyDialog: null });\n }}\n titleButtonApply={I18n.t('ra_Copy content')}\n >\n <div style={{ width: 'calc(100vw - 40px)', height: 'calc(100vh - 188px)' }}>\n <Editor\n mode={this.state._copyDialog.type}\n value={this.state._copyDialog.text}\n name=\"CopyDialog\"\n themeType={this.props.oContext.themeType}\n />\n </div>\n </CustomModal>\n );\n }\n return null;\n }\n\n _onClick(): void {\n this.props.oContext.onCommandRunning(true);\n this.setState({ running: true });\n\n const _origin = `${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\\/index\\.html$/, '')}`;\n const _originIp = `${window.location.protocol}//${this.state.hostname.split(':').length > 3 ? `[${this.state.hostname}]` : this.state.hostname}${window.location.pathname.replace(/\\/index\\.html$/, '')}`;\n\n let data: Record<string, any> = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr = this.getPattern(\n this.props.schema.jsonData,\n {\n _origin,\n _originIp,\n ...this.props.data,\n },\n true,\n );\n\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n if (data === undefined) {\n data = null;\n }\n if (this.props.schema.openUrl && !data) {\n data = {\n _origin,\n _originIp,\n };\n }\n let timeout: ReturnType<typeof setTimeout> | undefined;\n if (this.props.schema.timeout) {\n timeout = setTimeout(\n () => {\n this.props.oContext.onCommandRunning(false);\n this.setState({ _error: I18n.t('ra_Request timed out'), running: false });\n },\n parseInt(this.props.schema.timeout as any as string, 10) || 10000,\n );\n }\n\n void this.props.oContext.socket\n .sendTo(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(\n async (response: {\n error?: string;\n args?: string[];\n command?: BackEndCommand;\n reloadBrowser?: boolean;\n openUrl?: string;\n window?: string;\n result?: string;\n native?: Record<string, any>;\n saveConfig?: boolean;\n /** Title for copy dialog */\n copyDialog?: {\n title?: ioBroker.StringOrTranslated;\n text: string;\n type?: 'json' | 'css' | 'html' | 'json5' | 'yaml';\n };\n }) => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n if (response?.error) {\n if (this.props.schema.error?.[response.error]) {\n let error = this.getText(this.props.schema.error[response.error]);\n response.args?.forEach((arg: string) => (error = error.replace('%s', arg)));\n this.setState({ _error: error });\n } else {\n this.setState({\n _error: response.error\n ? typeof response.error === 'string'\n ? I18n.t(response.error)\n : JSON.stringify(response.error)\n : I18n.t('ra_Error'),\n });\n }\n } else {\n if (response?.command) {\n // If backend requested to refresh the config\n this.props.oContext.onBackEndCommand?.(response.command);\n return;\n }\n if (response?.reloadBrowser && this.props.schema.reloadBrowser) {\n window.location.reload();\n } else if (response?.openUrl && this.props.schema.openUrl) {\n window.open(response.openUrl, response.window || this.props.schema.window || '_blank');\n } else if (response?.result && this.props.schema.result?.[response.result]) {\n let text = this.getText(this.props.schema.result[response.result]);\n response.args?.forEach((arg: string) => (text = text.replace('%s', arg)));\n window.alert(text);\n }\n\n if (response?.native && this.props.schema.useNative) {\n for (const [attr, val] of Object.entries(response.native)) {\n await this.onChangeAsync(attr, val);\n }\n\n setTimeout(\n () => this.props.oContext.forceUpdate(Object.keys(response.native), this.props.data),\n 300,\n );\n } else if (response?.result) {\n window.alert(\n typeof response.result === 'object' ? JSON.stringify(response.result) : response.result,\n );\n } else if (response?.copyDialog) {\n this.setState({ _copyDialog: response.copyDialog });\n } else {\n window.alert(I18n.t('ra_Ok'));\n }\n\n if (response?.saveConfig) {\n this.props.onChange(null, null, null, true);\n }\n }\n },\n )\n .catch((e: any) => {\n if (this.props.schema.error && this.props.schema.error[e.toString()]) {\n this.setState({ _error: this.getText(this.props.schema.error[e.toString()]) });\n } else {\n this.setState({ _error: I18n.t(e.toString()) || I18n.t('ra_Error') });\n }\n })\n .then(() => {\n this.props.oContext.onCommandRunning(false);\n this.setState({ running: false });\n });\n }\n\n renderDialogConfirm(): JSX.Element | null {\n if (!this.state.confirmDialog) {\n return null;\n }\n const confirm = this.state.confirmData || this.props.schema.confirm;\n let icon = null;\n if (confirm.type === 'warning') {\n icon = <IconWarning />;\n } else if (confirm.type === 'error') {\n icon = <IconError />;\n } else if (confirm.type === 'info') {\n icon = <IconInfo />;\n }\n\n return (\n <DialogConfirm\n title={this.getText(confirm.title) || I18n.t('ra_Please confirm')}\n text={this.getText(confirm.text)}\n ok={this.getText(confirm.ok) || I18n.t('ra_Ok')}\n cancel={this.getText(confirm.cancel) || I18n.t('ra_Cancel')}\n icon={icon || undefined}\n onClose={isOk => this.setState({ confirmDialog: false }, () => isOk && this._onClick())}\n />\n );\n }\n\n renderItem(error: Error | undefined, disabled: boolean): JSX.Element {\n const icon = this.getIcon();\n\n return (\n <div style={styles.fullWidth}>\n <Button\n variant={this.props.schema.variant || undefined}\n color={this.props.schema.color || 'grey'}\n style={{ ...styles.fullWidth, ...(this.props.schema.controlStyle || undefined) }}\n disabled={disabled || !this.props.alive}\n startIcon={icon}\n title={\n this.props.alive\n ? this.getText(this.props.schema.title) || ''\n : I18n.t('ra_Instance is not alive')\n }\n onClick={() => {\n if (this.props.schema.confirm) {\n this.setState({ confirmDialog: true });\n } else {\n this._onClick();\n }\n }}\n >\n {this.props.schema.showProcess && this.state.running ? (\n <CircularProgress\n size={20}\n style={{ marginRight: 8 }}\n />\n ) : null}\n {this.getText(this.props.schema.label, this.props.schema.noTranslation)}\n </Button>\n {this.renderErrorDialog()}\n {this.renderMessageDialog()}\n {this.renderCopyDialog()}\n </div>\n );\n }\n}\n"]}
|
|
@@ -25,7 +25,7 @@ class ConfigTextSendTo extends ConfigGeneric {
|
|
|
25
25
|
}
|
|
26
26
|
data ??= null;
|
|
27
27
|
void this.props.oContext.socket
|
|
28
|
-
.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
28
|
+
.sendTo(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`, this.props.schema.command || 'send', data)
|
|
29
29
|
.then(result => {
|
|
30
30
|
if (typeof result === 'object') {
|
|
31
31
|
const _data = result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigTextSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTextSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAoBF,MAAM,gBAAiB,SAAQ,aAA2D;IAC9E,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,IAAI,GAAoC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YACnE,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,OAAO,GAAW,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAChF,IAAI,CAAC;oBACD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC/B,CAAC;gBAAC,MAAM,CAAC;oBACL,OAAO,CAAC,KAAK,CAAC,2B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AAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE;YAClE,IAAI;YACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CACtC,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,GAAI,CACvE,CAAC,CAAC,CAAC,CACA,IAAI,CAAC,KAAK,CAAC,IAAI,CAClB,CACC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { I18n, Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSendTo } from '../types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\ninterface ConfigTextSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigTextSendToState extends ConfigGenericState {\n text?: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\ninterface Response {\n text: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\nclass ConfigTextSendTo extends ConfigGeneric<ConfigTextSendToProps, ConfigTextSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n if (this.props.alive) {\n let data: Record<string, any> | undefined = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n\n data ??= null;\n\n void this.props.oContext.socket\n .sendTo(\n `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(result => {\n if (typeof result === 'object') {\n const _data: Response = result;\n this.setState({\n text: _data.text || '',\n style: _data.style,\n icon: _data.icon,\n iconStyle: _data.iconStyle,\n });\n } else if (typeof result === 'string') {\n this.setState({ text: result || '' });\n }\n })\n .catch(e => console.error(`Cannot send command: ${e}`));\n }\n }\n\n getLocalContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getLocalContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.text === undefined) {\n return null;\n }\n\n let icon: JSX.Element | null = null;\n if (this.state.icon) {\n icon = getIconByName(this.state.icon, {\n marginRight: this.state.text ? 8 : undefined,\n ...(this.state.iconStyle || undefined),\n });\n if (!icon) {\n icon = (\n <Icon\n src={this.state.icon}\n style={{ marginRight: this.state.text ? 8 : undefined, ...(this.state.iconStyle || undefined) }}\n />\n );\n }\n }\n\n if (this.props.schema.container === 'text') {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n slotProps={{\n input: {\n endAdornment: this.props.schema.copyToClipboard ? (\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.text);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n ) : undefined,\n },\n }}\n value={this.state.text}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <div style={{ ...styles.fullWidth, ...(this.state.style || undefined) }}>\n {icon}\n {this.props.schema.container === 'html' ? (\n <span dangerouslySetInnerHTML={{ __html: this.state.text || '' }} />\n ) : (\n this.state.text\n )}\n </div>\n );\n }\n}\n\nexport default ConfigTextSendTo;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigTextSendTo.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigTextSendTo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;KAChB;CACJ,CAAC;AAoBF,MAAM,gBAAiB,SAAQ,aAA2D;IAC9E,WAAW,GAAG,KAAK,CAAC;IAEpB,YAAY,CAAqB;IAEzC,WAAW;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACnB,IAAI,IAAI,GAAoC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YACnE,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACnD,MAAM,OAAO,GAAW,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAChF,IAAI,CAAC;oBACD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC/B,CAAC;gBAAC,MAAM,CAAC;oBACL,OAAO,CAAC,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;gBACxD,CAAC;YAC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M,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE;YAClE,IAAI;YACJ,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,CACtC,8BAAM,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,GAAI,CACvE,CAAC,CAAC,CAAC,CACA,IAAI,CAAC,KAAK,CAAC,IAAI,CAClB,CACC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, IconButton } from '@mui/material';\n\nimport { I18n, Icon, IconCopy, Utils } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemSendTo } from '../types';\nimport getIconByName from './Icons';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n fullWidth: {\n width: '100%',\n },\n};\n\ninterface ConfigTextSendToProps extends ConfigGenericProps {\n schema: ConfigItemSendTo;\n}\n\ninterface ConfigTextSendToState extends ConfigGenericState {\n text?: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\ninterface Response {\n text: string;\n style?: React.CSSProperties;\n icon?: string;\n iconStyle?: React.CSSProperties;\n}\n\nclass ConfigTextSendTo extends ConfigGeneric<ConfigTextSendToProps, ConfigTextSendToState> {\n private initialized = false;\n\n private localContext: string | undefined;\n\n askInstance(): void {\n if (this.props.alive) {\n let data: Record<string, any> | undefined = this.props.schema.data;\n if (data === undefined && this.props.schema.jsonData) {\n const dataStr: string = this.getPattern(this.props.schema.jsonData, null, true);\n try {\n data = JSON.parse(dataStr);\n } catch {\n console.error(`Cannot parse json data: ${dataStr}`);\n }\n }\n\n data ??= null;\n\n void this.props.oContext.socket\n .sendTo(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n this.props.schema.command || 'send',\n data,\n )\n .then(result => {\n if (typeof result === 'object') {\n const _data: Response = result;\n this.setState({\n text: _data.text || '',\n style: _data.style,\n icon: _data.icon,\n iconStyle: _data.iconStyle,\n });\n } else if (typeof result === 'string') {\n this.setState({ text: result || '' });\n }\n })\n .catch(e => console.error(`Cannot send command: ${e}`));\n }\n }\n\n getLocalContext(): string {\n const localContext: Record<string, any> = {};\n if (Array.isArray(this.props.schema.alsoDependsOn)) {\n this.props.schema.alsoDependsOn.forEach(\n attr => (localContext[attr] = ConfigGeneric.getValue(this.props.data, attr)),\n );\n }\n return JSON.stringify(localContext);\n }\n\n renderItem(/* error, disabled, defaultValue */): JSX.Element {\n if (this.props.alive) {\n const localContext = this.getLocalContext();\n if (localContext !== this.localContext || !this.initialized) {\n this.localContext = localContext;\n setTimeout(() => this.askInstance(), this.initialized ? 300 : 50);\n this.initialized = true;\n }\n }\n\n if (this.state.text === undefined) {\n return null;\n }\n\n let icon: JSX.Element | null = null;\n if (this.state.icon) {\n icon = getIconByName(this.state.icon, {\n marginRight: this.state.text ? 8 : undefined,\n ...(this.state.iconStyle || undefined),\n });\n if (!icon) {\n icon = (\n <Icon\n src={this.state.icon}\n style={{ marginRight: this.state.text ? 8 : undefined, ...(this.state.iconStyle || undefined) }}\n />\n );\n }\n }\n\n if (this.props.schema.container === 'text') {\n return (\n <TextField\n variant=\"standard\"\n fullWidth\n slotProps={{\n input: {\n endAdornment: this.props.schema.copyToClipboard ? (\n <IconButton\n tabIndex={-1}\n size=\"small\"\n onClick={() => {\n Utils.copyToClipboard(this.state.text);\n window.alert(I18n.t('ra_Copied'));\n }}\n >\n <IconCopy />\n </IconButton>\n ) : undefined,\n },\n }}\n value={this.state.text}\n label={this.getText(this.props.schema.label)}\n helperText={this.renderHelp(\n this.props.schema.help,\n this.props.schema.helpLink,\n this.props.schema.noTranslation,\n )}\n />\n );\n }\n return (\n <div style={{ ...styles.fullWidth, ...(this.state.style || undefined) }}>\n {icon}\n {this.props.schema.container === 'html' ? (\n <span dangerouslySetInnerHTML={{ __html: this.state.text || '' }} />\n ) : (\n this.state.text\n )}\n </div>\n );\n }\n}\n\nexport default ConfigTextSendTo;\n"]}
|
|
@@ -28,7 +28,7 @@ export class JsonConfigComponent extends Component {
|
|
|
28
28
|
};
|
|
29
29
|
this.forceUpdateHandlers = {};
|
|
30
30
|
this.buildDependencies(this.state.schema);
|
|
31
|
-
this.readData();
|
|
31
|
+
void this.readData().catch(error => console.error(`Cannot read data: ${error}`));
|
|
32
32
|
}
|
|
33
33
|
static getDerivedStateFromProps(props, state) {
|
|
34
34
|
if (props.updateData !== state.updateData) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["JsonConfigComponent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAwB,IAAI,EAAiD,MAAM,4BAA4B,CAAC;AAKvH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACjB;CACJ,CAAC;AA8CF,MAAM,OAAO,mBAAoB,SAAQ,SAA6D;IACjF,mBAAmB,CAAsC;IAElE,YAAY,GAAyC,IAAI,CAAC;IAE1D,WAAW,GAAkC,IAAI,CAAC;IAElD,QAAQ,CAAoB;IAEpC,YAAY,KAA+B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC7C,OAAO,EAAE,KAAK;YACd,MAAM,EAAE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AAC,YAAY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7C,OAAO,oBAAC,cAAc,OAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChD,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,CACH,6BACI,KAAK,EAAE;gBACH,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpF,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK;gBACnB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;aAC7B,IAEA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CACjC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,mBAAmB,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport { LinearProgress } from '@mui/material';\n\nimport { type AdminConnection, I18n, type ThemeName, type ThemeType, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { BackEndCommand, ConfigItemPanel, ConfigItemTabs, JsonConfigContext } from '../types';\nimport type ConfigGeneric from './ConfigGeneric';\nimport { type DeviceManagerPropsProps, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigTabs from './ConfigTabs';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n root: {\n width: '100%',\n height: '100%',\n },\n};\n\ninterface JsonConfigComponentProps {\n socket: AdminConnection;\n themeName: ThemeName;\n themeType: ThemeType;\n adapterName: string;\n instance: number;\n isFloatComma: boolean;\n dateFormat: string;\n imagePrefix?: string;\n schema: ConfigItemTabs | ConfigItemPanel;\n common?: Record<string, any>;\n data: Record<string, any>;\n updateData?: number;\n onError: (error: boolean) => void;\n onChange?: (data: Record<string, any>, changed: boolean, saveConfig: boolean) => void;\n /** Backend request to refresh data */\n onBackEndCommand?: (command?: BackEndCommand) => void;\n custom?: boolean;\n onValueChange?: (attr: string, value: any, saveConfig: boolean) => void;\n embedded?: boolean;\n multiEdit?: boolean;\n instanceObj?: ioBroker.InstanceObject;\n customObj?: ioBroker.Object;\n customs?: Record<string, typeof ConfigGeneric>;\n DeviceManager?: React.FC<DeviceManagerPropsProps>;\n style?: React.CSSProperties;\n theme: IobTheme;\n expertMode?: boolean;\n withoutSaveButtons?: boolean;\n /** User can provide their own components for specific input fields */\n customComponents?: { [componentType: string]: typeof ConfigGeneric<ConfigGenericProps, any> };\n}\n\ninterface JsonConfigComponentState {\n originalData: string;\n changed: boolean;\n errors: Record<string, string>;\n systemConfig: ioBroker.SystemConfigCommon | null;\n updateData?: number;\n alive: boolean;\n commandRunning: boolean;\n schema: ConfigItemTabs | ConfigItemPanel;\n}\n\nexport class JsonConfigComponent extends Component<JsonConfigComponentProps, JsonConfigComponentState> {\n private readonly forceUpdateHandlers: Record<string, (data: any) => void>;\n\n private errorTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private errorCached: Record<string, string> | null = null;\n\n private oContext: JsonConfigContext;\n\n constructor(props: JsonConfigComponentProps) {\n super(props);\n\n this.state = {\n originalData: JSON.stringify(this.props.data),\n changed: false,\n errors: {},\n updateData: this.props.updateData || 0,\n systemConfig: null,\n alive: false,\n commandRunning: false,\n schema: JSON.parse(JSON.stringify(this.props.schema)),\n };\n\n this.forceUpdateHandlers = {};\n\n this.buildDependencies(this.state.schema);\n\n this.readData();\n }\n\n static getDerivedStateFromProps(\n props: JsonConfigComponentProps,\n state: JsonConfigComponentState,\n ): Partial<JsonConfigComponentState> | null {\n if (props.updateData !== state.updateData) {\n return {\n updateData: props.updateData,\n originalData: JSON.stringify(props.data),\n schema: JSON.parse(JSON.stringify(props.schema)),\n };\n }\n return null;\n }\n\n static async loadI18n(\n socket: AdminConnection,\n i18n: boolean | string | Record<string, Record<ioBroker.Languages, string>>,\n adapterName: string,\n ): Promise<string> {\n if (i18n === true || (i18n && typeof i18n === 'string')) {\n const lang = I18n.getLanguage();\n const path = typeof i18n === 'string' ? i18n : 'i18n';\n let exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}.json`);\n let fileName;\n if (exists) {\n fileName = `${path}/${lang}.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}/translations.json`);\n if (exists) {\n fileName = `${path}/${lang}/translations.json`;\n } else if (lang !== 'en') {\n // fallback to english\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en.json`);\n if (exists) {\n fileName = `${path}/en.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en/translations.json`);\n if (exists) {\n fileName = `${path}/en/translations.json`;\n }\n }\n }\n }\n\n if (fileName) {\n const jsonFile = await socket.readFile(`${adapterName}.admin`, fileName);\n let jsonStr: string;\n if (jsonFile.file !== undefined) {\n jsonStr = jsonFile.file;\n } else {\n // @ts-expect-error deprecated\n jsonStr = jsonFile;\n }\n\n try {\n const json = JSON.parse(jsonStr);\n // apply file to I18n\n I18n.extendTranslations(json, lang);\n } catch (e) {\n console.error(`Cannot parse language file \"${adapterName}.admin/${fileName}: ${e}`);\n return '';\n }\n return fileName;\n }\n console.warn(`Cannot find i18n for ${adapterName} / ${fileName}`);\n return '';\n }\n if (i18n && typeof i18n === 'object') {\n I18n.extendTranslations(i18n);\n return '';\n }\n return '';\n }\n\n onCommandRunning = (commandRunning: boolean): void => this.setState({ commandRunning });\n\n async readData(): Promise<void> {\n let systemConfig: ioBroker.SystemConfigObject | undefined;\n try {\n if (this.props.socket.getCompactSystemConfig) {\n systemConfig = await this.props.socket.getCompactSystemConfig();\n } else {\n systemConfig = await this.props.socket.getObject('system.config');\n }\n const state = await this.props.socket.getState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n );\n this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () => {\n this.updateContext(true);\n if (!this.props.custom) {\n void this.props.socket.subscribeState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n this.onAlive,\n );\n }\n });\n } catch (error) {\n console.error(`Cannot read system config: ${error}`);\n }\n }\n\n onAlive = (_id: string, state?: ioBroker.State | null): void => {\n if (!!state?.val !== this.state.alive) {\n this.setState({ alive: !!state?.val });\n }\n };\n\n onChange = (attrOrData: string | Record<string, any>, value: any, cb?: () => void, saveConfig?: boolean): void => {\n if (this.props.onValueChange) {\n this.props.onValueChange(attrOrData as string, value, saveConfig);\n if (cb) {\n cb();\n }\n } else if (attrOrData && this.props.onChange) {\n const newState: Partial<JsonConfigComponentState> = {\n changed: JSON.stringify(attrOrData) !== this.state.originalData,\n };\n\n this.setState(newState as JsonConfigComponentState, () => {\n this.props.onChange(attrOrData as Record<string, any>, newState.changed, saveConfig);\n if (cb) {\n cb();\n }\n });\n } else if (saveConfig) {\n this.props.onChange(null, null, saveConfig);\n }\n };\n\n onError = (attr: string, error?: string): void => {\n this.errorCached = this.errorCached || JSON.parse(JSON.stringify(this.state.errors));\n const errors = this.errorCached;\n if (error) {\n errors[attr] = error;\n } else {\n delete errors[attr];\n }\n\n if (this.errorTimeout) {\n clearTimeout(this.errorTimeout);\n }\n if (JSON.stringify(errors) !== JSON.stringify(this.state.errors)) {\n this.errorTimeout = setTimeout(\n () =>\n this.setState({ errors: this.errorCached }, () => {\n this.errorTimeout = null;\n this.errorCached = null;\n this.props.onError(!!Object.keys(this.state.errors).length);\n }),\n 50,\n );\n } else {\n this.errorCached = null;\n }\n };\n\n flatten(schema: Record<string, any>, _list?: Record<string, any>): Record<string, any> {\n _list = _list || {};\n if (schema.items) {\n Object.keys(schema.items).forEach(attr => {\n _list[attr] = schema.items[attr];\n this.flatten(schema.items[attr], _list);\n });\n }\n\n return _list;\n }\n\n buildDependencies(schema: ConfigItemTabs | ConfigItemPanel): void {\n const attrs = this.flatten(schema as Record<string, any>);\n Object.keys(attrs).forEach(attr => {\n if (attrs[attr].confirm?.alsoDependsOn) {\n attrs[attr].confirm?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].confirmDependsOn = attrs[dep].confirmDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n if (depObj.confirm) {\n depObj.confirm.cancel = 'Undo';\n }\n\n attrs[dep].confirmDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].onChange?.alsoDependsOn) {\n attrs[attr].onChange?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].onChangeDependsOn = attrs[dep].onChangeDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].onChangeDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].hidden?.alsoDependsOn) {\n attrs[attr].hidden?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].hiddenDependsOn = attrs[dep].hiddenDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].hiddenDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].label?.alsoDependsOn) {\n attrs[attr].label?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].labelDependsOn = attrs[dep].labelDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].labelDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].help?.alsoDependsOn) {\n attrs[attr].help?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].helpDependsOn = attrs[dep].helpDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].helpDependsOn.push(depObj);\n }\n });\n }\n });\n }\n\n updateContext(forceUpdate?: boolean): void {\n this.oContext = {\n DeviceManager: this.props.DeviceManager,\n adapterName: this.props.adapterName,\n changeLanguage: this.changeLanguage,\n common: this.props.common,\n customs: this.props.customs,\n dateFormat: this.props.dateFormat,\n embedded: this.props.embedded,\n forceUpdate: this.forceAttrUpdate,\n imagePrefix: this.props.imagePrefix,\n instance: this.props.instance,\n instanceObj: this.props.instanceObj,\n isFloatComma: this.props.isFloatComma,\n multiEdit: this.props.multiEdit,\n onBackEndCommand: this.props.onBackEndCommand,\n onCommandRunning: this.onCommandRunning,\n onValueChange: this.props.onValueChange,\n registerOnForceUpdate: this.registerOnForceUpdate,\n socket: this.props.socket,\n systemConfig: this.state.systemConfig,\n theme: this.props.theme,\n // could be changed dynamically\n themeType: this.props.themeType,\n _themeName: this.props.themeName,\n updateData: this.state.updateData,\n } as JsonConfigContext;\n\n if (forceUpdate) {\n this.forceUpdate();\n }\n }\n\n renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (item.type === 'tabs') {\n return (\n <ConfigTabs\n withoutSaveButtons={this.props.withoutSaveButtons}\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n expertMode={this.props.expertMode}\n themeName={this.props.themeName}\n customComponents={this.props.customComponents}\n />\n );\n }\n if (\n item.type === 'panel' ||\n // @ts-expect-error type could be empty\n !item.type\n ) {\n return (\n <ConfigPanel\n withoutSaveButtons={this.props.withoutSaveButtons}\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n expertMode={this.props.expertMode}\n index={1000}\n isParentTab={!this.props.embedded && !this.props.withoutSaveButtons}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n themeName={this.props.themeName}\n customComponents={this.props.customComponents}\n />\n );\n }\n console.error(`Unknown item type in root: ${JSON.stringify(item)}`);\n\n return null;\n }\n\n changeLanguage = (): void => {\n this.forceUpdate();\n };\n\n forceAttrUpdate = (attr: string | string[], data: any): void => {\n if (Array.isArray(attr)) {\n attr.forEach(a => this.forceUpdateHandlers[a] && this.forceUpdateHandlers[a](data));\n } else if (this.forceUpdateHandlers[attr]) {\n this.forceUpdateHandlers[attr](data);\n }\n };\n\n registerOnForceUpdate = (attr: string, cb?: ((data: any) => void) | null): void => {\n if (cb) {\n this.forceUpdateHandlers[attr] = cb;\n } else if (this.forceUpdateHandlers[attr]) {\n delete this.forceUpdateHandlers[attr];\n }\n };\n\n render(): JSX.Element {\n if (!this.state.systemConfig || !this.oContext) {\n return <LinearProgress />;\n }\n\n if (this.oContext._themeName !== this.props.themeName) {\n this.oContext._themeName = this.props.themeName;\n setTimeout(() => this.updateContext(true), 0);\n }\n\n return (\n <div\n style={{\n ...(!this.props.embedded || this.props.withoutSaveButtons ? styles.root : undefined),\n ...this.props.style,\n ...this.state.schema.style,\n }}\n >\n {this.renderItem(this.state.schema)}\n </div>\n );\n }\n}\n\nexport default JsonConfigComponent;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"./src/","sources":["JsonConfigComponent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAwB,IAAI,EAAiD,MAAM,4BAA4B,CAAC;AAKvH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;KACjB;CACJ,CAAC;AA8CF,MAAM,OAAO,mBAAoB,SAAQ,SAA6D;IACjF,mBAAmB,CAAsC;IAElE,YAAY,GAAyC,IAAI,CAAC;IAE1D,WAAW,GAAkC,IAAI,CAAC;IAElD,QAAQ,CAAoB;IAEpC,YAAY,KAA+B;QACvC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG;YACT,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC7C,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC;YACtC,YAAY,EAAE,IAAI;YAClB,KAAK,EAAE,KAA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AY,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7C,OAAO,oBAAC,cAAc,OAAG,CAAC;QAC9B,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACpD,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChD,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,CACH,6BACI,KAAK,EAAE;gBACH,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBACpF,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK;gBACnB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;aAC7B,IAEA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CACjC,CACT,CAAC;IACN,CAAC;CACJ;AAED,eAAe,mBAAmB,CAAC","sourcesContent":["import React, { Component, type JSX } from 'react';\n\nimport { LinearProgress } from '@mui/material';\n\nimport { type AdminConnection, I18n, type ThemeName, type ThemeType, type IobTheme } from '@iobroker/adapter-react-v5';\n\nimport type { BackEndCommand, ConfigItemPanel, ConfigItemTabs, JsonConfigContext } from '../types';\nimport type ConfigGeneric from './ConfigGeneric';\nimport { type DeviceManagerPropsProps, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigTabs from './ConfigTabs';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n root: {\n width: '100%',\n height: '100%',\n },\n};\n\ninterface JsonConfigComponentProps {\n socket: AdminConnection;\n themeName: ThemeName;\n themeType: ThemeType;\n adapterName: string;\n instance: number;\n isFloatComma: boolean;\n dateFormat: string;\n imagePrefix?: string;\n schema: ConfigItemTabs | ConfigItemPanel;\n common?: Record<string, any>;\n data: Record<string, any>;\n updateData?: number;\n onError: (error: boolean) => void;\n onChange?: (data: Record<string, any>, changed: boolean, saveConfig: boolean) => void;\n /** Backend request to refresh data */\n onBackEndCommand?: (command?: BackEndCommand) => void;\n custom?: boolean;\n onValueChange?: (attr: string, value: any, saveConfig: boolean) => void;\n embedded?: boolean;\n multiEdit?: boolean;\n instanceObj?: ioBroker.InstanceObject;\n customObj?: ioBroker.Object;\n customs?: Record<string, typeof ConfigGeneric>;\n DeviceManager?: React.FC<DeviceManagerPropsProps>;\n style?: React.CSSProperties;\n theme: IobTheme;\n expertMode?: boolean;\n withoutSaveButtons?: boolean;\n /** User can provide their own components for specific input fields */\n customComponents?: { [componentType: string]: typeof ConfigGeneric<ConfigGenericProps, any> };\n}\n\ninterface JsonConfigComponentState {\n originalData: string;\n changed: boolean;\n errors: Record<string, string>;\n systemConfig: ioBroker.SystemConfigCommon | null;\n updateData?: number;\n alive: boolean;\n commandRunning: boolean;\n schema: ConfigItemTabs | ConfigItemPanel;\n}\n\nexport class JsonConfigComponent extends Component<JsonConfigComponentProps, JsonConfigComponentState> {\n private readonly forceUpdateHandlers: Record<string, (data: any) => void>;\n\n private errorTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private errorCached: Record<string, string> | null = null;\n\n private oContext: JsonConfigContext;\n\n constructor(props: JsonConfigComponentProps) {\n super(props);\n\n this.state = {\n originalData: JSON.stringify(this.props.data),\n changed: false,\n errors: {},\n updateData: this.props.updateData || 0,\n systemConfig: null,\n alive: false,\n commandRunning: false,\n schema: JSON.parse(JSON.stringify(this.props.schema)),\n };\n\n this.forceUpdateHandlers = {};\n\n this.buildDependencies(this.state.schema);\n\n void this.readData().catch(error => console.error(`Cannot read data: ${error}`));\n }\n\n static getDerivedStateFromProps(\n props: JsonConfigComponentProps,\n state: JsonConfigComponentState,\n ): Partial<JsonConfigComponentState> | null {\n if (props.updateData !== state.updateData) {\n return {\n updateData: props.updateData,\n originalData: JSON.stringify(props.data),\n schema: JSON.parse(JSON.stringify(props.schema)),\n };\n }\n return null;\n }\n\n static async loadI18n(\n socket: AdminConnection,\n i18n: boolean | string | Record<string, Record<ioBroker.Languages, string>>,\n adapterName: string,\n ): Promise<string> {\n if (i18n === true || (i18n && typeof i18n === 'string')) {\n const lang = I18n.getLanguage();\n const path = typeof i18n === 'string' ? i18n : 'i18n';\n let exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}.json`);\n let fileName;\n if (exists) {\n fileName = `${path}/${lang}.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/${lang}/translations.json`);\n if (exists) {\n fileName = `${path}/${lang}/translations.json`;\n } else if (lang !== 'en') {\n // fallback to english\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en.json`);\n if (exists) {\n fileName = `${path}/en.json`;\n } else {\n exists = await socket.fileExists(`${adapterName}.admin`, `${path}/en/translations.json`);\n if (exists) {\n fileName = `${path}/en/translations.json`;\n }\n }\n }\n }\n\n if (fileName) {\n const jsonFile = await socket.readFile(`${adapterName}.admin`, fileName);\n let jsonStr: string;\n if (jsonFile.file !== undefined) {\n jsonStr = jsonFile.file;\n } else {\n // @ts-expect-error deprecated\n jsonStr = jsonFile;\n }\n\n try {\n const json = JSON.parse(jsonStr);\n // apply file to I18n\n I18n.extendTranslations(json, lang);\n } catch (e) {\n console.error(`Cannot parse language file \"${adapterName}.admin/${fileName}: ${e}`);\n return '';\n }\n return fileName;\n }\n console.warn(`Cannot find i18n for ${adapterName} / ${fileName}`);\n return '';\n }\n if (i18n && typeof i18n === 'object') {\n I18n.extendTranslations(i18n);\n return '';\n }\n return '';\n }\n\n onCommandRunning = (commandRunning: boolean): void => this.setState({ commandRunning });\n\n async readData(): Promise<void> {\n let systemConfig: ioBroker.SystemConfigObject | undefined;\n try {\n if (this.props.socket.getCompactSystemConfig) {\n systemConfig = await this.props.socket.getCompactSystemConfig();\n } else {\n systemConfig = await this.props.socket.getObject('system.config');\n }\n const state = await this.props.socket.getState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n );\n this.setState({ systemConfig: systemConfig.common, alive: !!(state && state.val) }, () => {\n this.updateContext(true);\n if (!this.props.custom) {\n void this.props.socket.subscribeState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n this.onAlive,\n );\n }\n });\n } catch (error) {\n console.error(`Cannot read system config: ${error}`);\n }\n }\n\n onAlive = (_id: string, state?: ioBroker.State | null): void => {\n if (!!state?.val !== this.state.alive) {\n this.setState({ alive: !!state?.val });\n }\n };\n\n onChange = (attrOrData: string | Record<string, any>, value: any, cb?: () => void, saveConfig?: boolean): void => {\n if (this.props.onValueChange) {\n this.props.onValueChange(attrOrData as string, value, saveConfig);\n if (cb) {\n cb();\n }\n } else if (attrOrData && this.props.onChange) {\n const newState: Partial<JsonConfigComponentState> = {\n changed: JSON.stringify(attrOrData) !== this.state.originalData,\n };\n\n this.setState(newState as JsonConfigComponentState, () => {\n this.props.onChange(attrOrData as Record<string, any>, newState.changed, saveConfig);\n if (cb) {\n cb();\n }\n });\n } else if (saveConfig) {\n this.props.onChange(null, null, saveConfig);\n }\n };\n\n onError = (attr: string, error?: string): void => {\n this.errorCached = this.errorCached || JSON.parse(JSON.stringify(this.state.errors));\n const errors = this.errorCached;\n if (error) {\n errors[attr] = error;\n } else {\n delete errors[attr];\n }\n\n if (this.errorTimeout) {\n clearTimeout(this.errorTimeout);\n }\n if (JSON.stringify(errors) !== JSON.stringify(this.state.errors)) {\n this.errorTimeout = setTimeout(\n () =>\n this.setState({ errors: this.errorCached }, () => {\n this.errorTimeout = null;\n this.errorCached = null;\n this.props.onError(!!Object.keys(this.state.errors).length);\n }),\n 50,\n );\n } else {\n this.errorCached = null;\n }\n };\n\n flatten(schema: Record<string, any>, _list?: Record<string, any>): Record<string, any> {\n _list = _list || {};\n if (schema.items) {\n Object.keys(schema.items).forEach(attr => {\n _list[attr] = schema.items[attr];\n this.flatten(schema.items[attr], _list);\n });\n }\n\n return _list;\n }\n\n buildDependencies(schema: ConfigItemTabs | ConfigItemPanel): void {\n const attrs = this.flatten(schema as Record<string, any>);\n Object.keys(attrs).forEach(attr => {\n if (attrs[attr].confirm?.alsoDependsOn) {\n attrs[attr].confirm?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].confirmDependsOn = attrs[dep].confirmDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n if (depObj.confirm) {\n depObj.confirm.cancel = 'Undo';\n }\n\n attrs[dep].confirmDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].onChange?.alsoDependsOn) {\n attrs[attr].onChange?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].onChangeDependsOn = attrs[dep].onChangeDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].onChangeDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].hidden?.alsoDependsOn) {\n attrs[attr].hidden?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].hiddenDependsOn = attrs[dep].hiddenDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].hiddenDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].label?.alsoDependsOn) {\n attrs[attr].label?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].labelDependsOn = attrs[dep].labelDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].labelDependsOn.push(depObj);\n }\n });\n }\n\n if (attrs[attr].help?.alsoDependsOn) {\n attrs[attr].help?.alsoDependsOn.forEach((dep: string) => {\n if (!attrs[dep]) {\n console.error(`[JsonConfigComponent] Attribute ${dep} does not exist!`);\n if (dep.startsWith('data.')) {\n console.warn(\n `[JsonConfigComponent] please use \"${dep.replace(/^data\\./, '')}\" instead of \"${dep}\"`,\n );\n }\n } else {\n attrs[dep].helpDependsOn = attrs[dep].helpDependsOn || [];\n\n const depObj = { ...attrs[attr], attr };\n\n attrs[dep].helpDependsOn.push(depObj);\n }\n });\n }\n });\n }\n\n updateContext(forceUpdate?: boolean): void {\n this.oContext = {\n DeviceManager: this.props.DeviceManager,\n adapterName: this.props.adapterName,\n changeLanguage: this.changeLanguage,\n common: this.props.common,\n customs: this.props.customs,\n dateFormat: this.props.dateFormat,\n embedded: this.props.embedded,\n forceUpdate: this.forceAttrUpdate,\n imagePrefix: this.props.imagePrefix,\n instance: this.props.instance,\n instanceObj: this.props.instanceObj,\n isFloatComma: this.props.isFloatComma,\n multiEdit: this.props.multiEdit,\n onBackEndCommand: this.props.onBackEndCommand,\n onCommandRunning: this.onCommandRunning,\n onValueChange: this.props.onValueChange,\n registerOnForceUpdate: this.registerOnForceUpdate,\n socket: this.props.socket,\n systemConfig: this.state.systemConfig,\n theme: this.props.theme,\n // could be changed dynamically\n themeType: this.props.themeType,\n _themeName: this.props.themeName,\n updateData: this.state.updateData,\n } as JsonConfigContext;\n\n if (forceUpdate) {\n this.forceUpdate();\n }\n }\n\n renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (item.type === 'tabs') {\n return (\n <ConfigTabs\n withoutSaveButtons={this.props.withoutSaveButtons}\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n expertMode={this.props.expertMode}\n themeName={this.props.themeName}\n customComponents={this.props.customComponents}\n />\n );\n }\n if (\n item.type === 'panel' ||\n // @ts-expect-error type could be empty\n !item.type\n ) {\n return (\n <ConfigPanel\n withoutSaveButtons={this.props.withoutSaveButtons}\n oContext={this.oContext}\n alive={this.state.alive}\n changed={this.state.changed}\n commandRunning={this.state.commandRunning}\n common={this.props.common}\n custom={this.props.custom}\n customObj={this.props.customObj}\n data={this.props.data}\n expertMode={this.props.expertMode}\n index={1000}\n isParentTab={!this.props.embedded && !this.props.withoutSaveButtons}\n onChange={this.onChange}\n onError={(attr, error) => this.onError(attr, error)}\n originalData={JSON.parse(this.state.originalData)}\n root\n schema={item}\n themeName={this.props.themeName}\n customComponents={this.props.customComponents}\n />\n );\n }\n console.error(`Unknown item type in root: ${JSON.stringify(item)}`);\n\n return null;\n }\n\n changeLanguage = (): void => {\n this.forceUpdate();\n };\n\n forceAttrUpdate = (attr: string | string[], data: any): void => {\n if (Array.isArray(attr)) {\n attr.forEach(a => this.forceUpdateHandlers[a] && this.forceUpdateHandlers[a](data));\n } else if (this.forceUpdateHandlers[attr]) {\n this.forceUpdateHandlers[attr](data);\n }\n };\n\n registerOnForceUpdate = (attr: string, cb?: ((data: any) => void) | null): void => {\n if (cb) {\n this.forceUpdateHandlers[attr] = cb;\n } else if (this.forceUpdateHandlers[attr]) {\n delete this.forceUpdateHandlers[attr];\n }\n };\n\n render(): JSX.Element {\n if (!this.state.systemConfig || !this.oContext) {\n return <LinearProgress />;\n }\n\n if (this.oContext._themeName !== this.props.themeName) {\n this.oContext._themeName = this.props.themeName;\n setTimeout(() => this.updateContext(true), 0);\n }\n\n return (\n <div\n style={{\n ...(!this.props.embedded || this.props.withoutSaveButtons ? styles.root : undefined),\n ...this.props.style,\n ...this.state.schema.style,\n }}\n >\n {this.renderItem(this.state.schema)}\n </div>\n );\n }\n}\n\nexport default JsonConfigComponent;\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -405,6 +405,8 @@ export interface ConfigItemQrCodeSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
405
405
|
bgColor?: string;
|
|
406
406
|
/** QR code level */
|
|
407
407
|
level?: 'L' | 'M' | 'Q' | 'H';
|
|
408
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
409
|
+
instance?: string;
|
|
408
410
|
}
|
|
409
411
|
|
|
410
412
|
export interface ConfigItemPassword extends ConfigItem {
|
|
@@ -667,6 +669,8 @@ export interface ConfigItemAutocompleteSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
667
669
|
/** @deprecated use maxLength */
|
|
668
670
|
max?: string;
|
|
669
671
|
alsoDependsOn?: string[];
|
|
672
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
673
|
+
instance?: string;
|
|
670
674
|
}
|
|
671
675
|
|
|
672
676
|
export interface ConfigItemAccordion extends ConfigItem {
|
|
@@ -772,6 +776,8 @@ export interface ConfigItemIFrameSendTo extends Omit<ConfigItemIFrame, 'data' |
|
|
|
772
776
|
command?: string;
|
|
773
777
|
alsoDependsOn?: string[];
|
|
774
778
|
data?: Record<string, any>;
|
|
779
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
780
|
+
instance?: string;
|
|
775
781
|
}
|
|
776
782
|
|
|
777
783
|
export interface ConfigItemImageSendTo extends Omit<ConfigItem, 'data'> {
|
|
@@ -781,6 +787,8 @@ export interface ConfigItemImageSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
781
787
|
height?: number | string;
|
|
782
788
|
data?: Record<string, any>;
|
|
783
789
|
sendFirstByClick?: boolean | ioBroker.StringOrTranslated;
|
|
790
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
791
|
+
instance?: string;
|
|
784
792
|
}
|
|
785
793
|
|
|
786
794
|
export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
|
|
@@ -809,6 +817,8 @@ export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
809
817
|
copyToClipboard?: boolean;
|
|
810
818
|
/** Styles for the button itself */
|
|
811
819
|
controlStyle?: CustomCSSProperties;
|
|
820
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
821
|
+
instance?: string;
|
|
812
822
|
}
|
|
813
823
|
|
|
814
824
|
export interface ConfigItemState extends ConfigItem {
|
|
@@ -884,6 +894,8 @@ export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
884
894
|
jsonData?: string;
|
|
885
895
|
/** object - `{"subject1": 1, "data": "static"}`. You can specify jsonData or data, but not both. This data will be sent to the backend if jsonData is not defined. */
|
|
886
896
|
data?: Record<string, any>;
|
|
897
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
898
|
+
instance?: string;
|
|
887
899
|
}
|
|
888
900
|
|
|
889
901
|
export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
|
|
@@ -904,6 +916,8 @@ export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
904
916
|
data?: Record<string, any>;
|
|
905
917
|
/** by change of which attributes, the command must be resent */
|
|
906
918
|
alsoDependsOn?: string[];
|
|
919
|
+
/** Instance where to send the request to. Overrides the value of `oContext.instance` */
|
|
920
|
+
instance?: string;
|
|
907
921
|
}
|
|
908
922
|
|
|
909
923
|
export interface ConfigItemTable extends ConfigItem {
|