@iobroker/json-config 8.4.0 → 8.4.3
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 +4 -1
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js +8 -0
- package/build/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js +1 -1
- package/build/JsonConfigComponent/ConfigCertCollection.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js +1 -1
- package/build/JsonConfigComponent/ConfigCertificates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCheckLicense.js +5 -5
- package/build/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js +1 -1
- package/build/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/build/JsonConfigComponent/ConfigGeneric.d.ts +2 -0
- package/build/JsonConfigComponent/ConfigGeneric.js +26 -7
- package/build/JsonConfigComponent/ConfigGeneric.js.map +1 -1
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js +9 -0
- package/build/JsonConfigComponent/ConfigIFrameSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigImageSendTo.js +8 -0
- package/build/JsonConfigComponent/ConfigImageSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js +1 -1
- package/build/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/build/JsonConfigComponent/ConfigPort.js +1 -1
- package/build/JsonConfigComponent/ConfigPort.js.map +1 -1
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js +17 -0
- package/build/JsonConfigComponent/ConfigQrCodeSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js +1 -1
- package/build/JsonConfigComponent/ConfigSelect.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSelectSendTo.js +8 -0
- package/build/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSendto.js +11 -3
- package/build/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js +1 -1
- package/build/JsonConfigComponent/ConfigSetState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigState.js +1 -1
- package/build/JsonConfigComponent/ConfigState.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTable.js +1 -1
- package/build/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/build/JsonConfigComponent/ConfigTextSendTo.js +8 -0
- package/build/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js +1 -1
- package/build/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/build/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigCoordinates.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCoordinates.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,KAAK,EAAE;QACH,KAAK,EAAE,mBAAmB;KAC7B;IACD,OAAO,EAAE;QACL,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,CAAC;KACjB;CACJ,CAAC;AAYF,MAAM,iBAAkB,SAAQ,aAA6D;IACzF,KAAK,CAAC,iBAAiB;QACnB,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAEhC,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC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,CAAC;IACN,CAAC;CACJ;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, Fab, FormControlLabel, Checkbox } from '@mui/material';\n\nimport { GpsFixed as IconGpsFixed, LocationOn as IconLocationOn } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemCoordinates } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n width: {\n width: 'calc(100% - 85px)',\n },\n width50: {\n width: 120,\n marginRight: 5,\n },\n};\n\ninterface ConfigCoordinatesProps extends ConfigGenericProps {\n schema: ConfigItemCoordinates;\n}\n\ninterface ConfigCoordinatesState extends ConfigGenericState {\n useSystem?: boolean;\n longitude?: string | number;\n latitude?: string | number;\n}\n\nclass ConfigCoordinates extends ConfigGeneric<ConfigCoordinatesProps, ConfigCoordinatesState> {\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({ value });\n\n const newState: Partial<ConfigCoordinatesState> = {};\n if (this.props.schema.useSystemName) {\n newState.useSystem = !!ConfigGeneric.getValue(this.props.data, this.props.schema.useSystemName);\n }\n if (this.props.schema.longitudeName && this.props.schema.latitudeName) {\n newState.longitude = ConfigGeneric.getValue(this.props.data, this.props.schema.longitudeName);\n newState.latitude = ConfigGeneric.getValue(this.props.data, this.props.schema.latitudeName);\n if (!newState.longitude && !newState.latitude && this.props.schema.autoInit) {\n setTimeout(() => this.getCoordinates(), 300);\n }\n } else {\n const value_ = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (!value_ && this.props.schema.autoInit) {\n setTimeout(() => this.getCoordinates(), 300);\n }\n }\n if (Object.keys(newState).length) {\n setTimeout(() => this.setState(newState as ConfigCoordinatesState), 50);\n }\n }\n\n async getSystemCoordinates(): Promise<void> {\n let systemConfig: ioBroker.SystemConfigObject | undefined;\n try {\n if (this.props.oContext.socket.getCompactSystemConfig) {\n systemConfig = await this.props.oContext.socket.getCompactSystemConfig();\n } else {\n systemConfig = (await this.props.oContext.getCachedObject('system.config')) as\n | ioBroker.SystemConfigObject\n | undefined;\n }\n } catch (e) {\n console.error(`Cannot get system configuration: ${e}`);\n }\n if (systemConfig?.common && (systemConfig.common.longitude || systemConfig.common.latitude)) {\n window.alert(I18n.t('ra_Used system settings'));\n if (this.props.schema.longitudeName && this.props.schema.latitudeName) {\n this.setState(\n {\n longitude: systemConfig.common.longitude,\n latitude: systemConfig.common.latitude,\n },\n async () => {\n await this.onChange(this.props.schema.longitudeName, systemConfig.common.longitude);\n await this.onChange(this.props.schema.latitudeName, systemConfig.common.latitude);\n },\n );\n } else {\n const value =\n systemConfig.common.latitude + (this.props.schema.divider || ',') + systemConfig.common.longitude;\n this.setState(\n {\n value,\n },\n () => {\n const mayByPromise = this.onChange(this.props.attr, value);\n if (mayByPromise instanceof Promise) {\n mayByPromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n },\n );\n }\n } else {\n window.alert(\n I18n.t(\n 'ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser',\n ),\n );\n }\n }\n\n getCoordinates(): void {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n async (position: GeolocationPosition): Promise<void> => {\n if (position?.coords) {\n if (this.props.schema.longitudeName && this.props.schema.latitudeName) {\n this.setState(\n {\n longitude: position.coords.longitude,\n latitude: position.coords.latitude,\n },\n async () => {\n await this.onChange(\n this.props.schema.longitudeName,\n position.coords.longitude || '',\n );\n await this.onChange(this.props.schema.latitudeName, position.coords.latitude || '');\n },\n );\n } else {\n const value =\n position.coords.latitude +\n (this.props.schema.divider || ',') +\n position.coords.longitude;\n this.setState({ value }, () => {\n const mayByPromise = this.onChange(this.props.attr, value);\n if (mayByPromise instanceof Promise) {\n mayByPromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n });\n }\n } else {\n await this.getSystemCoordinates();\n }\n },\n async (error: GeolocationPositionError): Promise<void> => {\n console.error(`Cannot determine coordinates from browser: ${error.message}`);\n await this.getSystemCoordinates();\n },\n );\n } else {\n void this.getSystemCoordinates().catch(e => {\n console.error(`Cannot determine coordinates: ${e}`);\n });\n }\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n return (\n <>\n {this.props.schema.useSystemName ? (\n <FormControlLabel\n control={\n <Checkbox\n checked={!!this.state.useSystem}\n onChange={e => {\n const useSystem = e.target.checked;\n if (useSystem) {\n void this.getSystemCoordinates().catch(e =>\n console.error(`Cannot determine coordinates: ${e}`),\n );\n }\n this.setState({ useSystem }, () =>\n this.onChange(this.props.schema.useSystemName, useSystem),\n );\n }}\n />\n }\n label={I18n.t('ra_Use system settings for position')}\n />\n ) : null}\n {this.props.schema.longitudeName && this.props.schema.latitudeName ? (\n <TextField\n variant=\"standard\"\n style={styles.width50}\n value={this.state.longitude ?? ''}\n error={!!error}\n disabled={this.state.useSystem || !!disabled}\n onChange={e => {\n const longitude = e.target.value;\n this.setState({ longitude }, () => {\n const mayBePromise = this.onChange(\n this.props.schema.longitudeName,\n (longitude || '').trim(),\n );\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n });\n }}\n label={I18n.t('ra_Longitude')}\n />\n ) : null}\n {this.props.schema.longitudeName && this.props.schema.latitudeName ? (\n <TextField\n variant=\"standard\"\n style={styles.width50}\n value={this.state.latitude ?? ''}\n error={!!error}\n disabled={this.state.useSystem || !!disabled}\n onChange={e => {\n const latitude = e.target.value;\n this.setState({ latitude }, () =>\n this.onChange(this.props.schema.latitudeName, (latitude || '').trim()),\n );\n }}\n label={I18n.t('ra_Latitude')}\n />\n ) : null}\n {!this.props.schema.longitudeName || !this.props.schema.latitudeName ? (\n <TextField\n variant=\"standard\"\n style={styles.width}\n value={this.state.value ?? ''}\n error={!!error}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.state.useSystem,\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 ) : null}\n {!this.state.useSystem ? (\n <Fab\n size=\"small\"\n onClick={() => this.getCoordinates()}\n title={I18n.t('ra_Take browser position')}\n style={{ marginRight: 4 }}\n >\n <IconLocationOn />\n </Fab>\n ) : null}\n {!this.state.useSystem ? (\n <Fab\n size=\"small\"\n onClick={() => this.getSystemCoordinates()}\n title={I18n.t('ra_Take position from system settings')}\n >\n <IconGpsFixed />\n </Fab>\n ) : null}\n </>\n );\n }\n}\n\nexport default ConfigCoordinates;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfigCoordinates.js","sourceRoot":"./src/","sources":["JsonConfigComponent/ConfigCoordinates.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAGlD,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAElG,MAAM,MAAM,GAAwC;IAChD,KAAK,EAAE;QACH,KAAK,EAAE,mBAAmB;KAC7B;IACD,OAAO,EAAE;QACL,KAAK,EAAE,GAAG;QACV,WAAW,EAAE,CAAC;KACjB;CACJ,CAAC;AAYF,MAAM,iBAAkB,SAAQ,aAA6D;IACzF,KAAK,CAAC,iBAAiB;QACnB,MAAM,KAAK,CAAC,iBAAiB,EAAE,CAAC;QA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AAG,CACd,CACT,CAAC,CAAC,CAAC,IAAI,CACT,CACN,CAAC;IACN,CAAC;CACJ;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { TextField, Fab, FormControlLabel, Checkbox } from '@mui/material';\n\nimport { GpsFixed as IconGpsFixed, LocationOn as IconLocationOn } from '@mui/icons-material';\n\nimport { I18n } from '@iobroker/adapter-react-v5';\n\nimport type { ConfigItemCoordinates } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\n\nconst styles: Record<string, React.CSSProperties> = {\n width: {\n width: 'calc(100% - 85px)',\n },\n width50: {\n width: 120,\n marginRight: 5,\n },\n};\n\ninterface ConfigCoordinatesProps extends ConfigGenericProps {\n schema: ConfigItemCoordinates;\n}\n\ninterface ConfigCoordinatesState extends ConfigGenericState {\n useSystem?: boolean;\n longitude?: string | number;\n latitude?: string | number;\n}\n\nclass ConfigCoordinates extends ConfigGeneric<ConfigCoordinatesProps, ConfigCoordinatesState> {\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n\n const value = ConfigGeneric.getValue(this.props.data, this.props.attr);\n this.setState({ value });\n\n const newState: Partial<ConfigCoordinatesState> = {};\n if (this.props.schema.useSystemName) {\n newState.useSystem = !!ConfigGeneric.getValue(this.props.data, this.props.schema.useSystemName);\n }\n if (this.props.schema.longitudeName && this.props.schema.latitudeName) {\n newState.longitude = ConfigGeneric.getValue(this.props.data, this.props.schema.longitudeName);\n newState.latitude = ConfigGeneric.getValue(this.props.data, this.props.schema.latitudeName);\n if (!newState.longitude && !newState.latitude && this.props.schema.autoInit) {\n setTimeout(() => this.getCoordinates(), 300);\n }\n } else {\n const value_ = ConfigGeneric.getValue(this.props.data, this.props.attr);\n if (!value_ && this.props.schema.autoInit) {\n setTimeout(() => this.getCoordinates(), 300);\n }\n }\n if (Object.keys(newState).length) {\n setTimeout(() => this.setState(newState as ConfigCoordinatesState), 50);\n }\n }\n\n async getSystemCoordinates(): Promise<void> {\n let systemConfig: ioBroker.SystemConfigObject | undefined;\n try {\n if (this.props.oContext.socket.getCompactSystemConfig) {\n systemConfig = await this.props.oContext.socket.getCompactSystemConfig();\n } else {\n systemConfig = (await this.getCachedObject('system.config')) as ioBroker.SystemConfigObject | undefined;\n }\n } catch (e) {\n console.error(`Cannot get system configuration: ${e}`);\n }\n if (systemConfig?.common && (systemConfig.common.longitude || systemConfig.common.latitude)) {\n window.alert(I18n.t('ra_Used system settings'));\n if (this.props.schema.longitudeName && this.props.schema.latitudeName) {\n this.setState(\n {\n longitude: systemConfig.common.longitude,\n latitude: systemConfig.common.latitude,\n },\n async () => {\n await this.onChange(this.props.schema.longitudeName, systemConfig.common.longitude);\n await this.onChange(this.props.schema.latitudeName, systemConfig.common.latitude);\n },\n );\n } else {\n const value =\n systemConfig.common.latitude + (this.props.schema.divider || ',') + systemConfig.common.longitude;\n this.setState(\n {\n value,\n },\n () => {\n const mayByPromise = this.onChange(this.props.attr, value);\n if (mayByPromise instanceof Promise) {\n mayByPromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n },\n );\n }\n } else {\n window.alert(\n I18n.t(\n 'ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser',\n ),\n );\n }\n }\n\n getCoordinates(): void {\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(\n async (position: GeolocationPosition): Promise<void> => {\n if (position?.coords) {\n if (this.props.schema.longitudeName && this.props.schema.latitudeName) {\n this.setState(\n {\n longitude: position.coords.longitude,\n latitude: position.coords.latitude,\n },\n async () => {\n await this.onChange(\n this.props.schema.longitudeName,\n position.coords.longitude || '',\n );\n await this.onChange(this.props.schema.latitudeName, position.coords.latitude || '');\n },\n );\n } else {\n const value =\n position.coords.latitude +\n (this.props.schema.divider || ',') +\n position.coords.longitude;\n this.setState({ value }, () => {\n const mayByPromise = this.onChange(this.props.attr, value);\n if (mayByPromise instanceof Promise) {\n mayByPromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n });\n }\n } else {\n await this.getSystemCoordinates();\n }\n },\n async (error: GeolocationPositionError): Promise<void> => {\n console.error(`Cannot determine coordinates from browser: ${error.message}`);\n await this.getSystemCoordinates();\n },\n );\n } else {\n void this.getSystemCoordinates().catch(e => {\n console.error(`Cannot determine coordinates: ${e}`);\n });\n }\n }\n\n renderItem(error: string, disabled: boolean /* , defaultValue */): JSX.Element {\n return (\n <>\n {this.props.schema.useSystemName ? (\n <FormControlLabel\n control={\n <Checkbox\n checked={!!this.state.useSystem}\n onChange={e => {\n const useSystem = e.target.checked;\n if (useSystem) {\n void this.getSystemCoordinates().catch(e =>\n console.error(`Cannot determine coordinates: ${e}`),\n );\n }\n this.setState({ useSystem }, () =>\n this.onChange(this.props.schema.useSystemName, useSystem),\n );\n }}\n />\n }\n label={I18n.t('ra_Use system settings for position')}\n />\n ) : null}\n {this.props.schema.longitudeName && this.props.schema.latitudeName ? (\n <TextField\n variant=\"standard\"\n style={styles.width50}\n value={this.state.longitude ?? ''}\n error={!!error}\n disabled={this.state.useSystem || !!disabled}\n onChange={e => {\n const longitude = e.target.value;\n this.setState({ longitude }, () => {\n const mayBePromise = this.onChange(\n this.props.schema.longitudeName,\n (longitude || '').trim(),\n );\n if (mayBePromise instanceof Promise) {\n mayBePromise.catch(e => console.error(`Cannot set value: ${e}`));\n }\n });\n }}\n label={I18n.t('ra_Longitude')}\n />\n ) : null}\n {this.props.schema.longitudeName && this.props.schema.latitudeName ? (\n <TextField\n variant=\"standard\"\n style={styles.width50}\n value={this.state.latitude ?? ''}\n error={!!error}\n disabled={this.state.useSystem || !!disabled}\n onChange={e => {\n const latitude = e.target.value;\n this.setState({ latitude }, () =>\n this.onChange(this.props.schema.latitudeName, (latitude || '').trim()),\n );\n }}\n label={I18n.t('ra_Latitude')}\n />\n ) : null}\n {!this.props.schema.longitudeName || !this.props.schema.latitudeName ? (\n <TextField\n variant=\"standard\"\n style={styles.width}\n value={this.state.value ?? ''}\n error={!!error}\n disabled={!!disabled}\n slotProps={{\n htmlInput: {\n maxLength: this.props.schema.maxLength || this.props.schema.max || undefined,\n readOnly: this.state.useSystem,\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 ) : null}\n {!this.state.useSystem ? (\n <Fab\n size=\"small\"\n onClick={() => this.getCoordinates()}\n title={I18n.t('ra_Take browser position')}\n style={{ marginRight: 4 }}\n >\n <IconLocationOn />\n </Fab>\n ) : null}\n {!this.state.useSystem ? (\n <Fab\n size=\"small\"\n onClick={() => this.getSystemCoordinates()}\n title={I18n.t('ra_Take position from system settings')}\n >\n <IconGpsFixed />\n </Fab>\n ) : null}\n </>\n );\n }\n}\n\nexport default ConfigCoordinates;\n"]}
|
|
@@ -89,7 +89,9 @@ export default class ConfigGeneric<Props extends ConfigGenericProps = ConfigGene
|
|
|
89
89
|
private noPlaceRequired;
|
|
90
90
|
private reportedHidden;
|
|
91
91
|
private calculateTimeout;
|
|
92
|
+
private readonly AsyncFunction;
|
|
92
93
|
constructor(props: Props);
|
|
94
|
+
protected getCachedObject(id: string): Promise<ioBroker.Object | null>;
|
|
93
95
|
componentDidMount(): Promise<void>;
|
|
94
96
|
sendTo(): Promise<void>;
|
|
95
97
|
componentWillUnmount(): void;
|
|
@@ -25,8 +25,10 @@ export default class ConfigGeneric extends Component {
|
|
|
25
25
|
noPlaceRequired;
|
|
26
26
|
reportedHidden = false;
|
|
27
27
|
calculateTimeout = null;
|
|
28
|
+
AsyncFunction;
|
|
28
29
|
constructor(props) {
|
|
29
30
|
super(props);
|
|
31
|
+
this.AsyncFunction = Object.getPrototypeOf(async function () { }).constructor;
|
|
30
32
|
// @ts-expect-error of course, as we just
|
|
31
33
|
this.state = {
|
|
32
34
|
confirmDialog: false,
|
|
@@ -50,6 +52,13 @@ export default class ConfigGeneric extends Component {
|
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
}
|
|
55
|
+
// eslint-disable-next-line react/no-unused-class-component-methods
|
|
56
|
+
async getCachedObject(id) {
|
|
57
|
+
if (this.props.oContext.getCachedObject) {
|
|
58
|
+
return this.props.oContext.getCachedObject(id);
|
|
59
|
+
}
|
|
60
|
+
return (await this.props.oContext.socket.getObject(id)) || null;
|
|
61
|
+
}
|
|
53
62
|
async componentDidMount() {
|
|
54
63
|
if (this.props.schema?.defaultFunc) {
|
|
55
64
|
if (this.props.custom) {
|
|
@@ -103,8 +112,18 @@ export default class ConfigGeneric extends Component {
|
|
|
103
112
|
if (data === undefined) {
|
|
104
113
|
data = null;
|
|
105
114
|
}
|
|
115
|
+
const instance = await this.getPatternAsync(this.props.schema.instance ||
|
|
116
|
+
`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);
|
|
117
|
+
// Check that instance is alive
|
|
118
|
+
if (instance !== `${this.props.oContext.adapterName}.${this.props.oContext.instance}`) {
|
|
119
|
+
const alive = await this.props.oContext.socket.getState(`system.adapter.${instance}.alive`);
|
|
120
|
+
if (!alive?.val) {
|
|
121
|
+
window.alert(I18n.t('ra_Instance %s is not alive', instance));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
106
125
|
void this.props.oContext.socket
|
|
107
|
-
.sendTo(
|
|
126
|
+
.sendTo(instance, this.props.schema.defaultSendTo, data)
|
|
108
127
|
.then((value) => {
|
|
109
128
|
if (value !== null && value !== undefined) {
|
|
110
129
|
if (this.props.custom) {
|
|
@@ -510,7 +529,7 @@ export default class ConfigGeneric extends Component {
|
|
|
510
529
|
fun = ConfigGeneric.ensureAwaitGetObject(fun);
|
|
511
530
|
}
|
|
512
531
|
try {
|
|
513
|
-
const f = new
|
|
532
|
+
const f = new this.AsyncFunction('data', 'originalData', '_system', '_alive', '_common', '_socket', '_instance', 'arrayIndex', 'globalData', '_changed', '_href', 'getObject', fun.includes('return') ? fun : `return ${fun}`);
|
|
514
533
|
return await f(data || this.props.data, this.props.originalData, this.props.oContext.systemConfig, this.props.alive, this.props.common, this.props.oContext.socket, this.props.oContext.instance, arrayIndex, globalData, this.props.changed, window.location.href, this.getObject);
|
|
515
534
|
}
|
|
516
535
|
catch (e) {
|
|
@@ -537,7 +556,7 @@ export default class ConfigGeneric extends Component {
|
|
|
537
556
|
fun = ConfigGeneric.ensureAwaitGetObject(fun);
|
|
538
557
|
}
|
|
539
558
|
try {
|
|
540
|
-
const f = new
|
|
559
|
+
const f = new this.AsyncFunction('data', 'originalData', '_system', 'instanceObj', 'customObj', '_socket', 'arrayIndex', 'globalData', '_changed', '_href', 'getObject', fun.includes('return') ? fun : `return ${fun}`);
|
|
541
560
|
return await f(data || this.props.data, this.props.originalData, this.props.oContext.systemConfig, instanceObj, customObj, this.props.oContext.socket, arrayIndex, globalData, this.props.changed, window.location.href, this.getObject);
|
|
542
561
|
}
|
|
543
562
|
catch (e) {
|
|
@@ -691,14 +710,14 @@ export default class ConfigGeneric extends Component {
|
|
|
691
710
|
}
|
|
692
711
|
try {
|
|
693
712
|
if (this.props.custom) {
|
|
694
|
-
const f = new
|
|
713
|
+
const f = new this.AsyncFunction('data', 'originalData', 'arrayIndex', 'globalData', '_system', 'instanceObj', 'customObj', '_socket', '_changed', '_href', 'getObject', `return \`${ConfigGeneric.escapeString(patternStr, data)}\``);
|
|
695
714
|
const text = await f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.oContext.systemConfig, this.props.oContext.instanceObj, this.props.customObj, this.props.oContext.socket, this.props.changed, window.location.href, this.getObject);
|
|
696
715
|
if (noTranslation) {
|
|
697
716
|
return text;
|
|
698
717
|
}
|
|
699
718
|
return I18n.t(text);
|
|
700
719
|
}
|
|
701
|
-
const f = new
|
|
720
|
+
const f = new this.AsyncFunction('data', 'originalData', 'arrayIndex', 'globalData', '_system', '_alive', '_common', '_socket', '_changed', '_href', 'getObject', `return \`${ConfigGeneric.escapeString(patternStr, data)}\``);
|
|
702
721
|
const text = await f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.oContext.systemConfig, this.props.alive, this.props.common, this.props.oContext.socket, this.props.changed, window.location.href, this.getObject);
|
|
703
722
|
if (noTranslation) {
|
|
704
723
|
return text;
|
|
@@ -734,14 +753,14 @@ export default class ConfigGeneric extends Component {
|
|
|
734
753
|
}
|
|
735
754
|
try {
|
|
736
755
|
if (this.props.custom) {
|
|
737
|
-
const f = new
|
|
756
|
+
const f = new this.AsyncFunction('data', 'originalData', 'arrayIndex', 'globalData', '_system', 'instanceObj', 'customObj', '_socket', '_changed', '_href', 'getObject', `return \`${ConfigGeneric.escapeString(patternStr, data)}\``);
|
|
738
757
|
const text = f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.oContext.systemConfig, this.props.oContext.instanceObj, this.props.customObj, this.props.oContext.socket, this.props.changed, window.location.href, this.getObject);
|
|
739
758
|
if (noTranslation) {
|
|
740
759
|
return text;
|
|
741
760
|
}
|
|
742
761
|
return I18n.t(text);
|
|
743
762
|
}
|
|
744
|
-
const f = new
|
|
763
|
+
const f = new this.AsyncFunction('data', 'originalData', 'arrayIndex', 'globalData', '_system', '_alive', '_common', '_socket', '_changed', '_href', 'getObject', `return \`${ConfigGeneric.escapeString(patternStr, data)}\``);
|
|
745
764
|
const text = f(data, this.props.originalData, this.props.arrayIndex, this.props.globalData, this.props.oContext.systemConfig, this.props.alive, this.props.common, this.props.oContext.socket, this.props.changed, window.location.href, this.getObject);
|
|
746
765
|
if (noTranslation) {
|
|
747
766
|
return text;
|