100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
create get asset children helper function and extract information about children of group
Vincent22b3bd51eb4a
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex 0aa3982f9..a5de77f76 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -310,6 +310,13 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem}public static getPanel(name: string, asset: Asset, attributes: AssetAttribute[], viewerConfig: AssetViewerConfig, panelConfig: PanelConfig, shadowRoot: ShadowRoot | null) {+ if (name === "underlying assets") {++ OrAssetViewer.getAssetChildren(asset.id!, asset.attributes!.childAssetType.value)+ .then((children: Asset[]) => {+ console.log("children", children);+ });+ }const content = OrAssetViewer.getPanelContent(name, asset, attributes, viewerConfig, panelConfig, shadowRoot);if (!content) {return;@@ -702,4 +709,17 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElemreturn ids.map((id) => response.data.find((asset) => asset.id === id)!.name!);}++ public static async getAssetChildren(id: string, childAssetType: string): Promise<any[]> {+ const response = await manager.rest.api.AssetResource.queryAssets({+ ids: [id],+ recursive: true+ });++ if (response.status !== 200 || !response.data) {+ return [];+ }++ return response.data.filter((asset) => asset.type === childAssetType);+ }}