Skip to content

armgit / core

Public Imported from GitHub
0

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

add modal to asset viewer

Vincent06d51c2acddd
diff --git a/ui/component/or-asset-viewer/src/components/or-add-modal.ts b/ui/component/or-asset-viewer/src/components/or-add-modal.ts
new file mode 100644
index 000000000..49405feee
--- /dev/null
+++ b/ui/component/or-asset-viewer/src/components/or-add-modal.ts
@@ -0,0 +1,84 @@
+import {customElement, html, css, LitElement, property, query, unsafeCSS} from "lit-element";
+import "@openremote/or-icon";
+import i18next from "i18next";
+import manager from "@openremote/core";
+import { InputType } from "@openremote/or-input";
+import {MDCDialog} from '@material/dialog';
+const dialogStyle = require("!!raw-loader!@material/dialog/dist/mdc.dialog.css");
+
+// language=CSS
+const style = css`
+ :host {
+ position: relative;
+ }
+
+ #language-dialog-content {
+ display: flex;
+ }
+
+ #language-picker {
+ flex: 1 1 0;
+ }
+
+`;
+
+@customElement("or-add-modal")
+export class OrAddModal extends LitElement {
+
+
+ @property({type: Boolean})
+ isVisible?: boolean = false;
+
+ @query("#mdc-dialog-add-asset")
+ protected _dialogElem!: HTMLElement;
+
+ protected _dialog!: MDCDialog;
+
+ static get styles() {
+ return [
+ css`${unsafeCSS(dialogStyle)}`,
+ style
+ ];
+ }
+
+ firstUpdated() {
+ this._dialog = new MDCDialog(this._dialogElem);
+ }
+
+ protected render() {
+ return html`
+ <div id="mdc-dialog-add-asset"
+ class="mdc-dialog"
+ role="alertdialog"
+ aria-modal="true"
+ aria-labelledby="my-dialog-title"
+ aria-describedby="my-dialog-content">
+ <div class="mdc-dialog__container">
+ <div class="mdc-dialog__surface">
+ <h2 class="mdc-dialog__title" id="my-dialog-title">${i18next.t("add_remove_attributes")}</h2>
+ <div class="dialog-container mdc-dialog__content" id="language-dialog-content">
+ test
+ </div>
+ <footer class="mdc-dialog__actions">
+ <or-input class="button"
+ slot="secondaryAction"
+ .type="${InputType.BUTTON}"
+ label="${i18next.t("Cancel")}"
+ class="mdc-button mdc-dialog__button"
+ data-mdc-dialog-action="no"></or-input>
+
+ <or-input class="button"
+ slot="primaryAction"
+ .type="${InputType.BUTTON}"
+ label="${i18next.t("ok")}"
+ class="mdc-button mdc-dialog__button"
+ data-mdc-dialog-action="yes"></or-input>
+
+ </footer>
+ </div>
+ </div>
+ <div class="mdc-dialog__scrim"></div>
+ </div>
+ `;
+ }
+}
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index 6e6bce005..6d035458f 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -29,6 +29,8 @@ import {style} from "./style";
import i18next from "i18next";
import {styleMap} from "lit-html/directives/style-map";
import {classMap} from "lit-html/directives/class-map";
+import "./components/or-add-modal";
+import {MDCDialog} from "@material/dialog";
export type PanelType = "property" | "location" | "attribute" | "history" | "chart" | "group";