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: added delete to or-attribute-card

Rich Turner51733cccecc6
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 962a6e230..5d92b1e5c 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -24,7 +24,7 @@ import {OrAssetTreeSelectionEvent} from "@openremote/or-asset-tree";
import {OrMwcDialog} from "@openremote/or-mwc-components/or-mwc-dialog";
import {getContentWithMenuTemplate} from "@openremote/or-mwc-components/or-mwc-menu";
-export type ContextMenuOptions = "editAttribute" | "editDelta" | "editCurrentValue";
+export type ContextMenuOptions = "editAttribute" | "editDelta" | "editCurrentValue" | "delete";
Chart.register(LineController, LineElement, PointElement, LinearScale, Title, TimeSeriesScale);
@@ -374,6 +374,10 @@ export class OrAttributeCard extends LitElement {
{
text: i18next.t("editCurrentValue"),
value: "editCurrentValue"
+ },
+ {
+ text: i18next.t("delete"),
+ value: "delete"
}
],
undefined,
@@ -853,7 +857,13 @@ export class OrAttributeCard extends LitElement {
}
protected handleMenuSelect(value: ContextMenuOptions) {
- this._openDialog(value);
+ if (value === "delete") {
+ this.assets = [];
+ this.assetAttributes = [];
+ this.saveSettings();
+ } else {
+ this._openDialog(value);
+ }
}
protected setMainValueSize(value: string) {