Skip to content

armgit / core

Public Imported from GitHub
0

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

UI: Remove or-smart-notify component (#2469)

Martin Peeters7110686bda73
diff --git a/ui/component/or-smart-notify/.npmignore b/ui/component/or-smart-notify/.npmignore
deleted file mode 100644
index b2544e0f1..000000000
--- a/ui/component/or-smart-notify/.npmignore
+++ /dev/null
@@ -1,9 +0,0 @@
-build/
-build.gradle
-test/
-src/
-webpack.config.js
-rspack.config.js
-tsconfig.json
-dist/*.map
-*.tsbuildinfo
diff --git a/ui/component/or-smart-notify/README.md b/ui/component/or-smart-notify/README.md
deleted file mode 100644
index b1cceb2c1..000000000
--- a/ui/component/or-smart-notify/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# @openremote/or-smart-notify \<or-smart-notify\>
-[![NPM Version][npm-image]][npm-url]
-[![Linux Build][travis-image]][travis-url]
-[![Test Coverage][coveralls-image]][coveralls-url]
-
-Web Component for displaying a smart notify control.
-
-## Install
-```bash
-npm i @openremote/or-smart-notify
-yarn add @openremote/or-smart-notify
-```
-
-## Usage
-For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
-
-
-## Supported Browsers
-The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
-Internet Explorer 11 is also supported.
-
-
-## License
-[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
-
-[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
-[npm-url]: https://npmjs.org/package/@openremote/or-smart-notify
-[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
-[travis-url]: https://travis-ci.org/live-js/live-xxx
-[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
-[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
diff --git a/ui/component/or-smart-notify/build.gradle b/ui/component/or-smart-notify/build.gradle
deleted file mode 100644
index 715a0847b..000000000
--- a/ui/component/or-smart-notify/build.gradle
+++ /dev/null
@@ -1,26 +0,0 @@
-buildDir = "dist"
-
-tasks.register('clean') {
- doLast {
- delete "dist"
- delete "lib"
- }
-}
-
-tasks.register('npmAnalyze', Exec) {
- mustRunAfter npmClean
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "analyze"
-}
-
-tasks.register('installDist') {
- dependsOn npmAnalyze
-}
-
-tasks.register('prepareUi') {
- dependsOn clean, npmAnalyze, npmPrepare
-}
-
-tasks.register('publishUi') {
- dependsOn clean, npmPublish
-}
diff --git a/ui/component/or-smart-notify/package.json b/ui/component/or-smart-notify/package.json
deleted file mode 100644
index 7581237b4..000000000
--- a/ui/component/or-smart-notify/package.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "name": "@openremote/or-smart-notify",
- "version": "1.14.0-snapshot",
- "description": "OpenRemote Smarty Notify element",
- "customElements": "custom-elements.json",
- "main": "dist/umd/index.bundle.js",
- "module": "lib/index.js",
- "exports": {
- ".": "./lib/index.js",
- "./*": "./lib/*.js",
- "./jsx": {
- "types": "./custom-elements-jsx.d.ts"
- }
- },
- "types": "lib/index.d.ts",
- "scripts": {
- "analyze": "npx cem analyze --config ../custom-elements-manifest.config.mjs",
- "test": "echo \"No tests\" && exit 0",
- "prepack": "npx rspack"
- },
- "author": "OpenRemote",
- "license": "AGPL-3.0-or-later",
- "dependencies": {
- "@fortawesome/fontawesome-svg-core": "^1.2.12",
- "@fortawesome/free-regular-svg-icons": "^5.6.3",
- "@fortawesome/free-solid-svg-icons": "^5.6.3",
- "@openremote/core": "workspace:*",
- "@openremote/model": "workspace:*",
- "lit": "^3.3.1",
- "moment": "^2.29.4"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/ui/component/or-smart-notify/rspack.config.js b/ui/component/or-smart-notify/rspack.config.js
deleted file mode 100644
index b8431e890..000000000
--- a/ui/component/or-smart-notify/rspack.config.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const util = require("@openremote/util");
-
-bundles = {
- "index": {
- vendor: {
- "moment": "moment"
- },
- excludeOr: true
- },
- "index.bundle": {
- excludeOr: true,
- },
- "index.orbundle": undefined
-};
-
-module.exports = util.generateExports(__dirname);
diff --git a/ui/component/or-smart-notify/src/index.ts b/ui/component/or-smart-notify/src/index.ts
deleted file mode 100644
index bae6b7f55..000000000
--- a/ui/component/or-smart-notify/src/index.ts
+++ /dev/null
@@ -1,337 +0,0 @@
-import {html, LitElement, PropertyValues} from "lit";
-import {customElement, property} from "lit/decorators.js";
-
-import moment from "moment";
-
-import {icon} from "@fortawesome/fontawesome-svg-core";
-import {faClock} from "@fortawesome/free-regular-svg-icons";
-import {faTimes} from "@fortawesome/free-solid-svg-icons";
-
-import {AssetQuery, ClientRole} from "@openremote/model";
-import manager from "@openremote/core";
-
-@customElement("or-smart-notify")
-class OrSmartNotify extends LitElement {
- // default function on smartyNotify
- @property({type: Function})
- private onChange: any;
-
- // if smart notify popup is visible
- @property({type: Boolean})
- private isVisible: boolean = false;
-
- // If smart notify is active
- @property({type: Boolean})
- private isActive: boolean = false;
-
- // If smart notify is active
- @property({type: Boolean})
- private isDisabled: boolean = false;
-
- // If smart notify is active
- @property({type: Object})
- private smartNotify: any = {};
-
- // default function on smartyNotify
- @property({type: String})
- private currentTime: string = "-";
-
- constructor() {
- super();
- const self: any = this;
- this.currentTime = moment().format("HH:mm");
-
- setInterval(function() {
- self.currentTime = moment().format("HH:mm");
- }, 500);
- }
-
- public getSmartNotify() {
- const self: any = this;
- return new Promise((resolve: any, reject: any) => {
- const smartNotifyQuery: AssetQuery = {
- names: [{predicateType: "string", value: "SMART_NOTIFY_ASSET"}]
- };
- manager.rest.api.AssetResource.queryAssets(smartNotifyQuery).then((response: any) => {
- console.log("Setting Smart Notify");
- if (response.data) {
- self.smartNotify = response.data[0];
- self.isActive = self.smartNotify.attributes.SMART_NOTIFY_ENABLED.value;
- self.onChange();
- resolve(response);
- }
-
- }).catch((reason: any) => {
- reject(Error("Error:" + reason));
- console.log("Error:" + reason);
- });
-
- });
- }
-
- public checkSmartNotifyMarkers() {
- const self: any = this;
- if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length > 0) {
- } else if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length === 0) {
- this.getSmartNotify().then(() => {
- setTimeout(() => {
- self.checkSmartNotifyMarkers();
- }, 3000);
- });
- }
- }
-
- public setSmartNotify(e: any) {
- const isChecked = e.target.checked;
- if (isChecked) {
- this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = moment();
- this.smartNotify.attributes.SMART_NOTIFY_ENABLED.timestamp = moment();
- this.isActive = true;
- } else {
- this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = null;
- this.isActive = false;
- }
-
- manager.rest.api.AssetResource.update(this.smartNotify.id, this.smartNotify).then((response: any) => {
- console.log("Setting Smart Notify");
- this.smartNotify.version = this.smartNotify.version + 1;
- if (isChecked) {
- this.checkSmartNotifyMarkers();
- } else {
-
- // Clear the smart notify markers and smart notify in frontend
- this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = false;
- this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers = [];
- this.onChange();
- }
-
- }).catch((reason: any) => console.log("Error:" + reason));
- }
-
- public close() {
- this.isVisible = false;
- }
-
- public toggleVisibility() {
- this.isVisible = !this.isVisible;
- }
- protected render() {
- // language=HTML
- return html`
- <style>
- #smartNotifyControlPanel {
- position: fixed;
- left: 20px;
- bottom: 146px;
- width: 315px;
- z-index: 2;
- background-color: #FFFFFF;
-
- -webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
- -moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
- box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
- }
- .layout.horizontal {
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
-
- -ms-flex-direction: row;
- -webkit-flex-direction: row;
- flex-direction: row;
-
-
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
-
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- }
-
- .t-center {
- text-align: center;
- }
-
- .controller-timeline{
- padding: 5px 20px;
- height: 32px;
- line-height: 32px;
- border-bottom: solid 1px #dedede;
- }
-
- .flex {
- -ms-flex: 1 1 0.000000001px;
- -webkit-flex: 1;
- flex: 1;
- -webkit-flex-basis: 0.000000001px;
- flex-basis: 0.000000001px;
- }
-
- .padding-2-5 {
- padding: 2px 5px;
- }
- .padding-10 {
- padding: 10px;
- }
- #smart-notify-toggle {
- margin-top: 29px;
- }
-
- .smart-notify-toggle-label {
- color: #FFFFFF;
- background-color: #00477c;
- border-top-left-radius: 5px;
- border-top-right-radius: 5px;
- padding: 2px 8px;
- font-size: 12px;
- height: 19px;
- }
-
- .smart-notify-toggle-icon {
- background-color: #555753;
- border-bottom-left-radius: 5px;
- border-bottom-right-radius: 5px;
- margin-top: 2px;
- height: 48px;
- }
-
- .smart-notify-toggle-icon[active] {
- background-color: #00477c;
- }
-
- icon {
- height: 20px;
- width: 20px;
- }
-
- icon .svg-inline--fa {
- height: 20px;
- width: 20px;
- }
-
- icon[large] {
- height: 28px;
- width: 28px;
- }
-
- icon[large] .svg-inline--fa {
- height: 28px;
- width: 28px;
- margin: 10px;
- }
-
- icon[large] svg path {
- fill: #FFFFFF;
- color: #FFFFFF;
- }
-
- /* The switch - the box around the slider */
- .switch {
- position: relative;
- display: inline-block;
- width: 36px;
- height: 14px;
- margin: 10px 0;
- }
-
- /* Hide default HTML checkbox */
- .switch input {
- opacity: 0;
- width: 0;
- height: 0;
- }
-
- /* The slider */
- .slider {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #ccc;
- -webkit-transition: .4s;
- transition: .4s;
- }
-
- .slider:before {
- position: absolute;
- content: "";
- height: 20px;
- width: 20px;
- left: 0;
- top: -3px;
- background-color: white;
- -webkit-transition: .4s;
- transition: .4s;
- box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);
- }
-
- input:checked + .slider:before {
- background-color: var(--app-primary-color);
- }
-
- input:focus + .slider {
- }
-
- input:checked + .slider:before {
- -webkit-transform: translateX(20px);
- -ms-transform: translateX(20px);
- transform: translateX(20px);
- }
-
- /* Rounded sliders */
- .slider.round {
- border-radius: 34px;
- }
-
- .slider.round:before {
- border-radius: 50%;
- }
- </style>
-
- ${this.isVisible ? html`
- <div id="smartNotifyControlPanel">
- <div class="layout horizontal controller-timeline t-center">
- <icon>${icon(faClock).node.item(0)}</icon>
- <div class="flex padding-2-5" style="font-weight: 600;">Smart Notify</div>
-
- <a style="cursor: pointer;height: 22px;" @click="${this.close}">
- <icon>${icon(faTimes).node.item(0)}</icon>
- </a>
- </div>
- <div class="layout horizontal">
- <div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Activeren</div>
- <div class="flex t-center">
- <label class="switch">
- <input @change="${this.setSmartNotify}" ?disabled="${this.isDisabled}" ?checked="${this.isActive}" type="checkbox">
- <span class="slider round"></span>
- </label>
- </div>
- </div>
- ${this.isActive ? html`
- <div class="layout horizontal">
- <div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Starttijd</div>
- <div class="flex t-center">${this.isActive ? moment(this.smartNotify.attributes.SMART_NOTIFY_ENABLED.timestamp).format("HH:mm") : "-"}</div>
- </div>
- ` : ``}
- </div>
- ` : ``}
- <div id="smart-notify-toggle" @click="${this.toggleVisibility}">
- <div class="smart-notify-toggle-label">${this.currentTime}</div>
- <div class="smart-notify-toggle-icon" ?active="${this.isActive}">
- <icon large>${icon(faClock).node.item(0)}</icon>
- </div>
- </div>
-
- `;
- }
-
- protected firstUpdated(_changedProperties: PropertyValues): void {
- super.firstUpdated(_changedProperties);
- this.isDisabled = !manager.hasRole(ClientRole.WRITE_ASSETS);
- }
-
-}
diff --git a/ui/component/or-smart-notify/tsconfig.json b/ui/component/or-smart-notify/tsconfig.json
deleted file mode 100644
index 36a7c304b..000000000
--- a/ui/component/or-smart-notify/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "./lib",
- "rootDir": "src"
- },
- "include": [
- "./src"
- ],
- "references": [
- { "path": "../core" },
- { "path": "../rest" }
- ]
-}
diff --git a/yarn.lock b/yarn.lock
index c9e69202e..7a7a80dea 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -528,40 +528,6 @@ __metadata:
languageName: node
linkType: hard
-"@fortawesome/fontawesome-common-types@npm:^0.2.36":
- version: 0.2.36
- resolution: "@fortawesome/fontawesome-common-types@npm:0.2.36"
- checksum: 10c0/4918ede75f22bf4623c645153d1385b16b58c638b8d500ba93d198382a1619742c77a3fd1348df8a6c157baf3486dc96710d6fe38e5eb006ea85ac39d294cb24
- languageName: node
- linkType: hard
-
-"@fortawesome/fontawesome-svg-core@npm:^1.2.12":
- version: 1.2.36
- resolution: "@fortawesome/fontawesome-svg-core@npm:1.2.36"
- dependencies:
- "@fortawesome/fontawesome-common-types": "npm:^0.2.36"
- checksum: 10c0/aaff16abc453d5ddf36035720ab9e600a5b22a6d37f8e0641104ecc505a10a7aae3b1ef3ec37992039d4fc00b322d0029b992c88b483f750794792f672b509f6
- languageName: node
- linkType: hard
-
-"@fortawesome/free-regular-svg-icons@npm:^5.6.3":
- version: 5.15.4
- resolution: "@fortawesome/free-regular-svg-icons@npm:5.15.4"
- dependencies:
- "@fortawesome/fontawesome-common-types": "npm:^0.2.36"
- checksum: 10c0/2b13b95666c4cff0f654ce3db3afa4cd0a7067238833cda7dbe756b2a2172a3573ee4418b71c9f46d783a767f5865ee47fd9b94779cd72684987bed7a30e66b7
- languageName: node
- linkType: hard
-
-"@fortawesome/free-solid-svg-icons@npm:^5.6.3":
- version: 5.15.4
- resolution: "@fortawesome/free-solid-svg-icons@npm:5.15.4"
- dependencies:
- "@fortawesome/fontawesome-common-types": "npm:^0.2.36"
- checksum: 10c0/746acdf9a443d149084a0a0fea684bc37cddf602a2fe04dda8911263e7e13d0105522337cc53a66e835e241d7d27a799e5a675ff16902a415520e14c7a5a1ca6
- languageName: node
- linkType: hard
-
"@github/catalyst@npm:^1.6.0":
version: 1.7.0
resolution: "@github/catalyst@npm:1.7.0"
@@ -2161,20 +2127,6 @@ __metadata:
languageName: unknown
linkType: soft
-"@openremote/or-smart-notify@workspace:ui/component/or-smart-notify":
- version: 0.0.0-use.local
- resolution: "@openremote/or-smart-notify@workspace:ui/component/or-smart-notify"
- dependencies:
- "@fortawesome/fontawesome-svg-core": "npm:^1.2.12"
- "@fortawesome/free-regular-svg-icons": "npm:^5.6.3"
- "@fortawesome/free-solid-svg-icons": "npm:^5.6.3"
- "@openremote/core": "workspace:*"
- "@openremote/model": "workspace:*"
- lit: "npm:^3.3.1"
- moment: "npm:^2.29.4"
- languageName: unknown
- linkType: soft
-
"@openremote/or-timeline@workspace:ui/component/or-timeline":
version: 0.0.0-use.local
resolution: "@openremote/or-timeline@workspace:ui/component/or-timeline"