Skip to content

armgit / core

Public Imported from GitHub
0

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

differentiate between types of agents and show appropriate template

Vincent3425f26e805c
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.json
index 03cf6e0e6..74307b96f 100644
--- a/manager/src/web/shared/locales/en/or.json
+++ b/manager/src/web/shared/locales/en/or.json
@@ -153,6 +153,7 @@
"unmatched": "Unmatched",
"wait": "Wait",
"setup": "Setup",
+ "discoverAssets": "Discover assets",
"underlyingAssets": "Underlying assets",
"groupAssetName": "Asset name",
"history": "History",
diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.json
index 439c26720..60e507e13 100644
--- a/manager/src/web/shared/locales/nl/or.json
+++ b/manager/src/web/shared/locales/nl/or.json
@@ -153,6 +153,7 @@
"unmatched": "Niet dezelfde",
"wait": "Wacht",
"setup": "Instellingen",
+ "discoverAssets": "Haal assets op",
"underlyingAssets": "Onderliggende assets",
"groupAssetName": "Asset naam",
"history": "Geschiedenis",
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 51e61f086..7306a6a2c 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -21,6 +21,7 @@ import {OrTable} from "@openremote/or-table";
import {OrChartConfig, OrChartEvent} from "@openremote/or-chart";
import {HistoryConfig, OrAttributeHistory, OrAttributeHistoryEvent} from "@openremote/or-attribute-history";
import {
+ AgentDescriptor,
Asset,
AssetEvent,
Attribute,
@@ -357,11 +358,25 @@ export function getPanelContent(panelName: string, asset: Asset, attributes: { [
}
if (panelConfig && panelConfig.type === "setup") {
- const historyConfig = panelConfig as SetupPanelConfig;
+ const descriptor = AssetModelUtil.getAssetDescriptor(asset.type) as AgentDescriptor;
+
+ let content: TemplateResult = html``;
+
+ if (descriptor.assetImport) {
+ content = html`<input type="file"
+ id="configFile" name="avatar"
+ accept=".json, .knxproj, .vlp">`;
+ }
+ else if (descriptor.assetDiscovery) {
+ content = html`<or-mwc-input outlined id="discover-btn" .type="${InputType.BUTTON}" .label="${i18next.t("discoverAssets")}" @or-mwc-input-changed="${() => console.log('click')}"></or-mwc-input>`;
+ } else {
+ showSnackbar(undefined, "agent type doesn't support a known protocol to add assets", i18next.t("dismiss"));
+ }
return html`
- <pre>${JSON.stringify(historyConfig, undefined, 2)}</pre>
+ ${content}
`;
+
}
if (panelConfig && panelConfig.type === "survey") {