@iobroker/json-config 8.3.10 → 8.3.11
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 +58 -58
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +2 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.js +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js +2 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +2 -2
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +2 -1
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +2 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/package.json +1 -1
|
@@ -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;AA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,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gCACtB,MAAM,CAAC,IAAI,EAAE,CAAC;4BAClB,CAAC;4BACD,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAClC,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"]}
|
|
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,Q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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 const instance = this.getPattern(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n\n void this.props.oContext.socket\n .sendTo(instance, this.props.schema.command || 'send', data)\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"]}
|
|
@@ -203,8 +203,9 @@ export default class ConfigSendto extends ConfigGeneric {
|
|
|
203
203
|
this.setState({ _error: I18n.t('ra_Request timed out'), running: false });
|
|
204
204
|
}, parseInt(this.props.schema.timeout, 10) || 10000);
|
|
205
205
|
}
|
|
206
|
+
const instance = this.getPattern(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`);
|
|
206
207
|
void this.props.oContext.socket
|
|
207
|
-
.sendTo(
|
|
208
|
+
.sendTo(instance, this.props.schema.command || 'send', data)
|
|
208
209
|
.then(async (response) => {
|
|
209
210
|
if (timeout) {
|
|
210
211
|
clearTimeout(timeout);
|
|
@@ -1 +1 @@
|
|
|
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,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE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,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"]}
|
|
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,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,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 const instance = this.getPattern(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n void this.props.oContext.socket\n .sendTo(instance, this.props.schema.command || 'send', data)\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"]}
|
|
@@ -24,8 +24,9 @@ class ConfigTextSendTo extends ConfigGeneric {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
data ??= null;
|
|
27
|
+
const instance = this.getPattern(this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`);
|
|
27
28
|
void this.props.oContext.socket
|
|
28
|
-
.sendTo(
|
|
29
|
+
.sendTo(instance, this.props.schema.command || 'send', data)
|
|
29
30
|
.then(result => {
|
|
30
31
|
if (typeof result === 'object') {
|
|
31
32
|
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;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KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gCACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;4BACtC,CAAC;4BAED,oBAAC,QAAQ,OAAG,CACH,CAChB,CAAC,CAAC,CAAC,SAAS;qBAChB;iBACJ,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACtB,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,GACH,CACL,CAAC;QACN,CAAC;QACD,OAAO,CACH,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,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"]}
|
|
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;KA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P,QAAQ,EAAE,CAAC,CAAC,EACZ,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;gCACV,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gCACvC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;4BACtC,CAAC;4BAED,oBAAC,QAAQ,OAAG,CACH,CAChB,CAAC,CAAC,CAAC,SAAS;qBAChB;iBACJ,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACtB,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,GACH,CACL,CAAC;QACN,CAAC;QACD,OAAO,CACH,6BAAK,KAAK,EAAE,EAAE,GAAG,MAAM,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 const instance = this.getPattern(\n this.props.schema.instance || `${this.props.oContext.adapterName}.${this.props.oContext.instance}`,\n );\n void this.props.oContext.socket\n .sendTo(instance, this.props.schema.command || 'send', data)\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"]}
|