Skip to content

Commit

Permalink
Update packages (#254)
Browse files Browse the repository at this point in the history
Rename some variables
Remove double "info" object
  • Loading branch information
GermanBluefox authored Dec 27, 2024
1 parent 02a5a20 commit 489299e
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 133 deletions.
8 changes: 0 additions & 8 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,6 @@
},
"native": {}
},
{
"_id": "info",
"type": "channel",
"common": {
"name": "Information"
},
"native": {}
},
{
"_id": "info.welcomeDialog",
"type": "state",
Expand Down
204 changes: 102 additions & 102 deletions src-admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"dependencies": {
"@foxriver76/iob-component-lib": "^0.2.0",
"@iobroker/adapter-react-v5": "^7.4.7",
"@iobroker/dm-gui-components": "~7.4.7",
"@iobroker/adapter-react-v5": "^7.4.8",
"@iobroker/dm-gui-components": "~7.4.8",
"@iobroker/type-detector": "^4.1.1",
"@types/react-dom": "^18.3.5",
"@types/uuid": "^10.0.0",
Expand Down Expand Up @@ -51,4 +51,4 @@
}
]
]
}
}
40 changes: 20 additions & 20 deletions src/lib/JsonConfigUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,76 +18,76 @@ export function convertDataToJsonConfig(data: StructuredJsonFormData): JsonFormS
const items: Record<string, ConfigItemPanel> = {};

let panelCount = 0;
for (const key in data) {
for (const tab in data) {
panelCount++;
const tabItems: Record<string, ConfigItemAny> = {};

for (const subKey in data[key]) {
const flatKey = `${key}_${subKey}`;
if (subKey.startsWith('__header__')) {
for (const tabItem in data[tab]) {
const flatKey = `${tab}_${tabItem}`;
if (tabItem.startsWith('__header__')) {
tabItems[flatKey] = {
type: 'header',
text: String(data[key][subKey]),
text: String(data[tab][tabItem]),
noTranslation: true,
};
continue;
}
if (subKey.startsWith('__text__')) {
if (tabItem.startsWith('__text__')) {
tabItems[flatKey] = {
type: 'staticText',
text: String(data[key][subKey]),
text: String(data[tab][tabItem]),
};
continue;
}
if (subKey.startsWith('__smalltext__')) {
if (tabItem.startsWith('__smalltext__')) {
tabItems[flatKey] = {
type: 'staticText',
text: String(data[key][subKey]),
text: String(data[tab][tabItem]),
style: { fontSize: 10, fontStyle: 'italic', marginTop: -8 },
};
continue;
}
if (subKey.startsWith('__divider__')) {
if (tabItem.startsWith('__divider__')) {
tabItems[flatKey] = {
type: 'divider',
};
continue;
}
if (subKey.startsWith('__iobstate__')) {
if (data[key][subKey] && typeof data[key][subKey] === 'object') {
if (tabItem.startsWith('__iobstate__')) {
if (data[tab][tabItem] && typeof data[tab][tabItem] === 'object') {
tabItems[flatKey] = {
type: 'state',
foreign: true,
label: subKey.substring(12),
label: tabItem.substring(12),
addColon: true,
controlDelay: 500,
oid: '', // oid will be overwritten by data[key][subKey]
...data[key][subKey],
...data[tab][tabItem],
};
}
continue;
}

if (data[key][subKey] === undefined) {
if (data[tab][tabItem] === undefined) {
continue;
}

const subKeyShortenerIndex = subKey.indexOf('__');
const subKeyShortenerIndex = tabItem.indexOf('__');
const subKeyLabel = decamelize(
subKeyShortenerIndex !== -1 ? subKey.substring(subKeyShortenerIndex + 2) : subKey,
subKeyShortenerIndex !== -1 ? tabItem.substring(subKeyShortenerIndex + 2) : tabItem,
);
tabItems[flatKey] = {
type: 'staticInfo',
label: subKeyLabel,
newLine: true,
noTranslation: true,
data: data[key][subKey] as number | string | boolean,
data: data[tab][tabItem] as number | string | boolean,
};
}

items[`_tab_${key}`] = {
items[`_tab_${tab}`] = {
type: 'panel',
label: decamelize(key),
label: decamelize(tab),
noTranslation: true,
items: tabItems,
style: {
Expand Down

0 comments on commit 489299e

Please sign in to comment.