Skip to content

armgit / core

Public Imported from GitHub
0

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

some renaming and add config for selected headers

Vincentbab2b1e0f6e4
diff --git a/ui/component/or-asset-viewer/src/components/or-attributes-modal.ts b/ui/component/or-asset-viewer/src/components/or-attributes-modal.ts
index 0d49c653c..7c8556e7e 100644
--- a/ui/component/or-asset-viewer/src/components/or-attributes-modal.ts
+++ b/ui/component/or-asset-viewer/src/components/or-attributes-modal.ts
@@ -24,6 +24,8 @@ const style = css`
@customElement("or-attributes-modal")
export class OrAttributesModal extends LitElement {
+ @property({type: Object})
+ public selectedAttributes: any;
@query("#mdc-dialog-add-remove-attributes")
protected _dialogElem!: HTMLElement;
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 24e849665..f8cf3d76d 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -184,7 +184,6 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
protected _viewerConfig?: AssetViewerConfig;
protected _attributes?: AssetAttribute[];
-
constructor() {
super();
window.addEventListener('resize', () => OrAssetViewer.generateGrid(this.shadowRoot));
@@ -529,14 +528,19 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
}
};
- const renderTable = OrAssetViewer.getAssetChildren(asset.id!, asset.attributes!.childAssetType.value)
+ const renderTable = this.getAssetChildren(asset.id!, asset.attributes!.childAssetType.value)
.then((assetChildren: Asset[]) => {
if (assetChildren && assetChildren.length > 0) {
- const headers = Object.getOwnPropertyNames(assetChildren[0].attributes);
+ const columnHeaders = Object.getOwnPropertyNames(assetChildren[0].attributes);
+ const selectedHeaders = columnHeaders.map((header) => {
+ return {
+ header: true
+ };
+ });
// turn children into a format of data that or-table wants
const rows = assetChildren.map((row: Asset) => {
- return headers.map((header: string) => {
+ return columnHeaders.map((header: string) => {
return row.attributes![header].value;
});
});