@iobroker/json-config 9.0.19 → 9.0.21

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.
@@ -232,6 +232,11 @@ export default class ConfigTabs extends ConfigGeneric {
232
232
  calculatedValuesTable[name] = { hidden: true, disabled: false };
233
233
  continue;
234
234
  }
235
+ // Do not show the tab if it is not intended for the host, where the instance runs
236
+ if (!ConfigGeneric.isHostAllowed(items[name], this.props.oContext.hostInfo)) {
237
+ calculatedValuesTable[name] = { hidden: true, disabled: false };
238
+ continue;
239
+ }
235
240
  if (this.props.custom) {
236
241
  const hidden = !!(await this.executeCustom(items[name].hidden, this.props.data, this.props.customObj, this.props.oContext.instanceObj, this.props.index, this.props.globalData));
237
242
  if (hidden) {
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigTabs.js","sourceRoot":"src/","sources":["JsonConfigComponent/ConfigTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG3E,OAAO,aAAmE,MAAM,iBAAiB,CAAC;AAClG,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,MAAM,GAAwC;IAChD,IAAI,EAAE;QACF,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KAChB;IACD,KAAK,EAAE;QACH,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,OAAO;KACnB;IACD,cAAc,EAAE;QACZ,MAAM,EAAE,mBAAmB;KAC9B;IACD,iBAAiB,EAAE;QACf,MAAM,EAAE,mBAAmB;KAC9B;CACJ,CAAC;AAuBF,MAAM,CAAC,OAAO,OAAO,UAAW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SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAC/C,CACA,CACT,CAAC;IACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Tabs, Tab, IconButton, Toolbar, Menu, MenuItem, ListItemIcon, Box } from '@mui/material';\nimport { Menu as MenuIcon, Error as ErrorIcon } from '@mui/icons-material';\n\nimport type { ConfigItemTabs } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n tabs: {\n height: '100%',\n width: '100%',\n },\n panel: {\n width: '100%',\n display: 'block',\n },\n panelWithIcons: {\n height: 'calc(100% - 72px)',\n },\n panelWithoutIcons: {\n height: 'calc(100% - 48px)',\n },\n};\n\ninterface ConfigTabsProps extends ConfigGenericProps {\n schema: ConfigItemTabs;\n dialogName?: string;\n withoutSaveButtons?: boolean;\n}\n\ninterface ConfigTabsState extends ConfigGenericState {\n tab?: string;\n /** Show the burger menu instead of the tab bar (true only for very narrow widths). Decided with hysteresis. */\n useMenu: boolean;\n openMenu: HTMLButtonElement | null;\n tabErrors: Record<string, Record<string, string>>; // tab -> attr -> error\n calculatedValuesTable: Record<string, { hidden: boolean; disabled: boolean }> | null;\n /**\n * Width (px) reserved on the container while a tab switch is in progress, or undefined when\n * no switch is pending. Prevents the shrink-to-fit dialog from collapsing during the frame\n * where the freshly-mounted panel still renders no content. See pinWidthForTransition().\n */\n contentMinWidth?: number;\n}\n\nexport default class ConfigTabs extends ConfigGeneric<ConfigTabsProps, ConfigTabsState> {\n /** Below this width the tabs collapse into a burger menu */\n private static readonly MENU_WIDTH = 600;\n /**\n * Dead-band around MENU_WIDTH. A scrollbar appearing/disappearing on a tab change shifts\n * clientWidth by ~15px; without this dead-band that would toggle bar<->menu and flicker.\n */\n private static readonly MENU_HYSTERESIS = 40;\n\n private resizeObserver: ResizeObserver | null = null;\n private resizeRaf: number | null = null;\n private calculateTimeoutTable: ReturnType<typeof setTimeout> | null = null;\n private pinTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private readonly refDiv: React.RefObject<HTMLDivElement | null>;\n\n constructor(props: ConfigTabsProps) {\n super(props);\n let tab: string | undefined;\n\n if (this.props.root) {\n // read the path from hash\n // #tab-instances/config/system.adapter.ping.0/<TAB-NAME-OR-INDEX>\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n if (tabS && tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (tabS && Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n\n // install on hash change handler\n window.addEventListener('hashchange', this.onHashTabsChanged, false);\n }\n }\n\n if (tab === undefined) {\n tab =\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n ) || Object.keys(this.props.schema.items)[0];\n if (!Object.keys(this.props.schema.items).includes(tab)) {\n tab = Object.keys(this.props.schema.items)[0];\n }\n }\n this.refDiv = React.createRef();\n\n Object.assign(this.state, { tab, useMenu: false, openMenu: null, tabErrors: {} });\n }\n\n onTabError = (attr?: string, error?: string): void => {\n const currentTab = this.state.tab;\n if (!currentTab && attr) {\n // Forward to parent if no current tab\n this.props.onError(attr, error);\n return;\n }\n\n const newTabErrors = { ...this.state.tabErrors };\n\n if (currentTab) {\n newTabErrors[currentTab] ||= {};\n }\n\n if (currentTab && attr) {\n if (!error) {\n delete newTabErrors[currentTab][attr];\n // Clean up empty tab error objects\n if (Object.keys(newTabErrors[currentTab]).length === 0) {\n delete newTabErrors[currentTab];\n }\n } else {\n newTabErrors[currentTab][attr] = error;\n }\n }\n\n this.setState({ tabErrors: newTabErrors });\n\n // Also forward to parent\n this.props.onError(attr, error);\n };\n\n hasTabErrors = (tabName: string): boolean => {\n return !!this.state.tabErrors[tabName] && Object.keys(this.state.tabErrors[tabName]).length > 0;\n };\n\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n // Measure the real width synchronously so the first painted frame already\n // uses the correct breakpoint (no visible tabs -> menu switch).\n this.measureWidth();\n // Keep the width up to date on later layout changes (dialog open animation,\n // async detail loading, window/dialog resize) instead of freezing a\n // transient - possibly too narrow - initial measurement.\n if (this.refDiv.current && typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(() => {\n // Coalesce bursts into a single measurement per frame. This also breaks the\n // ResizeObserver feedback loop: switching bar<->menu changes the layout, which\n // would otherwise notify the observer again immediately and cause flickering.\n if (this.resizeRaf !== null) {\n return;\n }\n this.resizeRaf = window.requestAnimationFrame(() => {\n this.resizeRaf = null;\n this.measureWidth();\n });\n });\n this.resizeObserver.observe(this.refDiv.current);\n }\n }\n\n componentWillUnmount(): void {\n if (this.resizeRaf !== null) {\n window.cancelAnimationFrame(this.resizeRaf);\n this.resizeRaf = null;\n }\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n if (this.calculateTimeoutTable) {\n clearTimeout(this.calculateTimeoutTable);\n this.calculateTimeoutTable = null;\n }\n if (this.pinTimeout) {\n clearTimeout(this.pinTimeout);\n this.pinTimeout = null;\n }\n window.removeEventListener('hashchange', this.onHashTabsChanged, false);\n super.componentWillUnmount();\n }\n\n /**\n * Freeze the current container width for the duration of a tab switch. Switching tabs remounts\n * the panel (key={tab}), and a freshly-mounted ConfigPanel renders `null` for a frame or two\n * while it computes its calculated values. In that gap the widest content is just the tab bar,\n * so the shrink-to-fit dialog collapses and then grows back - the visible width \"jump\".\n *\n * We capture the width shown by the outgoing tab and apply it as a temporary minWidth floor, then\n * release it shortly after so genuine resizes (window/dialog) keep working normally afterwards.\n */\n private pinWidthForTransition(): void {\n const width = this.refDiv.current?.clientWidth;\n if (!width) {\n return;\n }\n if (this.pinTimeout) {\n clearTimeout(this.pinTimeout);\n }\n if (this.state.contentMinWidth !== width) {\n this.setState({ contentMinWidth: width });\n }\n this.pinTimeout = setTimeout(() => {\n this.pinTimeout = null;\n this.setState({ contentMinWidth: undefined });\n }, 500);\n }\n\n measureWidth = (): void => {\n const width = this.refDiv.current?.clientWidth;\n if (!width) {\n return;\n }\n // Decide with hysteresis whether to collapse the tabs into the burger menu. Switch to the\n // menu once the width drops below MENU_WIDTH, but only switch back to the tab bar once it\n // grows past MENU_WIDTH + MENU_HYSTERESIS. The dead-band in between prevents a scrollbar\n // that appears/disappears on a tab change (shifting the width by ~15px) from toggling the\n // layout back and forth, which is what caused the flickering.\n let useMenu = this.state.useMenu;\n if (!useMenu && width < ConfigTabs.MENU_WIDTH) {\n useMenu = true;\n } else if (useMenu && width > ConfigTabs.MENU_WIDTH + ConfigTabs.MENU_HYSTERESIS) {\n useMenu = false;\n }\n if (useMenu !== this.state.useMenu) {\n this.setState({ useMenu });\n }\n };\n\n onHashTabsChanged = (): void => {\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length > 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n let tab;\n if (tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n if (tab !== undefined && tab !== this.state.tab) {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.pinWidthForTransition();\n this.setState({ tab });\n }\n }\n };\n\n onMenuChange(tab: string): void {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.pinWidthForTransition();\n this.setState({ tab }, () => {\n if (this.props.root) {\n const hash = (window.location.hash || '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n hash[3] = this.state.tab || '';\n window.location.hash = hash.join('/');\n }\n }\n });\n }\n\n updateCalculatedValuesForTable(): void {\n if (this.calculateTimeoutTable) {\n clearTimeout(this.calculateTimeoutTable);\n }\n this.calculateTimeoutTable = setTimeout(async (): Promise<void> => {\n this.calculateTimeoutTable = null;\n const items = this.props.schema.items;\n const calculatedValuesTable: Record<string, { hidden: boolean; disabled: boolean }> = {};\n for (const name in items) {\n let disabled: boolean;\n if (items[name].expertMode && !this.props.expertMode) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n\n if (this.props.custom) {\n const hidden = !!(await this.executeCustom(\n items[name].hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n ));\n if (hidden) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n disabled = !!(await this.executeCustom(\n items[name].disabled,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n ));\n calculatedValuesTable[name] = { hidden, disabled };\n } else {\n const hidden = !!(await this.execute(\n items[name].hidden,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ));\n if (hidden) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n disabled = !!(await this.execute(\n items[name].disabled,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ));\n calculatedValuesTable[name] = { hidden: false, disabled };\n }\n }\n\n if (JSON.stringify(calculatedValuesTable) !== JSON.stringify(this.state.calculatedValuesTable)) {\n this.setState({ calculatedValuesTable });\n }\n }, 50);\n }\n\n render(): JSX.Element | null {\n const items = this.props.schema.items;\n let withIcons = false;\n\n this.updateCalculatedValuesForTable();\n if (!this.state.calculatedValuesTable) {\n return null;\n }\n const elements: { icon: React.JSX.Element | null; label: string; name: string; disabled: boolean }[] = [];\n\n Object.keys(items)\n .filter(name => !this.state.calculatedValuesTable?.[name]?.hidden)\n .map(name => {\n const icon = this.getIcon(items[name].icon);\n withIcons ||= !!icon;\n elements.push({\n icon,\n disabled: !!this.state.calculatedValuesTable?.[name]?.disabled,\n label: this.getText(items[name].label),\n name,\n });\n });\n\n if (!elements.find(item => item.name === this.state.tab)) {\n // Select the first tab if the current tab is not available\n setTimeout(() => this.setState({ tab: elements[0].name }), 50);\n }\n\n let tabs: React.JSX.Element;\n if (this.state.useMenu && elements.length > 2) {\n tabs = (\n <Toolbar\n style={{\n top: 2,\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#222' : '#DDD',\n }}\n variant=\"dense\"\n >\n <IconButton\n onClick={(event: React.MouseEvent<HTMLButtonElement>) =>\n this.setState({ openMenu: event.currentTarget })\n }\n >\n <MenuIcon />\n </IconButton>\n {this.state.openMenu ? (\n <Menu\n open={!0}\n anchorEl={this.state.openMenu}\n onClose={() => this.setState({ openMenu: null })}\n >\n {elements.map(el => {\n const hasErrors = this.hasTabErrors(el.name);\n return (\n <MenuItem\n disabled={el.disabled}\n key={el.name}\n onClick={() => {\n this.setState({ openMenu: null }, () => this.onMenuChange(el.name));\n }}\n selected={el.name === this.state.tab}\n sx={hasErrors ? { color: 'error.main' } : undefined}\n >\n {withIcons ? <ListItemIcon>{el.icon}</ListItemIcon> : null}\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5, width: '100%' }}>\n {el.label}\n {hasErrors && <ErrorIcon sx={{ fontSize: 16, color: 'error.main' }} />}\n </Box>\n </MenuItem>\n );\n })}\n </Menu>\n ) : null}\n </Toolbar>\n );\n } else {\n tabs = (\n <Tabs\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n style={this.props.schema.tabsStyle}\n value={this.state.tab}\n onChange={(_e, tab: string): void => this.onMenuChange(tab)}\n >\n {elements.map(el => {\n const hasErrors = this.hasTabErrors(el.name);\n const label = hasErrors ? (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>\n {el.label}\n <ErrorIcon sx={{ fontSize: 16, color: 'error.main' }} />\n </Box>\n ) : (\n el.label\n );\n\n return (\n <Tab\n id={el.name}\n wrapped\n disabled={el.disabled}\n key={el.name}\n value={el.name}\n iconPosition={this.props.schema.iconPosition || 'start'}\n icon={el.icon || undefined}\n label={label}\n sx={hasErrors ? { '& .MuiTab-wrapper': { color: 'error.main' } } : undefined}\n />\n );\n })}\n </Tabs>\n );\n }\n if (!this.state.tab) {\n return null;\n }\n return (\n <div\n style={\n this.state.contentMinWidth !== undefined\n ? { ...styles.tabs, minWidth: this.state.contentMinWidth }\n : styles.tabs\n }\n ref={this.refDiv}\n >\n {tabs}\n <ConfigPanel\n oContext={this.props.oContext}\n withoutSaveButtons={this.props.withoutSaveButtons}\n isParentTab\n changed={this.props.changed}\n key={this.state.tab}\n expertMode={this.props.expertMode}\n index={1001}\n arrayIndex={this.props.arrayIndex}\n globalData={this.props.globalData}\n commandRunning={this.props.commandRunning}\n style={{\n ...styles.panel,\n ...(withIcons ? styles.panelWithIcons : styles.panelWithoutIcons),\n }}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={this.props.data}\n originalData={this.props.originalData}\n onChange={this.props.onChange}\n onError={this.onTabError}\n customObj={this.props.customObj}\n custom={this.props.custom}\n schema={items[this.state.tab]}\n table={this.props.table}\n withIcons={withIcons}\n customComponents={this.props.customComponents}\n />\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ConfigTabs.js","sourceRoot":"src/","sources":["JsonConfigComponent/ConfigTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG3E,OAAO,aAAmE,MAAM,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,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC;iBACpE,EACD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EACrB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,OAAO,EAAE,IAAI,CAAC,UAAU,EACxB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EACzB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAC/C,CACA,CACT,CAAC;IACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { Tabs, Tab, IconButton, Toolbar, Menu, MenuItem, ListItemIcon, Box } from '@mui/material';\nimport { Menu as MenuIcon, Error as ErrorIcon } from '@mui/icons-material';\n\nimport type { ConfigItemTabs } from '../types';\nimport ConfigGeneric, { type ConfigGenericProps, type ConfigGenericState } from './ConfigGeneric';\nimport ConfigPanel from './ConfigPanel';\n\nconst styles: Record<string, React.CSSProperties> = {\n tabs: {\n height: '100%',\n width: '100%',\n },\n panel: {\n width: '100%',\n display: 'block',\n },\n panelWithIcons: {\n height: 'calc(100% - 72px)',\n },\n panelWithoutIcons: {\n height: 'calc(100% - 48px)',\n },\n};\n\ninterface ConfigTabsProps extends ConfigGenericProps {\n schema: ConfigItemTabs;\n dialogName?: string;\n withoutSaveButtons?: boolean;\n}\n\ninterface ConfigTabsState extends ConfigGenericState {\n tab?: string;\n /** Show the burger menu instead of the tab bar (true only for very narrow widths). Decided with hysteresis. */\n useMenu: boolean;\n openMenu: HTMLButtonElement | null;\n tabErrors: Record<string, Record<string, string>>; // tab -> attr -> error\n calculatedValuesTable: Record<string, { hidden: boolean; disabled: boolean }> | null;\n /**\n * Width (px) reserved on the container while a tab switch is in progress, or undefined when\n * no switch is pending. Prevents the shrink-to-fit dialog from collapsing during the frame\n * where the freshly-mounted panel still renders no content. See pinWidthForTransition().\n */\n contentMinWidth?: number;\n}\n\nexport default class ConfigTabs extends ConfigGeneric<ConfigTabsProps, ConfigTabsState> {\n /** Below this width the tabs collapse into a burger menu */\n private static readonly MENU_WIDTH = 600;\n /**\n * Dead-band around MENU_WIDTH. A scrollbar appearing/disappearing on a tab change shifts\n * clientWidth by ~15px; without this dead-band that would toggle bar<->menu and flicker.\n */\n private static readonly MENU_HYSTERESIS = 40;\n\n private resizeObserver: ResizeObserver | null = null;\n private resizeRaf: number | null = null;\n private calculateTimeoutTable: ReturnType<typeof setTimeout> | null = null;\n private pinTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private readonly refDiv: React.RefObject<HTMLDivElement | null>;\n\n constructor(props: ConfigTabsProps) {\n super(props);\n let tab: string | undefined;\n\n if (this.props.root) {\n // read the path from hash\n // #tab-instances/config/system.adapter.ping.0/<TAB-NAME-OR-INDEX>\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n if (tabS && tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (tabS && Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n\n // install on hash change handler\n window.addEventListener('hashchange', this.onHashTabsChanged, false);\n }\n }\n\n if (tab === undefined) {\n tab =\n (((window as any)._localStorage as Storage) || window.localStorage).getItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n ) || Object.keys(this.props.schema.items)[0];\n if (!Object.keys(this.props.schema.items).includes(tab)) {\n tab = Object.keys(this.props.schema.items)[0];\n }\n }\n this.refDiv = React.createRef();\n\n Object.assign(this.state, { tab, useMenu: false, openMenu: null, tabErrors: {} });\n }\n\n onTabError = (attr?: string, error?: string): void => {\n const currentTab = this.state.tab;\n if (!currentTab && attr) {\n // Forward to parent if no current tab\n this.props.onError(attr, error);\n return;\n }\n\n const newTabErrors = { ...this.state.tabErrors };\n\n if (currentTab) {\n newTabErrors[currentTab] ||= {};\n }\n\n if (currentTab && attr) {\n if (!error) {\n delete newTabErrors[currentTab][attr];\n // Clean up empty tab error objects\n if (Object.keys(newTabErrors[currentTab]).length === 0) {\n delete newTabErrors[currentTab];\n }\n } else {\n newTabErrors[currentTab][attr] = error;\n }\n }\n\n this.setState({ tabErrors: newTabErrors });\n\n // Also forward to parent\n this.props.onError(attr, error);\n };\n\n hasTabErrors = (tabName: string): boolean => {\n return !!this.state.tabErrors[tabName] && Object.keys(this.state.tabErrors[tabName]).length > 0;\n };\n\n async componentDidMount(): Promise<void> {\n await super.componentDidMount();\n // Measure the real width synchronously so the first painted frame already\n // uses the correct breakpoint (no visible tabs -> menu switch).\n this.measureWidth();\n // Keep the width up to date on later layout changes (dialog open animation,\n // async detail loading, window/dialog resize) instead of freezing a\n // transient - possibly too narrow - initial measurement.\n if (this.refDiv.current && typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(() => {\n // Coalesce bursts into a single measurement per frame. This also breaks the\n // ResizeObserver feedback loop: switching bar<->menu changes the layout, which\n // would otherwise notify the observer again immediately and cause flickering.\n if (this.resizeRaf !== null) {\n return;\n }\n this.resizeRaf = window.requestAnimationFrame(() => {\n this.resizeRaf = null;\n this.measureWidth();\n });\n });\n this.resizeObserver.observe(this.refDiv.current);\n }\n }\n\n componentWillUnmount(): void {\n if (this.resizeRaf !== null) {\n window.cancelAnimationFrame(this.resizeRaf);\n this.resizeRaf = null;\n }\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n if (this.calculateTimeoutTable) {\n clearTimeout(this.calculateTimeoutTable);\n this.calculateTimeoutTable = null;\n }\n if (this.pinTimeout) {\n clearTimeout(this.pinTimeout);\n this.pinTimeout = null;\n }\n window.removeEventListener('hashchange', this.onHashTabsChanged, false);\n super.componentWillUnmount();\n }\n\n /**\n * Freeze the current container width for the duration of a tab switch. Switching tabs remounts\n * the panel (key={tab}), and a freshly-mounted ConfigPanel renders `null` for a frame or two\n * while it computes its calculated values. In that gap the widest content is just the tab bar,\n * so the shrink-to-fit dialog collapses and then grows back - the visible width \"jump\".\n *\n * We capture the width shown by the outgoing tab and apply it as a temporary minWidth floor, then\n * release it shortly after so genuine resizes (window/dialog) keep working normally afterwards.\n */\n private pinWidthForTransition(): void {\n const width = this.refDiv.current?.clientWidth;\n if (!width) {\n return;\n }\n if (this.pinTimeout) {\n clearTimeout(this.pinTimeout);\n }\n if (this.state.contentMinWidth !== width) {\n this.setState({ contentMinWidth: width });\n }\n this.pinTimeout = setTimeout(() => {\n this.pinTimeout = null;\n this.setState({ contentMinWidth: undefined });\n }, 500);\n }\n\n measureWidth = (): void => {\n const width = this.refDiv.current?.clientWidth;\n if (!width) {\n return;\n }\n // Decide with hysteresis whether to collapse the tabs into the burger menu. Switch to the\n // menu once the width drops below MENU_WIDTH, but only switch back to the tab bar once it\n // grows past MENU_WIDTH + MENU_HYSTERESIS. The dead-band in between prevents a scrollbar\n // that appears/disappears on a tab change (shifting the width by ~15px) from toggling the\n // layout back and forth, which is what caused the flickering.\n let useMenu = this.state.useMenu;\n if (!useMenu && width < ConfigTabs.MENU_WIDTH) {\n useMenu = true;\n } else if (useMenu && width > ConfigTabs.MENU_WIDTH + ConfigTabs.MENU_HYSTERESIS) {\n useMenu = false;\n }\n if (useMenu !== this.state.useMenu) {\n this.setState({ useMenu });\n }\n };\n\n onHashTabsChanged = (): void => {\n const hash = (window.location.hash || '').replace(/^#/, '').split('/');\n if (hash.length > 3 && hash[1] === 'config') {\n const tabS = hash[3];\n const tabN = parseInt(tabS, 10);\n let tab;\n if (tabN.toString() === tabS) {\n if (tabN >= 0 && tabN < Object.keys(this.props.schema.items).length) {\n tab = Object.keys(this.props.schema.items)[tabN];\n }\n } else if (Object.keys(this.props.schema.items).includes(tabS)) {\n tab = tabS;\n }\n if (tab !== undefined && tab !== this.state.tab) {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.pinWidthForTransition();\n this.setState({ tab });\n }\n }\n };\n\n onMenuChange(tab: string): void {\n (((window as any)._localStorage as Storage) || window.localStorage).setItem(\n `${this.props.dialogName || 'App'}.${this.props.oContext.adapterName}`,\n tab,\n );\n this.pinWidthForTransition();\n this.setState({ tab }, () => {\n if (this.props.root) {\n const hash = (window.location.hash || '').split('/');\n if (hash.length >= 3 && hash[1] === 'config') {\n hash[3] = this.state.tab || '';\n window.location.hash = hash.join('/');\n }\n }\n });\n }\n\n updateCalculatedValuesForTable(): void {\n if (this.calculateTimeoutTable) {\n clearTimeout(this.calculateTimeoutTable);\n }\n this.calculateTimeoutTable = setTimeout(async (): Promise<void> => {\n this.calculateTimeoutTable = null;\n const items = this.props.schema.items;\n const calculatedValuesTable: Record<string, { hidden: boolean; disabled: boolean }> = {};\n for (const name in items) {\n let disabled: boolean;\n if (items[name].expertMode && !this.props.expertMode) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n\n // Do not show the tab if it is not intended for the host, where the instance runs\n if (!ConfigGeneric.isHostAllowed(items[name], this.props.oContext.hostInfo)) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n\n if (this.props.custom) {\n const hidden = !!(await this.executeCustom(\n items[name].hidden,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n ));\n if (hidden) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n disabled = !!(await this.executeCustom(\n items[name].disabled,\n this.props.data,\n this.props.customObj,\n this.props.oContext.instanceObj,\n this.props.index,\n this.props.globalData,\n ));\n calculatedValuesTable[name] = { hidden, disabled };\n } else {\n const hidden = !!(await this.execute(\n items[name].hidden,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ));\n if (hidden) {\n calculatedValuesTable[name] = { hidden: true, disabled: false };\n continue;\n }\n disabled = !!(await this.execute(\n items[name].disabled,\n false,\n this.props.data,\n this.props.index,\n this.props.globalData,\n ));\n calculatedValuesTable[name] = { hidden: false, disabled };\n }\n }\n\n if (JSON.stringify(calculatedValuesTable) !== JSON.stringify(this.state.calculatedValuesTable)) {\n this.setState({ calculatedValuesTable });\n }\n }, 50);\n }\n\n render(): JSX.Element | null {\n const items = this.props.schema.items;\n let withIcons = false;\n\n this.updateCalculatedValuesForTable();\n if (!this.state.calculatedValuesTable) {\n return null;\n }\n const elements: { icon: React.JSX.Element | null; label: string; name: string; disabled: boolean }[] = [];\n\n Object.keys(items)\n .filter(name => !this.state.calculatedValuesTable?.[name]?.hidden)\n .map(name => {\n const icon = this.getIcon(items[name].icon);\n withIcons ||= !!icon;\n elements.push({\n icon,\n disabled: !!this.state.calculatedValuesTable?.[name]?.disabled,\n label: this.getText(items[name].label),\n name,\n });\n });\n\n if (!elements.find(item => item.name === this.state.tab)) {\n // Select the first tab if the current tab is not available\n setTimeout(() => this.setState({ tab: elements[0].name }), 50);\n }\n\n let tabs: React.JSX.Element;\n if (this.state.useMenu && elements.length > 2) {\n tabs = (\n <Toolbar\n style={{\n top: 2,\n backgroundColor: this.props.oContext.themeType === 'dark' ? '#222' : '#DDD',\n }}\n variant=\"dense\"\n >\n <IconButton\n onClick={(event: React.MouseEvent<HTMLButtonElement>) =>\n this.setState({ openMenu: event.currentTarget })\n }\n >\n <MenuIcon />\n </IconButton>\n {this.state.openMenu ? (\n <Menu\n open={!0}\n anchorEl={this.state.openMenu}\n onClose={() => this.setState({ openMenu: null })}\n >\n {elements.map(el => {\n const hasErrors = this.hasTabErrors(el.name);\n return (\n <MenuItem\n disabled={el.disabled}\n key={el.name}\n onClick={() => {\n this.setState({ openMenu: null }, () => this.onMenuChange(el.name));\n }}\n selected={el.name === this.state.tab}\n sx={hasErrors ? { color: 'error.main' } : undefined}\n >\n {withIcons ? <ListItemIcon>{el.icon}</ListItemIcon> : null}\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5, width: '100%' }}>\n {el.label}\n {hasErrors && <ErrorIcon sx={{ fontSize: 16, color: 'error.main' }} />}\n </Box>\n </MenuItem>\n );\n })}\n </Menu>\n ) : null}\n </Toolbar>\n );\n } else {\n tabs = (\n <Tabs\n variant=\"scrollable\"\n scrollButtons=\"auto\"\n style={this.props.schema.tabsStyle}\n value={this.state.tab}\n onChange={(_e, tab: string): void => this.onMenuChange(tab)}\n >\n {elements.map(el => {\n const hasErrors = this.hasTabErrors(el.name);\n const label = hasErrors ? (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>\n {el.label}\n <ErrorIcon sx={{ fontSize: 16, color: 'error.main' }} />\n </Box>\n ) : (\n el.label\n );\n\n return (\n <Tab\n id={el.name}\n wrapped\n disabled={el.disabled}\n key={el.name}\n value={el.name}\n iconPosition={this.props.schema.iconPosition || 'start'}\n icon={el.icon || undefined}\n label={label}\n sx={hasErrors ? { '& .MuiTab-wrapper': { color: 'error.main' } } : undefined}\n />\n );\n })}\n </Tabs>\n );\n }\n if (!this.state.tab) {\n return null;\n }\n return (\n <div\n style={\n this.state.contentMinWidth !== undefined\n ? { ...styles.tabs, minWidth: this.state.contentMinWidth }\n : styles.tabs\n }\n ref={this.refDiv}\n >\n {tabs}\n <ConfigPanel\n oContext={this.props.oContext}\n withoutSaveButtons={this.props.withoutSaveButtons}\n isParentTab\n changed={this.props.changed}\n key={this.state.tab}\n expertMode={this.props.expertMode}\n index={1001}\n arrayIndex={this.props.arrayIndex}\n globalData={this.props.globalData}\n commandRunning={this.props.commandRunning}\n style={{\n ...styles.panel,\n ...(withIcons ? styles.panelWithIcons : styles.panelWithoutIcons),\n }}\n common={this.props.common}\n alive={this.props.alive}\n themeName={this.props.themeName}\n data={this.props.data}\n originalData={this.props.originalData}\n onChange={this.props.onChange}\n onError={this.onTabError}\n customObj={this.props.customObj}\n custom={this.props.custom}\n schema={items[this.state.tab]}\n table={this.props.table}\n withIcons={withIcons}\n customComponents={this.props.customComponents}\n />\n </div>\n );\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import React, { Component, type JSX } from 'react';
2
2
  import { type AdminConnection, type ThemeName, type ThemeType, type IobTheme } from '@iobroker/gui-components';
3
- import type { BackEndCommand, ConfigItemPanel, ConfigItemTabs } from '../types';
3
+ import type { BackEndCommand, ConfigItemPanel, ConfigItemTabs, JsonConfigHostInfo } from '../types';
4
4
  import type ConfigGeneric from './ConfigGeneric';
5
5
  import { type DeviceManagerPropsProps, type ConfigGenericProps } from './ConfigGeneric';
6
6
  interface JsonConfigComponentProps {
@@ -42,6 +42,7 @@ interface JsonConfigComponentState {
42
42
  changed: boolean;
43
43
  errors: Record<string, string>;
44
44
  systemConfig: ioBroker.SystemConfigCommon | null;
45
+ hostInfo: JsonConfigHostInfo | null;
45
46
  updateData?: number;
46
47
  alive: boolean;
47
48
  commandRunning: boolean;
@@ -58,6 +59,29 @@ export declare class JsonConfigComponent extends Component<JsonConfigComponentPr
58
59
  static loadI18n(socket: AdminConnection, i18n: boolean | string | Record<string, Record<ioBroker.Languages, string>> | undefined, adapterName: string): Promise<string>;
59
60
  onCommandRunning: (commandRunning: boolean) => void;
60
61
  readData(): Promise<void>;
62
+ /**
63
+ * Read the information about the host, on which the configured instance runs.
64
+ *
65
+ * The object `system.host.X` is used and not the message `getHostInfo`, because the object can be read
66
+ * even if the host is not running. The result is used for the `os`/`notOs` attributes and for the
67
+ * `_os`, `_arch` and `_host` variables in the JS functions.
68
+ *
69
+ * Only the docker state cannot be read from the object, so it will be requested from the running host,
70
+ * but only if the configuration really uses it.
71
+ *
72
+ * @returns information about the host. The properties are empty if the host could not be read
73
+ */
74
+ readHostInfo(): Promise<JsonConfigHostInfo>;
75
+ /**
76
+ * Check if the configuration uses the docker state of the host.
77
+ *
78
+ * The docker state can only be requested from a running host, so this request will only be done if
79
+ * the `docker` attribute or the `_host.docker` variable is really used in the configuration.
80
+ *
81
+ * @param schema the configuration schema
82
+ * @returns true if the docker state must be read
83
+ */
84
+ static usesDocker(schema: ConfigItemTabs | ConfigItemPanel): boolean;
61
85
  onAlive: (_id: string, state?: ioBroker.State | null) => void;
62
86
  onChange: (attrOrData: string | Record<string, any> | undefined, value: any, cb?: () => void, saveConfig?: boolean) => void;
63
87
  onError: (attr?: string, error?: string) => void;
@@ -31,6 +31,8 @@ I18n.extendTranslations({
31
31
  uk,
32
32
  'zh-cn': zhCn,
33
33
  });
34
+ /** Timeout for the request of the docker information from the host */
35
+ const DOCKER_INFO_TIMEOUT_MS = 3_000;
34
36
  const styles = {
35
37
  root: {
36
38
  width: '100%',
@@ -51,6 +53,7 @@ export class JsonConfigComponent extends Component {
51
53
  errors: {},
52
54
  updateData: this.props.updateData || 0,
53
55
  systemConfig: null,
56
+ hostInfo: null,
54
57
  alive: false,
55
58
  commandRunning: false,
56
59
  schema: JSON.parse(JSON.stringify(this.props.schema)),
@@ -140,6 +143,7 @@ export class JsonConfigComponent extends Component {
140
143
  const state = await this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`);
141
144
  this.setState({
142
145
  systemConfig: systemConfig?.common || {},
146
+ hostInfo: await this.readHostInfo(),
143
147
  alive: !!state?.val,
144
148
  }, () => {
145
149
  this.updateContext(true);
@@ -152,6 +156,67 @@ export class JsonConfigComponent extends Component {
152
156
  console.error(`Cannot read system config: ${error}`);
153
157
  }
154
158
  }
159
+ /**
160
+ * Read the information about the host, on which the configured instance runs.
161
+ *
162
+ * The object `system.host.X` is used and not the message `getHostInfo`, because the object can be read
163
+ * even if the host is not running. The result is used for the `os`/`notOs` attributes and for the
164
+ * `_os`, `_arch` and `_host` variables in the JS functions.
165
+ *
166
+ * Only the docker state cannot be read from the object, so it will be requested from the running host,
167
+ * but only if the configuration really uses it.
168
+ *
169
+ * @returns information about the host. The properties are empty if the host could not be read
170
+ */
171
+ async readHostInfo() {
172
+ const hostName = this.props.common?.host || this.props.instanceObj?.common?.host;
173
+ const hostObj = hostName
174
+ ? (await this.getCachedObject(`system.host.${hostName}`))
175
+ : null;
176
+ const hostInfo = {
177
+ id: hostName || '',
178
+ os: hostObj?.native?.os?.platform || '',
179
+ osType: hostObj?.native?.os?.type || '',
180
+ arch: hostObj?.native?.os?.arch || '',
181
+ release: hostObj?.native?.os?.release || '',
182
+ nodeVersion: hostObj?.native?.process?.versions?.node || '',
183
+ controllerVersion: hostObj?.common?.installedVersion || '',
184
+ };
185
+ if (hostName && JsonConfigComponent.usesDocker(this.props.schema)) {
186
+ try {
187
+ // If the host is not running, the request would only run into the timeout
188
+ const aliveState = await this.props.socket.getState(`system.host.${hostName}.alive`);
189
+ if (aliveState?.val !== false) {
190
+ const info = await this.props.socket.getHostInfoShort(hostName, false, DOCKER_INFO_TIMEOUT_MS);
191
+ if (info) {
192
+ // Older js-controllers do not deliver `dockerInformation`, but `Platform` is 'docker' then
193
+ hostInfo.docker = info.dockerInformation?.isDocker ?? info.Platform === 'docker';
194
+ if (info.dockerInformation?.isOfficial) {
195
+ hostInfo.dockerVersion = info.dockerInformation.officialVersion;
196
+ }
197
+ }
198
+ }
199
+ }
200
+ catch (e) {
201
+ // The host does not answer or the user has no rights => the docker state stays unknown
202
+ console.warn(`Cannot read the docker information of ${hostName}: ${e}`);
203
+ }
204
+ }
205
+ return hostInfo;
206
+ }
207
+ /**
208
+ * Check if the configuration uses the docker state of the host.
209
+ *
210
+ * The docker state can only be requested from a running host, so this request will only be done if
211
+ * the `docker` attribute or the `_host.docker` variable is really used in the configuration.
212
+ *
213
+ * @param schema the configuration schema
214
+ * @returns true if the docker state must be read
215
+ */
216
+ static usesDocker(schema) {
217
+ const str = JSON.stringify(schema);
218
+ return str.includes('"docker":') || str.includes('_host.docker');
219
+ }
155
220
  onAlive = (_id, state) => {
156
221
  if (!!state?.val !== this.state.alive) {
157
222
  this.setState({ alive: !!state?.val });
@@ -334,6 +399,7 @@ export class JsonConfigComponent extends Component {
334
399
  _themeName: this.props.themeName,
335
400
  updateData: this.state.updateData,
336
401
  getCachedObject: this.getCachedObject,
402
+ hostInfo: this.state.hostInfo || undefined,
337
403
  };
338
404
  if (forceUpdate) {
339
405
  this.forceUpdate();
@@ -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,0BAA0B,CAAC;AAKrH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,IAAI,MAAM,mBAAmB,CAAC;AAErC,+FAA+F;AAC/F,iGAAiG;AACjG,gG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qB,GAAG,CAAC,IAAY,EAAE,EAAiC,EAAQ,EAAE;QAC9E,IAAI,EAAE,EAAE,CAAC;YACL,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACxC,CAAC;aAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC,CAAC;IAEF,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,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/gui-components';\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\nimport de from './i18n/de.json';\nimport en from './i18n/en.json';\nimport ru from './i18n/ru.json';\nimport pt from './i18n/pt.json';\nimport nl from './i18n/nl.json';\nimport fr from './i18n/fr.json';\nimport it from './i18n/it.json';\nimport es from './i18n/es.json';\nimport pl from './i18n/pl.json';\nimport uk from './i18n/uk.json';\nimport zhCn from './i18n/zh-cn.json';\n\n// Register the `jc_*` translations when this module is loaded, NOT when the component is first\n// constructed. `JsonConfig` renders its own toolbar (the export/import buttons) before it mounts\n// `JsonConfigComponent` as a child, so a constructor-based registration came too late and those\n// labels rendered as raw keys such as `jc_Import settings from JSON file`.\nI18n.extendTranslations({\n en,\n de,\n ru,\n pt,\n nl,\n fr,\n it,\n es,\n pl,\n uk,\n 'zh-cn': zhCn,\n});\n\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> | null, changed: boolean | undefined, 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 private errorTimeout: ReturnType<typeof setTimeout> | null = null;\n private errorCached: Record<string, string> | null = null;\n private oContext: JsonConfigContext | undefined;\n private cachedObjects: Record<string, ioBroker.Object | null> = {};\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>> | undefined,\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.getCachedObject('system.config')) || undefined) as\n ioBroker.SystemConfigObject | undefined;\n }\n const state = await this.props.socket.getState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n );\n this.setState(\n {\n systemConfig: systemConfig?.common || ({} as ioBroker.SystemConfigCommon),\n alive: !!state?.val,\n },\n () => {\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 );\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 = (\n attrOrData: string | Record<string, any> | undefined,\n value: any,\n cb?: () => void,\n saveConfig?: boolean,\n ): void => {\n if (this.props.onValueChange) {\n this.props.onValueChange(attrOrData as string, value, !!saveConfig);\n cb?.();\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 cb?.();\n });\n } else if (saveConfig) {\n this.props.onChange?.(null, undefined, 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 (errors && attr) {\n if (error) {\n errors[attr] = error;\n } else {\n delete errors[attr];\n }\n }\n\n if (this.errorTimeout) {\n clearTimeout(this.errorTimeout);\n this.errorTimeout = null;\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 getCachedObject = async (id: string): Promise<ioBroker.Object | null> => {\n if (this.cachedObjects[id] !== undefined) {\n return this.cachedObjects[id];\n }\n try {\n this.cachedObjects[id] = (await this.props.socket.getObject(id)) ?? null;\n } catch (e) {\n console.error(e);\n this.cachedObjects[id] = null;\n }\n return this.cachedObjects[id];\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 getCachedObject: this.getCachedObject,\n } as JsonConfigContext;\n\n if (forceUpdate) {\n this.forceUpdate();\n }\n }\n\n renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (!this.oContext) {\n return null;\n }\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,0BAA0B,CAAC;AAKrH,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,IAAI,MAAM,mBAAmB,CAAC;AAErC,+FAA+F;AAC/F,iGAAiG;AACjG,gGAAgG;AAChG,2EAA2E;AAC3E,IAAI,CAAC,kBAAkB,CAAC;IACpB,EAAE;IACF,EAAE;IACF,EAAE;IACF,EA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KAAK,CAAC,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/gui-components';\n\nimport type { BackEndCommand, ConfigItemPanel, ConfigItemTabs, JsonConfigContext, JsonConfigHostInfo } from '../types';\nimport type ConfigGeneric from './ConfigGeneric';\nimport { type DeviceManagerPropsProps, type ConfigGenericProps } from './ConfigGeneric';\nimport ConfigTabs from './ConfigTabs';\nimport ConfigPanel from './ConfigPanel';\n\nimport de from './i18n/de.json';\nimport en from './i18n/en.json';\nimport ru from './i18n/ru.json';\nimport pt from './i18n/pt.json';\nimport nl from './i18n/nl.json';\nimport fr from './i18n/fr.json';\nimport it from './i18n/it.json';\nimport es from './i18n/es.json';\nimport pl from './i18n/pl.json';\nimport uk from './i18n/uk.json';\nimport zhCn from './i18n/zh-cn.json';\n\n// Register the `jc_*` translations when this module is loaded, NOT when the component is first\n// constructed. `JsonConfig` renders its own toolbar (the export/import buttons) before it mounts\n// `JsonConfigComponent` as a child, so a constructor-based registration came too late and those\n// labels rendered as raw keys such as `jc_Import settings from JSON file`.\nI18n.extendTranslations({\n en,\n de,\n ru,\n pt,\n nl,\n fr,\n it,\n es,\n pl,\n uk,\n 'zh-cn': zhCn,\n});\n\n/** Timeout for the request of the docker information from the host */\nconst DOCKER_INFO_TIMEOUT_MS = 3_000;\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> | null, changed: boolean | undefined, 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 hostInfo: JsonConfigHostInfo | 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 private errorTimeout: ReturnType<typeof setTimeout> | null = null;\n private errorCached: Record<string, string> | null = null;\n private oContext: JsonConfigContext | undefined;\n private cachedObjects: Record<string, ioBroker.Object | null> = {};\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 hostInfo: 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>> | undefined,\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.getCachedObject('system.config')) || undefined) as\n ioBroker.SystemConfigObject | undefined;\n }\n const state = await this.props.socket.getState(\n `system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,\n );\n this.setState(\n {\n systemConfig: systemConfig?.common || ({} as ioBroker.SystemConfigCommon),\n hostInfo: await this.readHostInfo(),\n alive: !!state?.val,\n },\n () => {\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 );\n } catch (error) {\n console.error(`Cannot read system config: ${error}`);\n }\n }\n\n /**\n * Read the information about the host, on which the configured instance runs.\n *\n * The object `system.host.X` is used and not the message `getHostInfo`, because the object can be read\n * even if the host is not running. The result is used for the `os`/`notOs` attributes and for the\n * `_os`, `_arch` and `_host` variables in the JS functions.\n *\n * Only the docker state cannot be read from the object, so it will be requested from the running host,\n * but only if the configuration really uses it.\n *\n * @returns information about the host. The properties are empty if the host could not be read\n */\n async readHostInfo(): Promise<JsonConfigHostInfo> {\n const hostName: string | undefined =\n (this.props.common?.host as string | undefined) || this.props.instanceObj?.common?.host;\n\n const hostObj = hostName\n ? ((await this.getCachedObject(`system.host.${hostName}`)) as ioBroker.HostObject | null)\n : null;\n\n const hostInfo: JsonConfigHostInfo = {\n id: hostName || '',\n os: hostObj?.native?.os?.platform || '',\n osType: hostObj?.native?.os?.type || '',\n arch: hostObj?.native?.os?.arch || '',\n release: hostObj?.native?.os?.release || '',\n nodeVersion: hostObj?.native?.process?.versions?.node || '',\n controllerVersion: hostObj?.common?.installedVersion || '',\n };\n\n if (hostName && JsonConfigComponent.usesDocker(this.props.schema)) {\n try {\n // If the host is not running, the request would only run into the timeout\n const aliveState = await this.props.socket.getState(`system.host.${hostName}.alive`);\n if (aliveState?.val !== false) {\n const info = await this.props.socket.getHostInfoShort(hostName, false, DOCKER_INFO_TIMEOUT_MS);\n if (info) {\n // Older js-controllers do not deliver `dockerInformation`, but `Platform` is 'docker' then\n hostInfo.docker = info.dockerInformation?.isDocker ?? info.Platform === 'docker';\n if (info.dockerInformation?.isOfficial) {\n hostInfo.dockerVersion = info.dockerInformation.officialVersion;\n }\n }\n }\n } catch (e) {\n // The host does not answer or the user has no rights => the docker state stays unknown\n console.warn(`Cannot read the docker information of ${hostName}: ${e as Error}`);\n }\n }\n\n return hostInfo;\n }\n\n /**\n * Check if the configuration uses the docker state of the host.\n *\n * The docker state can only be requested from a running host, so this request will only be done if\n * the `docker` attribute or the `_host.docker` variable is really used in the configuration.\n *\n * @param schema the configuration schema\n * @returns true if the docker state must be read\n */\n static usesDocker(schema: ConfigItemTabs | ConfigItemPanel): boolean {\n const str = JSON.stringify(schema);\n return str.includes('\"docker\":') || str.includes('_host.docker');\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 = (\n attrOrData: string | Record<string, any> | undefined,\n value: any,\n cb?: () => void,\n saveConfig?: boolean,\n ): void => {\n if (this.props.onValueChange) {\n this.props.onValueChange(attrOrData as string, value, !!saveConfig);\n cb?.();\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 cb?.();\n });\n } else if (saveConfig) {\n this.props.onChange?.(null, undefined, 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 (errors && attr) {\n if (error) {\n errors[attr] = error;\n } else {\n delete errors[attr];\n }\n }\n\n if (this.errorTimeout) {\n clearTimeout(this.errorTimeout);\n this.errorTimeout = null;\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 getCachedObject = async (id: string): Promise<ioBroker.Object | null> => {\n if (this.cachedObjects[id] !== undefined) {\n return this.cachedObjects[id];\n }\n try {\n this.cachedObjects[id] = (await this.props.socket.getObject(id)) ?? null;\n } catch (e) {\n console.error(e);\n this.cachedObjects[id] = null;\n }\n return this.cachedObjects[id];\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 getCachedObject: this.getCachedObject,\n hostInfo: this.state.hostInfo || undefined,\n } as JsonConfigContext;\n\n if (forceUpdate) {\n this.forceUpdate();\n }\n }\n\n renderItem(item: ConfigItemTabs | ConfigItemPanel): JSX.Element | null {\n if (!this.oContext) {\n return null;\n }\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"]}