Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI updates: Bug fix for json-forms rendering

Rich Turner25390052b3ea
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index e1ad93bc4..e541fd710 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -635,12 +635,12 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [
availableAttributes = groupConfig.childAssetTypes[childAssetType].availableAttributes ? groupConfig.childAssetTypes[childAssetType].availableAttributes! : [];
selectedAttributes = groupConfig.childAssetTypes[childAssetType].selectedAttributes ? groupConfig.childAssetTypes[childAssetType].selectedAttributes! : [];
}
- const configStr = window.localStorage.getItem('OrAssetConfig')
+ const config: any = manager.console.retrieveData("OrAssetConfig");
const viewSelector = asset.id ? asset.id : window.location.hash;
- if(configStr) {
- const config = JSON.parse(configStr);
+
+ if (config) {
const view = config.views[viewSelector];
- if(view) {
+ if (view) {
selectedAttributes = [...view]
}
}
@@ -718,11 +718,10 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [
return arr;
});
- let config;
- const configStr = window.localStorage.getItem('OrAssetConfig')
- if(configStr) {
- config = JSON.parse(configStr);
- if(asset.id) {
+ let config: any = manager.console.retrieveData("OrAssetConfig");
+
+ if (config) {
+ if (asset.id) {
config.views[asset.id] = selectedAttributes;
}
} else {
@@ -732,16 +731,8 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [
}
}
}
-
-
- const message = {
- provider: "STORAGE",
- action: "STORE",
- key: "OrAssetConfig",
- value: JSON.stringify(config)
-
- }
- manager.console._doSendProviderMessage(message)
+
+ manager.console.storeData("OrAssetConfig", config);
window.setTimeout(() => OrAssetViewer.generateGrid(hostElement.shadowRoot), 0);
};
diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.ts
index 9d828685d..ea16662be 100644
--- a/ui/component/or-attribute-input/src/index.ts
+++ b/ui/component/or-attribute-input/src/index.ts
@@ -123,7 +123,6 @@ export const jsonFormsInputTemplateProvider: (fallback: ValueInputProvider) => V
const label = options.label;
// Agent link needs some special handling as we need an agent picker no matter what
- return fallback;
if (valueDescriptor.name === WellknownValueTypes.AGENTLINK) {
// Apply a custom UI schema to remove the outer VerticalLayout
diff --git a/ui/component/or-json-forms/src/index.ts b/ui/component/or-json-forms/src/index.ts
index bc492847e..cd658f6f3 100644
--- a/ui/component/or-json-forms/src/index.ts
+++ b/ui/component/or-json-forms/src/index.ts
@@ -174,7 +174,6 @@ export class OrJSONForms extends LitElement implements OwnPropsOfJsonFormsRender
}
render() {
-
if (!this.contextValue) {
return html``;
}
diff --git a/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts b/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts
index acc10f9cc..0b848718e 100644
--- a/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts
+++ b/ui/component/or-json-forms/src/layouts/layout-vertical-element.ts
@@ -143,11 +143,6 @@ export class LayoutVerticalElement extends LayoutBaseElement<VerticalLayout | Gr
} else if (this.getChildProps().length > 0) {
contentTemplate = this.getChildProps().map((childProps: OwnPropsOfRenderer & AdditionalProps) => {
- if (childProps.schema) {
- // Make root schema definitions available to this schema
- childProps.schema.definitions = rootSchema.definitions;
- }
-
if (isControl(childProps.uischema)) {
const controlProps = childProps as OwnPropsOfControl;