@openremote/or-smart-notify 1.0.1 → 1.2.0-snapshot.20240512154942
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/package.json +21 -18
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -331
- package/dist/index.js.map +0 -1
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -331
- package/src/index.js.map +0 -1
- package/src/index.ts +0 -333
- package/tsconfig.json +0 -14
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
# \<or-smart-notify\>
|
|
1
|
+
# @openremote/or-smart-notify \<or-smart-notify\>
|
|
2
|
+
[![NPM Version][npm-image]][npm-url]
|
|
3
|
+
[![Linux Build][travis-image]][travis-url]
|
|
4
|
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
Web Component for displaying a smart notify control.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
```bash
|
|
10
|
+
npm i @openremote/or-smart-notify
|
|
11
|
+
yarn add @openremote/or-smart-notify
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Supported Browsers
|
|
19
|
+
The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
|
|
20
|
+
Internet Explorer 11 is also supported.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
25
|
+
|
|
26
|
+
[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
|
|
27
|
+
[npm-url]: https://npmjs.org/package/@openremote/or-smart-notify
|
|
28
|
+
[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
|
|
29
|
+
[travis-url]: https://travis-ci.org/live-js/live-xxx
|
|
30
|
+
[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
|
|
31
|
+
[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
|
package/package.json
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openremote/or-smart-notify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.2.0-snapshot.20240512154942",
|
|
4
4
|
"description": "OpenRemote Smarty Notify element",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/umd/index.bundle.js",
|
|
6
|
+
"module": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./*": "./lib/*.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "lib/index.d.ts",
|
|
7
12
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
13
|
+
"test": "echo \"No tests\" && exit 0",
|
|
14
|
+
"prepublishOnly": "npx webpack"
|
|
10
15
|
},
|
|
11
16
|
"author": "OpenRemote",
|
|
12
17
|
"license": "AGPL-3.0-or-later",
|
|
13
18
|
"dependencies": {
|
|
14
|
-
"@openremote/rest": "^1.0.0",
|
|
15
|
-
"@openremote/model": "^1.0.0",
|
|
16
|
-
"lit-element": "^2.0.1",
|
|
17
19
|
"@fortawesome/fontawesome-svg-core": "^1.2.12",
|
|
18
|
-
"@fortawesome/free-solid-svg-icons": "^5.6.3",
|
|
19
20
|
"@fortawesome/free-regular-svg-icons": "^5.6.3",
|
|
20
|
-
"
|
|
21
|
+
"@fortawesome/free-solid-svg-icons": "^5.6.3",
|
|
22
|
+
"@openremote/core": "1.2.0-snapshot.20240512154942",
|
|
23
|
+
"@openremote/model": "1.2.0-snapshot.20240512154942",
|
|
24
|
+
"@openremote/rest": "1.2.0-snapshot.20240512154942",
|
|
25
|
+
"lit": "^2.0.2",
|
|
26
|
+
"moment": "^2.29.4"
|
|
21
27
|
},
|
|
22
28
|
"devDependencies": {
|
|
23
|
-
"@
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"tslint": "^5.11.0",
|
|
28
|
-
"typescript": "^3.2.2",
|
|
29
|
-
"wct-browser-legacy": "^1.0.0"
|
|
29
|
+
"@openremote/util": "1.2.0-snapshot.20240512154942"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
30
33
|
}
|
|
31
|
-
}
|
|
34
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { html, LitElement, property, customElement } from 'lit-element';
|
|
8
|
-
import moment from 'moment';
|
|
9
|
-
import { icon } from '@fortawesome/fontawesome-svg-core';
|
|
10
|
-
import { faClock } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
-
import { faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
12
|
-
import REST from "@openremote/rest";
|
|
13
|
-
let OrSmartNotify = class OrSmartNotify extends LitElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
// if smart notify popup is visible
|
|
17
|
-
this.isVisible = false;
|
|
18
|
-
// If smart notify is active
|
|
19
|
-
this.isActive = false;
|
|
20
|
-
// If smart notify is active
|
|
21
|
-
this.isDisabled = false;
|
|
22
|
-
// If smart notify is active
|
|
23
|
-
this.smartNotify = {};
|
|
24
|
-
// default function on smartyNotify
|
|
25
|
-
this.currentTime = '-';
|
|
26
|
-
const self = this;
|
|
27
|
-
this.currentTime = moment().format('HH:mm');
|
|
28
|
-
setInterval(function () {
|
|
29
|
-
self.currentTime = moment().format('HH:mm');
|
|
30
|
-
}, 500);
|
|
31
|
-
}
|
|
32
|
-
render() {
|
|
33
|
-
// language=HTML
|
|
34
|
-
return html `
|
|
35
|
-
<style>
|
|
36
|
-
#smartNotifyControlPanel {
|
|
37
|
-
position: fixed;
|
|
38
|
-
left: 20px;
|
|
39
|
-
bottom: 146px;
|
|
40
|
-
width: 315px;
|
|
41
|
-
z-index: 2;
|
|
42
|
-
background-color: #FFFFFF;
|
|
43
|
-
|
|
44
|
-
-webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
45
|
-
-moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
46
|
-
box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
47
|
-
}
|
|
48
|
-
.layout.horizontal {
|
|
49
|
-
display: -ms-flexbox;
|
|
50
|
-
display: -webkit-flex;
|
|
51
|
-
display: flex;
|
|
52
|
-
|
|
53
|
-
-ms-flex-direction: row;
|
|
54
|
-
-webkit-flex-direction: row;
|
|
55
|
-
flex-direction: row;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-ms-flex-align: center;
|
|
59
|
-
-webkit-align-items: center;
|
|
60
|
-
align-items: center;
|
|
61
|
-
|
|
62
|
-
-ms-flex-pack: center;
|
|
63
|
-
-webkit-justify-content: center;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.t-center {
|
|
68
|
-
text-align: center;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.controller-timeline{
|
|
72
|
-
padding: 5px 20px;
|
|
73
|
-
height: 32px;
|
|
74
|
-
line-height: 32px;
|
|
75
|
-
border-bottom: solid 1px #dedede;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.flex {
|
|
79
|
-
-ms-flex: 1 1 0.000000001px;
|
|
80
|
-
-webkit-flex: 1;
|
|
81
|
-
flex: 1;
|
|
82
|
-
-webkit-flex-basis: 0.000000001px;
|
|
83
|
-
flex-basis: 0.000000001px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.padding-2-5 {
|
|
87
|
-
padding: 2px 5px;
|
|
88
|
-
}
|
|
89
|
-
.padding-10 {
|
|
90
|
-
padding: 10px;
|
|
91
|
-
}
|
|
92
|
-
#smart-notify-toggle {
|
|
93
|
-
margin-top: 29px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.smart-notify-toggle-label {
|
|
97
|
-
color: #FFFFFF;
|
|
98
|
-
background-color: #00477c;
|
|
99
|
-
border-top-left-radius: 5px;
|
|
100
|
-
border-top-right-radius: 5px;
|
|
101
|
-
padding: 2px 8px;
|
|
102
|
-
font-size: 12px;
|
|
103
|
-
height: 19px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.smart-notify-toggle-icon {
|
|
107
|
-
background-color: #555753;
|
|
108
|
-
border-bottom-left-radius: 5px;
|
|
109
|
-
border-bottom-right-radius: 5px;
|
|
110
|
-
margin-top: 2px;
|
|
111
|
-
height: 48px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.smart-notify-toggle-icon[active] {
|
|
115
|
-
background-color: #00477c;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
icon {
|
|
119
|
-
height: 20px;
|
|
120
|
-
width: 20px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
icon .svg-inline--fa {
|
|
124
|
-
height: 20px;
|
|
125
|
-
width: 20px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
icon[large] {
|
|
129
|
-
height: 28px;
|
|
130
|
-
width: 28px;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
icon[large] .svg-inline--fa {
|
|
134
|
-
height: 28px;
|
|
135
|
-
width: 28px;
|
|
136
|
-
margin: 10px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
icon[large] svg path {
|
|
140
|
-
fill: #FFFFFF;
|
|
141
|
-
color: #FFFFFF;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/* The switch - the box around the slider */
|
|
145
|
-
.switch {
|
|
146
|
-
position: relative;
|
|
147
|
-
display: inline-block;
|
|
148
|
-
width: 36px;
|
|
149
|
-
height: 14px;
|
|
150
|
-
margin: 10px 0;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/* Hide default HTML checkbox */
|
|
154
|
-
.switch input {
|
|
155
|
-
opacity: 0;
|
|
156
|
-
width: 0;
|
|
157
|
-
height: 0;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/* The slider */
|
|
161
|
-
.slider {
|
|
162
|
-
position: absolute;
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
top: 0;
|
|
165
|
-
left: 0;
|
|
166
|
-
right: 0;
|
|
167
|
-
bottom: 0;
|
|
168
|
-
background-color: #ccc;
|
|
169
|
-
-webkit-transition: .4s;
|
|
170
|
-
transition: .4s;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.slider:before {
|
|
174
|
-
position: absolute;
|
|
175
|
-
content: "";
|
|
176
|
-
height: 20px;
|
|
177
|
-
width: 20px;
|
|
178
|
-
left: 0;
|
|
179
|
-
top: -3px;
|
|
180
|
-
background-color: white;
|
|
181
|
-
-webkit-transition: .4s;
|
|
182
|
-
transition: .4s;
|
|
183
|
-
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
input:checked + .slider:before {
|
|
187
|
-
background-color: var(--app-primary-color);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
input:focus + .slider {
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
input:checked + .slider:before {
|
|
194
|
-
-webkit-transform: translateX(20px);
|
|
195
|
-
-ms-transform: translateX(20px);
|
|
196
|
-
transform: translateX(20px);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/* Rounded sliders */
|
|
200
|
-
.slider.round {
|
|
201
|
-
border-radius: 34px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.slider.round:before {
|
|
205
|
-
border-radius: 50%;
|
|
206
|
-
}
|
|
207
|
-
</style>
|
|
208
|
-
|
|
209
|
-
${this.isVisible ? html `
|
|
210
|
-
<div id="smartNotifyControlPanel">
|
|
211
|
-
<div class="layout horizontal controller-timeline t-center">
|
|
212
|
-
<icon>${icon(faClock).node.item(0)}</icon>
|
|
213
|
-
<div class="flex padding-2-5" style="font-weight: 600;">Smart Notify</div>
|
|
214
|
-
|
|
215
|
-
<a style="height: 22px;" @click="${this.close}">
|
|
216
|
-
<icon>${icon(faTimes).node.item(0)}</icon>
|
|
217
|
-
</a>
|
|
218
|
-
</div>
|
|
219
|
-
<div class="layout horizontal">
|
|
220
|
-
<div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Activeren</div>
|
|
221
|
-
<div class="flex t-center">
|
|
222
|
-
<label class="switch">
|
|
223
|
-
<input @change="${this.setSmartNotify}" ?disabled="${this.isDisabled}" ?checked="${this.isActive}" type="checkbox">
|
|
224
|
-
<span class="slider round"></span>
|
|
225
|
-
</label>
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
${this.isActive ? html `
|
|
229
|
-
<div class="layout horizontal">
|
|
230
|
-
<div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Starttijd</div>
|
|
231
|
-
<div class="flex t-center">${this.isActive ? moment(this.smartNotify.attributes.SMART_NOTIFY_ENABLED.valueTimestamp).format('HH:mm') : "-"}</div>
|
|
232
|
-
</div>
|
|
233
|
-
` : ``}
|
|
234
|
-
</div>
|
|
235
|
-
` : ``}
|
|
236
|
-
<div id="smart-notify-toggle" @click="${this.toggleVisibility}">
|
|
237
|
-
<div class="smart-notify-toggle-label">${this.currentTime}</div>
|
|
238
|
-
<div class="smart-notify-toggle-icon" ?active="${this.isActive}">
|
|
239
|
-
<icon large>${icon(faClock).node.item(0)}</icon>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
`;
|
|
244
|
-
}
|
|
245
|
-
getSmartNotify() {
|
|
246
|
-
const self = this;
|
|
247
|
-
return new Promise(function (resolve, reject) {
|
|
248
|
-
const smartNotifyQuery = {
|
|
249
|
-
name: { predicateType: "string", value: "SMART_NOTIFY_ASSET" },
|
|
250
|
-
select: { include: "ALL_EXCEPT_PATH" /* ALL_EXCEPT_PATH */ }
|
|
251
|
-
};
|
|
252
|
-
REST.api.AssetResource.queryAssets(smartNotifyQuery).then((response) => {
|
|
253
|
-
console.log("Setting Smart Notify");
|
|
254
|
-
if (response.data) {
|
|
255
|
-
self.smartNotify = response.data[0];
|
|
256
|
-
self.isActive = self.smartNotify.attributes.SMART_NOTIFY_ENABLED.value ? true : false;
|
|
257
|
-
self.onChange();
|
|
258
|
-
resolve(response);
|
|
259
|
-
}
|
|
260
|
-
}).catch((reason) => {
|
|
261
|
-
reject(Error("Error:" + reason));
|
|
262
|
-
console.log("Error:" + reason);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
checkSmartNotifyMarkers() {
|
|
267
|
-
const self = this;
|
|
268
|
-
if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length > 0) {
|
|
269
|
-
}
|
|
270
|
-
else if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length === 0) {
|
|
271
|
-
this.getSmartNotify().then(() => {
|
|
272
|
-
setTimeout(function () {
|
|
273
|
-
self.checkSmartNotifyMarkers();
|
|
274
|
-
}.bind(this), 3000);
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
setSmartNotify(e) {
|
|
279
|
-
const isChecked = e.target.checked;
|
|
280
|
-
if (isChecked == true) {
|
|
281
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = moment();
|
|
282
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.valueTimestamp = moment();
|
|
283
|
-
this.isActive = true;
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = null;
|
|
287
|
-
this.isActive = false;
|
|
288
|
-
}
|
|
289
|
-
REST.api.AssetResource.update(this.smartNotify.id, this.smartNotify).then((response) => {
|
|
290
|
-
console.log("Setting Smart Notify");
|
|
291
|
-
this.smartNotify.version = this.smartNotify.version + 1;
|
|
292
|
-
if (isChecked == true) {
|
|
293
|
-
this.checkSmartNotifyMarkers();
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
// Clear the smartnotify markers and smart notify in frontend
|
|
297
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = false;
|
|
298
|
-
this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers = [];
|
|
299
|
-
this.onChange();
|
|
300
|
-
}
|
|
301
|
-
}).catch((reason) => console.log("Error:" + reason));
|
|
302
|
-
}
|
|
303
|
-
close() {
|
|
304
|
-
this.isVisible = false;
|
|
305
|
-
}
|
|
306
|
-
toggleVisibility() {
|
|
307
|
-
this.isVisible = !this.isVisible;
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
__decorate([
|
|
311
|
-
property({ type: Function })
|
|
312
|
-
], OrSmartNotify.prototype, "onChange", void 0);
|
|
313
|
-
__decorate([
|
|
314
|
-
property({ type: Boolean })
|
|
315
|
-
], OrSmartNotify.prototype, "isVisible", void 0);
|
|
316
|
-
__decorate([
|
|
317
|
-
property({ type: Boolean })
|
|
318
|
-
], OrSmartNotify.prototype, "isActive", void 0);
|
|
319
|
-
__decorate([
|
|
320
|
-
property({ type: Boolean })
|
|
321
|
-
], OrSmartNotify.prototype, "isDisabled", void 0);
|
|
322
|
-
__decorate([
|
|
323
|
-
property({ type: Object })
|
|
324
|
-
], OrSmartNotify.prototype, "smartNotify", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
property({ type: String })
|
|
327
|
-
], OrSmartNotify.prototype, "currentTime", void 0);
|
|
328
|
-
OrSmartNotify = __decorate([
|
|
329
|
-
customElement('or-smart-notify')
|
|
330
|
-
], OrSmartNotify);
|
|
331
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,aAAa,CAAC;AAEtE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAC,IAAI,EAAC,MAAM,mCAAmC,CAAA;AACtD,OAAO,EAAC,OAAO,EAAC,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAC,MAAM,mCAAmC,CAAC;AAE1D,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAIpC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAoTlC;QACI,KAAK,EAAE,CAAC;QA3FZ,mCAAmC;QAE3B,cAAS,GAAY,KAAK,CAAC;QAEnC,4BAA4B;QAEpB,aAAQ,GAAY,KAAK,CAAC;QAElC,4BAA4B;QAEpB,eAAU,GAAY,KAAK,CAAC;QAEpC,4BAA4B;QAEpB,gBAAW,GAAQ,EAAE,CAAC;QAE9B,mCAAmC;QAE3B,gBAAW,GAAW,GAAG,CAAC;QA0E9B,MAAM,IAAI,GAAO,IAAI,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE5C,WAAW,C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AAM;gBAEH,6DAA6D;gBAC7D,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,GAAG,KAAK,CAAC;gBAC/D,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;gBACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;aACnB;QAEL,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAU,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK;QACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,gBAAgB;QACZ,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;IACrC,CAAC;CAaJ,CAAA;AAvGG;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;+CACL;AAItB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDACS;AAInC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;+CACQ;AAIlC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDACU;AAIpC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACK;AAI9B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACS;AA5OhC,aAAa;IADlB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,aAAa,CA+TlB"}
|
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/index.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { html, LitElement, property, customElement } from 'lit-element';
|
|
8
|
-
import moment from 'moment';
|
|
9
|
-
import { icon } from '@fortawesome/fontawesome-svg-core';
|
|
10
|
-
import { faClock } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
-
import { faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
12
|
-
import REST from "@openremote/rest";
|
|
13
|
-
let OrSmartNotify = class OrSmartNotify extends LitElement {
|
|
14
|
-
constructor() {
|
|
15
|
-
super();
|
|
16
|
-
// if smart notify popup is visible
|
|
17
|
-
this.isVisible = false;
|
|
18
|
-
// If smart notify is active
|
|
19
|
-
this.isActive = false;
|
|
20
|
-
// If smart notify is active
|
|
21
|
-
this.isDisabled = false;
|
|
22
|
-
// If smart notify is active
|
|
23
|
-
this.smartNotify = {};
|
|
24
|
-
// default function on smartyNotify
|
|
25
|
-
this.currentTime = '-';
|
|
26
|
-
const self = this;
|
|
27
|
-
this.currentTime = moment().format('HH:mm');
|
|
28
|
-
setInterval(function () {
|
|
29
|
-
self.currentTime = moment().format('HH:mm');
|
|
30
|
-
}, 500);
|
|
31
|
-
}
|
|
32
|
-
render() {
|
|
33
|
-
// language=HTML
|
|
34
|
-
return html `
|
|
35
|
-
<style>
|
|
36
|
-
#smartNotifyControlPanel {
|
|
37
|
-
position: fixed;
|
|
38
|
-
left: 20px;
|
|
39
|
-
bottom: 146px;
|
|
40
|
-
width: 315px;
|
|
41
|
-
z-index: 2;
|
|
42
|
-
background-color: #FFFFFF;
|
|
43
|
-
|
|
44
|
-
-webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
45
|
-
-moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
46
|
-
box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
47
|
-
}
|
|
48
|
-
.layout.horizontal {
|
|
49
|
-
display: -ms-flexbox;
|
|
50
|
-
display: -webkit-flex;
|
|
51
|
-
display: flex;
|
|
52
|
-
|
|
53
|
-
-ms-flex-direction: row;
|
|
54
|
-
-webkit-flex-direction: row;
|
|
55
|
-
flex-direction: row;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-ms-flex-align: center;
|
|
59
|
-
-webkit-align-items: center;
|
|
60
|
-
align-items: center;
|
|
61
|
-
|
|
62
|
-
-ms-flex-pack: center;
|
|
63
|
-
-webkit-justify-content: center;
|
|
64
|
-
justify-content: center;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.t-center {
|
|
68
|
-
text-align: center;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.controller-timeline{
|
|
72
|
-
padding: 5px 20px;
|
|
73
|
-
height: 32px;
|
|
74
|
-
line-height: 32px;
|
|
75
|
-
border-bottom: solid 1px #dedede;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.flex {
|
|
79
|
-
-ms-flex: 1 1 0.000000001px;
|
|
80
|
-
-webkit-flex: 1;
|
|
81
|
-
flex: 1;
|
|
82
|
-
-webkit-flex-basis: 0.000000001px;
|
|
83
|
-
flex-basis: 0.000000001px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.padding-2-5 {
|
|
87
|
-
padding: 2px 5px;
|
|
88
|
-
}
|
|
89
|
-
.padding-10 {
|
|
90
|
-
padding: 10px;
|
|
91
|
-
}
|
|
92
|
-
#smart-notify-toggle {
|
|
93
|
-
margin-top: 29px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.smart-notify-toggle-label {
|
|
97
|
-
color: #FFFFFF;
|
|
98
|
-
background-color: #00477c;
|
|
99
|
-
border-top-left-radius: 5px;
|
|
100
|
-
border-top-right-radius: 5px;
|
|
101
|
-
padding: 2px 8px;
|
|
102
|
-
font-size: 12px;
|
|
103
|
-
height: 19px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.smart-notify-toggle-icon {
|
|
107
|
-
background-color: #555753;
|
|
108
|
-
border-bottom-left-radius: 5px;
|
|
109
|
-
border-bottom-right-radius: 5px;
|
|
110
|
-
margin-top: 2px;
|
|
111
|
-
height: 48px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.smart-notify-toggle-icon[active] {
|
|
115
|
-
background-color: #00477c;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
icon {
|
|
119
|
-
height: 20px;
|
|
120
|
-
width: 20px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
icon .svg-inline--fa {
|
|
124
|
-
height: 20px;
|
|
125
|
-
width: 20px;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
icon[large] {
|
|
129
|
-
height: 28px;
|
|
130
|
-
width: 28px;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
icon[large] .svg-inline--fa {
|
|
134
|
-
height: 28px;
|
|
135
|
-
width: 28px;
|
|
136
|
-
margin: 10px;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
icon[large] svg path {
|
|
140
|
-
fill: #FFFFFF;
|
|
141
|
-
color: #FFFFFF;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/* The switch - the box around the slider */
|
|
145
|
-
.switch {
|
|
146
|
-
position: relative;
|
|
147
|
-
display: inline-block;
|
|
148
|
-
width: 36px;
|
|
149
|
-
height: 14px;
|
|
150
|
-
margin: 10px 0;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/* Hide default HTML checkbox */
|
|
154
|
-
.switch input {
|
|
155
|
-
opacity: 0;
|
|
156
|
-
width: 0;
|
|
157
|
-
height: 0;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/* The slider */
|
|
161
|
-
.slider {
|
|
162
|
-
position: absolute;
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
top: 0;
|
|
165
|
-
left: 0;
|
|
166
|
-
right: 0;
|
|
167
|
-
bottom: 0;
|
|
168
|
-
background-color: #ccc;
|
|
169
|
-
-webkit-transition: .4s;
|
|
170
|
-
transition: .4s;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.slider:before {
|
|
174
|
-
position: absolute;
|
|
175
|
-
content: "";
|
|
176
|
-
height: 20px;
|
|
177
|
-
width: 20px;
|
|
178
|
-
left: 0;
|
|
179
|
-
top: -3px;
|
|
180
|
-
background-color: white;
|
|
181
|
-
-webkit-transition: .4s;
|
|
182
|
-
transition: .4s;
|
|
183
|
-
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
input:checked + .slider:before {
|
|
187
|
-
background-color: var(--app-primary-color);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
input:focus + .slider {
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
input:checked + .slider:before {
|
|
194
|
-
-webkit-transform: translateX(20px);
|
|
195
|
-
-ms-transform: translateX(20px);
|
|
196
|
-
transform: translateX(20px);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/* Rounded sliders */
|
|
200
|
-
.slider.round {
|
|
201
|
-
border-radius: 34px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.slider.round:before {
|
|
205
|
-
border-radius: 50%;
|
|
206
|
-
}
|
|
207
|
-
</style>
|
|
208
|
-
|
|
209
|
-
${this.isVisible ? html `
|
|
210
|
-
<div id="smartNotifyControlPanel">
|
|
211
|
-
<div class="layout horizontal controller-timeline t-center">
|
|
212
|
-
<icon>${icon(faClock).node.item(0)}</icon>
|
|
213
|
-
<div class="flex padding-2-5" style="font-weight: 600;">Smart Notify</div>
|
|
214
|
-
|
|
215
|
-
<a style="height: 22px;" @click="${this.close}">
|
|
216
|
-
<icon>${icon(faTimes).node.item(0)}</icon>
|
|
217
|
-
</a>
|
|
218
|
-
</div>
|
|
219
|
-
<div class="layout horizontal">
|
|
220
|
-
<div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Activeren</div>
|
|
221
|
-
<div class="flex t-center">
|
|
222
|
-
<label class="switch">
|
|
223
|
-
<input @change="${this.setSmartNotify}" ?disabled="${this.isDisabled}" ?checked="${this.isActive}" type="checkbox">
|
|
224
|
-
<span class="slider round"></span>
|
|
225
|
-
</label>
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
${this.isActive ? html `
|
|
229
|
-
<div class="layout horizontal">
|
|
230
|
-
<div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Starttijd</div>
|
|
231
|
-
<div class="flex t-center">${this.isActive ? moment(this.smartNotify.attributes.SMART_NOTIFY_ENABLED.valueTimestamp).format('HH:mm') : "-"}</div>
|
|
232
|
-
</div>
|
|
233
|
-
` : ``}
|
|
234
|
-
</div>
|
|
235
|
-
` : ``}
|
|
236
|
-
<div id="smart-notify-toggle" @click="${this.toggleVisibility}">
|
|
237
|
-
<div class="smart-notify-toggle-label">${this.currentTime}</div>
|
|
238
|
-
<div class="smart-notify-toggle-icon" ?active="${this.isActive}">
|
|
239
|
-
<icon large>${icon(faClock).node.item(0)}</icon>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
`;
|
|
244
|
-
}
|
|
245
|
-
getSmartNotify() {
|
|
246
|
-
const self = this;
|
|
247
|
-
return new Promise(function (resolve, reject) {
|
|
248
|
-
const smartNotifyQuery = {
|
|
249
|
-
name: { predicateType: "string", value: "SMART_NOTIFY_ASSET" },
|
|
250
|
-
select: { include: "ALL_EXCEPT_PATH" /* ALL_EXCEPT_PATH */ }
|
|
251
|
-
};
|
|
252
|
-
REST.api.AssetResource.queryAssets(smartNotifyQuery).then((response) => {
|
|
253
|
-
console.log("Setting Smart Notify");
|
|
254
|
-
if (response.data) {
|
|
255
|
-
self.smartNotify = response.data[0];
|
|
256
|
-
self.isActive = self.smartNotify.attributes.SMART_NOTIFY_ENABLED.value ? true : false;
|
|
257
|
-
self.onChange();
|
|
258
|
-
resolve(response);
|
|
259
|
-
}
|
|
260
|
-
}).catch((reason) => {
|
|
261
|
-
reject(Error("Error:" + reason));
|
|
262
|
-
console.log("Error:" + reason);
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
checkSmartNotifyMarkers() {
|
|
267
|
-
const self = this;
|
|
268
|
-
if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length > 0) {
|
|
269
|
-
}
|
|
270
|
-
else if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length === 0) {
|
|
271
|
-
this.getSmartNotify().then(() => {
|
|
272
|
-
setTimeout(function () {
|
|
273
|
-
self.checkSmartNotifyMarkers();
|
|
274
|
-
}.bind(this), 3000);
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
setSmartNotify(e) {
|
|
279
|
-
const isChecked = e.target.checked;
|
|
280
|
-
if (isChecked == true) {
|
|
281
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = moment();
|
|
282
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.valueTimestamp = moment();
|
|
283
|
-
this.isActive = true;
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = null;
|
|
287
|
-
this.isActive = false;
|
|
288
|
-
}
|
|
289
|
-
REST.api.AssetResource.update(this.smartNotify.id, this.smartNotify).then((response) => {
|
|
290
|
-
console.log("Setting Smart Notify");
|
|
291
|
-
this.smartNotify.version = this.smartNotify.version + 1;
|
|
292
|
-
if (isChecked == true) {
|
|
293
|
-
this.checkSmartNotifyMarkers();
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
// Clear the smartnotify markers and smart notify in frontend
|
|
297
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = false;
|
|
298
|
-
this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers = [];
|
|
299
|
-
this.onChange();
|
|
300
|
-
}
|
|
301
|
-
}).catch((reason) => console.log("Error:" + reason));
|
|
302
|
-
}
|
|
303
|
-
close() {
|
|
304
|
-
this.isVisible = false;
|
|
305
|
-
}
|
|
306
|
-
toggleVisibility() {
|
|
307
|
-
this.isVisible = !this.isVisible;
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
__decorate([
|
|
311
|
-
property({ type: Function })
|
|
312
|
-
], OrSmartNotify.prototype, "onChange", void 0);
|
|
313
|
-
__decorate([
|
|
314
|
-
property({ type: Boolean })
|
|
315
|
-
], OrSmartNotify.prototype, "isVisible", void 0);
|
|
316
|
-
__decorate([
|
|
317
|
-
property({ type: Boolean })
|
|
318
|
-
], OrSmartNotify.prototype, "isActive", void 0);
|
|
319
|
-
__decorate([
|
|
320
|
-
property({ type: Boolean })
|
|
321
|
-
], OrSmartNotify.prototype, "isDisabled", void 0);
|
|
322
|
-
__decorate([
|
|
323
|
-
property({ type: Object })
|
|
324
|
-
], OrSmartNotify.prototype, "smartNotify", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
property({ type: String })
|
|
327
|
-
], OrSmartNotify.prototype, "currentTime", void 0);
|
|
328
|
-
OrSmartNotify = __decorate([
|
|
329
|
-
customElement('or-smart-notify')
|
|
330
|
-
], OrSmartNotify);
|
|
331
|
-
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM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;CAaJ,CAAA;AAvGG;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;+CACL;AAItB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;gDACS;AAInC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;+CACQ;AAIlC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;iDACU;AAIpC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACK;AAI9B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACS;AA5OhC,aAAa;IADlB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,aAAa,CA+TlB"}
|
package/src/index.ts
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
import {html, LitElement, property, customElement} from 'lit-element';
|
|
2
|
-
|
|
3
|
-
import moment from 'moment';
|
|
4
|
-
|
|
5
|
-
import {icon} from '@fortawesome/fontawesome-svg-core'
|
|
6
|
-
import {faClock} from '@fortawesome/free-regular-svg-icons';
|
|
7
|
-
import {faTimes} from '@fortawesome/free-solid-svg-icons';
|
|
8
|
-
|
|
9
|
-
import REST from "@openremote/rest";
|
|
10
|
-
import {AssetQuery, BaseAssetQueryInclude} from "@openremote/model";
|
|
11
|
-
|
|
12
|
-
@customElement('or-smart-notify')
|
|
13
|
-
class OrSmartNotify extends LitElement {
|
|
14
|
-
protected render() {
|
|
15
|
-
// language=HTML
|
|
16
|
-
return html`
|
|
17
|
-
<style>
|
|
18
|
-
#smartNotifyControlPanel {
|
|
19
|
-
position: fixed;
|
|
20
|
-
left: 20px;
|
|
21
|
-
bottom: 146px;
|
|
22
|
-
width: 315px;
|
|
23
|
-
z-index: 2;
|
|
24
|
-
background-color: #FFFFFF;
|
|
25
|
-
|
|
26
|
-
-webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
27
|
-
-moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
28
|
-
box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);
|
|
29
|
-
}
|
|
30
|
-
.layout.horizontal {
|
|
31
|
-
display: -ms-flexbox;
|
|
32
|
-
display: -webkit-flex;
|
|
33
|
-
display: flex;
|
|
34
|
-
|
|
35
|
-
-ms-flex-direction: row;
|
|
36
|
-
-webkit-flex-direction: row;
|
|
37
|
-
flex-direction: row;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-ms-flex-align: center;
|
|
41
|
-
-webkit-align-items: center;
|
|
42
|
-
align-items: center;
|
|
43
|
-
|
|
44
|
-
-ms-flex-pack: center;
|
|
45
|
-
-webkit-justify-content: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.t-center {
|
|
50
|
-
text-align: center;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.controller-timeline{
|
|
54
|
-
padding: 5px 20px;
|
|
55
|
-
height: 32px;
|
|
56
|
-
line-height: 32px;
|
|
57
|
-
border-bottom: solid 1px #dedede;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.flex {
|
|
61
|
-
-ms-flex: 1 1 0.000000001px;
|
|
62
|
-
-webkit-flex: 1;
|
|
63
|
-
flex: 1;
|
|
64
|
-
-webkit-flex-basis: 0.000000001px;
|
|
65
|
-
flex-basis: 0.000000001px;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.padding-2-5 {
|
|
69
|
-
padding: 2px 5px;
|
|
70
|
-
}
|
|
71
|
-
.padding-10 {
|
|
72
|
-
padding: 10px;
|
|
73
|
-
}
|
|
74
|
-
#smart-notify-toggle {
|
|
75
|
-
margin-top: 29px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.smart-notify-toggle-label {
|
|
79
|
-
color: #FFFFFF;
|
|
80
|
-
background-color: #00477c;
|
|
81
|
-
border-top-left-radius: 5px;
|
|
82
|
-
border-top-right-radius: 5px;
|
|
83
|
-
padding: 2px 8px;
|
|
84
|
-
font-size: 12px;
|
|
85
|
-
height: 19px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.smart-notify-toggle-icon {
|
|
89
|
-
background-color: #555753;
|
|
90
|
-
border-bottom-left-radius: 5px;
|
|
91
|
-
border-bottom-right-radius: 5px;
|
|
92
|
-
margin-top: 2px;
|
|
93
|
-
height: 48px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.smart-notify-toggle-icon[active] {
|
|
97
|
-
background-color: #00477c;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
icon {
|
|
101
|
-
height: 20px;
|
|
102
|
-
width: 20px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
icon .svg-inline--fa {
|
|
106
|
-
height: 20px;
|
|
107
|
-
width: 20px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
icon[large] {
|
|
111
|
-
height: 28px;
|
|
112
|
-
width: 28px;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
icon[large] .svg-inline--fa {
|
|
116
|
-
height: 28px;
|
|
117
|
-
width: 28px;
|
|
118
|
-
margin: 10px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
icon[large] svg path {
|
|
122
|
-
fill: #FFFFFF;
|
|
123
|
-
color: #FFFFFF;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/* The switch - the box around the slider */
|
|
127
|
-
.switch {
|
|
128
|
-
position: relative;
|
|
129
|
-
display: inline-block;
|
|
130
|
-
width: 36px;
|
|
131
|
-
height: 14px;
|
|
132
|
-
margin: 10px 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/* Hide default HTML checkbox */
|
|
136
|
-
.switch input {
|
|
137
|
-
opacity: 0;
|
|
138
|
-
width: 0;
|
|
139
|
-
height: 0;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/* The slider */
|
|
143
|
-
.slider {
|
|
144
|
-
position: absolute;
|
|
145
|
-
cursor: pointer;
|
|
146
|
-
top: 0;
|
|
147
|
-
left: 0;
|
|
148
|
-
right: 0;
|
|
149
|
-
bottom: 0;
|
|
150
|
-
background-color: #ccc;
|
|
151
|
-
-webkit-transition: .4s;
|
|
152
|
-
transition: .4s;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.slider:before {
|
|
156
|
-
position: absolute;
|
|
157
|
-
content: "";
|
|
158
|
-
height: 20px;
|
|
159
|
-
width: 20px;
|
|
160
|
-
left: 0;
|
|
161
|
-
top: -3px;
|
|
162
|
-
background-color: white;
|
|
163
|
-
-webkit-transition: .4s;
|
|
164
|
-
transition: .4s;
|
|
165
|
-
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
input:checked + .slider:before {
|
|
169
|
-
background-color: var(--app-primary-color);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
input:focus + .slider {
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
input:checked + .slider:before {
|
|
176
|
-
-webkit-transform: translateX(20px);
|
|
177
|
-
-ms-transform: translateX(20px);
|
|
178
|
-
transform: translateX(20px);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/* Rounded sliders */
|
|
182
|
-
.slider.round {
|
|
183
|
-
border-radius: 34px;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.slider.round:before {
|
|
187
|
-
border-radius: 50%;
|
|
188
|
-
}
|
|
189
|
-
</style>
|
|
190
|
-
|
|
191
|
-
${this.isVisible ? html`
|
|
192
|
-
<div id="smartNotifyControlPanel">
|
|
193
|
-
<div class="layout horizontal controller-timeline t-center">
|
|
194
|
-
<icon>${icon(faClock).node.item(0)}</icon>
|
|
195
|
-
<div class="flex padding-2-5" style="font-weight: 600;">Smart Notify</div>
|
|
196
|
-
|
|
197
|
-
<a style="height: 22px;" @click="${this.close}">
|
|
198
|
-
<icon>${icon(faTimes).node.item(0)}</icon>
|
|
199
|
-
</a>
|
|
200
|
-
</div>
|
|
201
|
-
<div class="layout horizontal">
|
|
202
|
-
<div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Activeren</div>
|
|
203
|
-
<div class="flex t-center">
|
|
204
|
-
<label class="switch">
|
|
205
|
-
<input @change="${this.setSmartNotify}" ?disabled="${this.isDisabled}" ?checked="${this.isActive}" type="checkbox">
|
|
206
|
-
<span class="slider round"></span>
|
|
207
|
-
</label>
|
|
208
|
-
</div>
|
|
209
|
-
</div>
|
|
210
|
-
${this.isActive ? html`
|
|
211
|
-
<div class="layout horizontal">
|
|
212
|
-
<div style="background-color: var(--app-lightgrey-color, #dedede);" class="flex padding-10">Starttijd</div>
|
|
213
|
-
<div class="flex t-center">${this.isActive ? moment(this.smartNotify.attributes.SMART_NOTIFY_ENABLED.valueTimestamp).format('HH:mm') : "-"}</div>
|
|
214
|
-
</div>
|
|
215
|
-
` : ``}
|
|
216
|
-
</div>
|
|
217
|
-
` : ``}
|
|
218
|
-
<div id="smart-notify-toggle" @click="${this.toggleVisibility}">
|
|
219
|
-
<div class="smart-notify-toggle-label">${this.currentTime}</div>
|
|
220
|
-
<div class="smart-notify-toggle-icon" ?active="${this.isActive}">
|
|
221
|
-
<icon large>${icon(faClock).node.item(0)}</icon>
|
|
222
|
-
</div>
|
|
223
|
-
</div>
|
|
224
|
-
|
|
225
|
-
`;
|
|
226
|
-
}
|
|
227
|
-
// default function on smartyNotify
|
|
228
|
-
@property({type: Function})
|
|
229
|
-
private onChange: any;
|
|
230
|
-
|
|
231
|
-
// if smart notify popup is visible
|
|
232
|
-
@property({type: Boolean})
|
|
233
|
-
private isVisible: boolean = false;
|
|
234
|
-
|
|
235
|
-
// If smart notify is active
|
|
236
|
-
@property({type: Boolean})
|
|
237
|
-
private isActive: boolean = false;
|
|
238
|
-
|
|
239
|
-
// If smart notify is active
|
|
240
|
-
@property({type: Boolean})
|
|
241
|
-
private isDisabled: boolean = false;
|
|
242
|
-
|
|
243
|
-
// If smart notify is active
|
|
244
|
-
@property({type: Object})
|
|
245
|
-
private smartNotify: any = {};
|
|
246
|
-
|
|
247
|
-
// default function on smartyNotify
|
|
248
|
-
@property({type: String})
|
|
249
|
-
private currentTime: string = '-';
|
|
250
|
-
|
|
251
|
-
getSmartNotify() {
|
|
252
|
-
const self:any = this;
|
|
253
|
-
return new Promise(function(resolve: any, reject: any) {
|
|
254
|
-
const smartNotifyQuery: AssetQuery = {
|
|
255
|
-
name: {predicateType: "string", value: "SMART_NOTIFY_ASSET"},
|
|
256
|
-
select: {include: BaseAssetQueryInclude.ALL_EXCEPT_PATH}
|
|
257
|
-
};
|
|
258
|
-
REST.api.AssetResource.queryAssets(smartNotifyQuery).then((response: any) => {
|
|
259
|
-
console.log("Setting Smart Notify");
|
|
260
|
-
if (response.data) {
|
|
261
|
-
self.smartNotify = response.data[0];
|
|
262
|
-
self.isActive = self.smartNotify.attributes.SMART_NOTIFY_ENABLED.value ? true : false;
|
|
263
|
-
self.onChange();
|
|
264
|
-
resolve(response);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
}).catch((reason:any) => {
|
|
268
|
-
reject(Error("Error:" + reason));
|
|
269
|
-
console.log("Error:" + reason)
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
checkSmartNotifyMarkers() {
|
|
276
|
-
const self:any = this;
|
|
277
|
-
if(this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length > 0) {
|
|
278
|
-
} else if (this.isActive && this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers.length === 0) {
|
|
279
|
-
this.getSmartNotify().then(()=> {
|
|
280
|
-
setTimeout(function(){
|
|
281
|
-
self.checkSmartNotifyMarkers();
|
|
282
|
-
}.bind(this), 3000);
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
setSmartNotify(e:any) {
|
|
288
|
-
const isChecked = e.target.checked;
|
|
289
|
-
if (isChecked == true) {
|
|
290
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = moment();
|
|
291
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.valueTimestamp = moment();
|
|
292
|
-
this.isActive = true;
|
|
293
|
-
} else {
|
|
294
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = null;
|
|
295
|
-
this.isActive = false;
|
|
296
|
-
}
|
|
297
|
-
REST.api.AssetResource.update(this.smartNotify.id, this.smartNotify).then((response:any) => {
|
|
298
|
-
console.log("Setting Smart Notify");
|
|
299
|
-
this.smartNotify.version = this.smartNotify.version+1;
|
|
300
|
-
if(isChecked == true){
|
|
301
|
-
this.checkSmartNotifyMarkers();
|
|
302
|
-
} else {
|
|
303
|
-
|
|
304
|
-
// Clear the smartnotify markers and smart notify in frontend
|
|
305
|
-
this.smartNotify.attributes.SMART_NOTIFY_ENABLED.value = false;
|
|
306
|
-
this.smartNotify.attributes.SMART_NOTIFY_RESULT.value.markers = [];
|
|
307
|
-
this.onChange();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
}).catch((reason:any) => console.log("Error:" + reason));
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
close() {
|
|
314
|
-
this.isVisible = false;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
toggleVisibility() {
|
|
318
|
-
this.isVisible = !this.isVisible;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
constructor() {
|
|
322
|
-
super();
|
|
323
|
-
const self:any = this;
|
|
324
|
-
this.currentTime = moment().format('HH:mm');
|
|
325
|
-
|
|
326
|
-
setInterval(function(){
|
|
327
|
-
self.currentTime = moment().format('HH:mm');
|
|
328
|
-
}, 500);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|