Skip to content

armgit / core

Public Imported from GitHub
0

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

UI update: or-asset-viewer check selected attribute in attribute picker on callback (#682)

Jérôme Vervier11187f795511
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index cbe982e63..cddfd7b1c 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -571,8 +571,15 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [
const label = Util.getAttributeLabel(attr, descriptors[0], asset.type, true);
return [attr.name, label];
});
- const attrName: string = historyAttrs[0].name!;
- onRenderComplete.addCallback(() => attributeChanged(attrName));
+ let attrName: string = historyAttrs[0].name!;
+ onRenderComplete.addCallback(() => {
+ if (hostElement.shadowRoot) {
+ const historyAttributePicker = hostElement.shadowRoot.getElementById("history-attribute-picker") as OrMwcInput;
+
+ attrName = historyAttributePicker.value;
+ }
+ attributeChanged(attrName);
+ });
return html`
<style>
or-attribute-history{