@c8y/ng1-modules 1018.208.0 → 1018.210.0
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/administration-homeAdministration/home-administration.component.js +1 -1
- package/administration-homeAdministration/home-administration.template.html +19 -15
- package/core/core/services/measurements.js +1 -1
- package/core/cumulocity.json +0 -2
- package/core/ui/directives/auditList.js +1 -1
- package/core/ui/services/util.js +1 -1
- package/devicemanagement-deviceNetwork/views/network.html +19 -0
- package/package.json +1 -1
- package/smartRules/controllers/list.js +1 -1
- package/smartRules/list/smartRulesList.component.js +1 -1
- package/smartRules/list/smartRulesList.html +86 -38
- package/smartRules/services/smartRules.js +1 -1
- package/smartRules/views/list.html +99 -46
- package/administration-eventProcessing/cumulocity.json +0 -23
- package/administration-eventProcessing/details/eventProcessingRuleAlarms.component.js +0 -1
- package/administration-eventProcessing/details/eventProcessingRuleAlarms.html +0 -8
- package/administration-eventProcessing/details/eventProcessingRuleDetails.component.js +0 -1
- package/administration-eventProcessing/details/eventProcessingRuleDetails.html +0 -206
- package/administration-eventProcessing/details/eventProcessingRuleMetrics.component.js +0 -1
- package/administration-eventProcessing/details/eventProcessingRuleMetrics.html +0 -21
- package/administration-eventProcessing/details/eventProcessingRuleNotifications.component.js +0 -1
- package/administration-eventProcessing/details/eventProcessingRuleNotifications.html +0 -57
- package/administration-eventProcessing/details/eventProcessingRuleTitle.component.js +0 -1
- package/administration-eventProcessing/details/eventProcessingRuleTitle.html +0 -40
- package/administration-eventProcessing/details/eventProcessingRulesExamples.component.js +0 -1
- package/administration-eventProcessing/details/eventProcessingRulesExamples.html +0 -82
- package/administration-eventProcessing/index.js +0 -1
- package/administration-eventProcessing/list/eventProcessingRulesList.component.js +0 -1
- package/administration-eventProcessing/list/eventProcessingRulesList.html +0 -175
- package/administration-eventProcessing/services/eventProcessing.js +0 -1
- package/core/core/services/cepModule.js +0 -1
- package/core/core/services/cepModuleExamples.js +0 -1
- package/notifications/cumulocity.json +0 -11
- package/notifications/index.js +0 -1
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
<c8y-ui-title-set title="vm.module.name"></c8y-ui-title-set>
|
|
2
|
-
|
|
3
|
-
<c8y-breadcrumbs-set>
|
|
4
|
-
<c8y-breadcrumbs-item
|
|
5
|
-
path="#eventprocessing"
|
|
6
|
-
label="{{ 'Event processing' | translate }}"
|
|
7
|
-
icon="c8y-event-processing"
|
|
8
|
-
></c8y-breadcrumbs-item>
|
|
9
|
-
</c8y-breadcrumbs-set>
|
|
10
|
-
|
|
11
|
-
<form name="vm.moduleForm" novalidate>
|
|
12
|
-
<div class="card content-fullpage d-col d-flex">
|
|
13
|
-
<div class="card-block bg-level-1 p-t-24 p-b-24 large-padding flex-no-shrink">
|
|
14
|
-
<div class="content-flex-70">
|
|
15
|
-
<div class="text-center">
|
|
16
|
-
<i class="c8y-icon c8y-icon-event-processing c8y-icon-duocolor icon-48"></i>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="flex-grow col-10">
|
|
19
|
-
<div class="content-flex-80">
|
|
20
|
-
<div class="col-9">
|
|
21
|
-
<div class="form-group form-group-lg m-b-0">
|
|
22
|
-
<label class="sr-only">{{ 'Rule name' | translate }}</label>
|
|
23
|
-
<label class="editable" ng-class="{ updated: vm.loadedName !== vm.module.name }">
|
|
24
|
-
<input
|
|
25
|
-
class="form-control"
|
|
26
|
-
ng-model="vm.module.name"
|
|
27
|
-
ng-disabled="!vm.permissions.canAdmin"
|
|
28
|
-
required
|
|
29
|
-
type="text"
|
|
30
|
-
style="max-width: calc( {{ vm.module.name.length || 10 }}ch + 14px );"
|
|
31
|
-
placeholder="{{ 'e.g. myModule01' | translate }}"
|
|
32
|
-
/>
|
|
33
|
-
</label>
|
|
34
|
-
</div>
|
|
35
|
-
<div class="d-flex a-i-center p-t-8">
|
|
36
|
-
<label translate class="m-r-4 m-b-0">Status</label>
|
|
37
|
-
<button
|
|
38
|
-
type="button"
|
|
39
|
-
class="btn btn-default m-b-0"
|
|
40
|
-
ng-model="vm.moduleDeployed"
|
|
41
|
-
ng-disabled="!vm.permissions.canAdmin || vm.isSmartRuleModule(vm.module)"
|
|
42
|
-
ng-change="vm.onModuleDeployedChanged(vm.moduleDeployed)"
|
|
43
|
-
uib-btn-checkbox
|
|
44
|
-
style="min-width: 148px"
|
|
45
|
-
>
|
|
46
|
-
<span title="{{ 'Deployed' | translate }}" ng-if="vm.moduleDeployed">
|
|
47
|
-
<i c8y-icon="check-circle" class="text-success"></i>
|
|
48
|
-
<translate>Deployed</translate>
|
|
49
|
-
</span>
|
|
50
|
-
<span title="{{ 'Not deployed' | translate }}" ng-if="!vm.moduleDeployed">
|
|
51
|
-
<i c8y-icon="ban" class="text-warning"></i>
|
|
52
|
-
<translate>Not deployed</translate>
|
|
53
|
-
</span>
|
|
54
|
-
</button>
|
|
55
|
-
</div>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="flex-grow">
|
|
58
|
-
<p class="m-b-8">
|
|
59
|
-
<i c8y-icon="info-circle-o" class="text-info m-r-8"></i>
|
|
60
|
-
<span class="text-label-small">
|
|
61
|
-
{{ 'Rule info' | translate }}
|
|
62
|
-
</span>
|
|
63
|
-
</p>
|
|
64
|
-
<ul class="list-unstyled small">
|
|
65
|
-
<li class="p-t-4 p-b-4 d-flex separator-top-bottom text-nowrap">
|
|
66
|
-
<label class="small m-b-0 m-r-8">{{ 'Last modified' | translate }}</label>
|
|
67
|
-
<span class="m-l-auto">{{ vm.module.lastModified | absoluteDate }}</span>
|
|
68
|
-
</li>
|
|
69
|
-
</ul>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
<div class="flex-grow separator-top">
|
|
77
|
-
<div class="d-grid grid__col--6-6--md fit-h">
|
|
78
|
-
<div ng-class="vm.panelClasses.left" class="d-flex d-col">
|
|
79
|
-
<div class="card-header separator p-relative">
|
|
80
|
-
<div class="card-actions">
|
|
81
|
-
<button
|
|
82
|
-
title="{{ 'Examples' | translate }}…"
|
|
83
|
-
type="button"
|
|
84
|
-
class="btn btn-link"
|
|
85
|
-
ng-click="vm.browseExamples()"
|
|
86
|
-
ng-disabled="!vm.permissions.canAdmin || vm.isSmartRuleModule(vm.module)"
|
|
87
|
-
>
|
|
88
|
-
<i c8y-icon="code"></i>
|
|
89
|
-
{{ 'Examples' | translate }}…
|
|
90
|
-
</button>
|
|
91
|
-
<button
|
|
92
|
-
type="button"
|
|
93
|
-
class="btn btn-link hidden-xs hidden-sm"
|
|
94
|
-
ng-click="vm.expand('left')"
|
|
95
|
-
ng-if="!vm.isExpanded('left')"
|
|
96
|
-
title="{{ 'Expand' | translate }}"
|
|
97
|
-
>
|
|
98
|
-
<i c8y-icon="expand" class="text-muted"></i>
|
|
99
|
-
</button>
|
|
100
|
-
<button
|
|
101
|
-
type="button"
|
|
102
|
-
class="btn btn-link hidden-xs hidden-sm"
|
|
103
|
-
ng-click="vm.collapse()"
|
|
104
|
-
ng-if="vm.isExpanded('left')"
|
|
105
|
-
title="{{ 'Collapse' | translate }}"
|
|
106
|
-
>
|
|
107
|
-
<i c8y-icon="compress" class="text-muted"></i>
|
|
108
|
-
</button>
|
|
109
|
-
</div>
|
|
110
|
-
<div class="card-title">
|
|
111
|
-
{{ 'Source code' | translate }}
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
<div
|
|
115
|
-
name="aceEditor"
|
|
116
|
-
ui-ace="vm.aceEditorOptions"
|
|
117
|
-
ng-model="vm.module.body"
|
|
118
|
-
ng-style="vm.aceEditorStyles"
|
|
119
|
-
class="form-control"
|
|
120
|
-
ng-readonly="!vm.permissions.canAdmin || vm.isSmartRuleModule(vm.module)"
|
|
121
|
-
required
|
|
122
|
-
></div>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div ng-class="vm.panelClasses.right" class="d-flex d-col" ng-if="vm.module.id">
|
|
126
|
-
<div class="card-header separator p-relative">
|
|
127
|
-
<div class="card-title">{{ 'Debugging and monitoring' | translate }}</div>
|
|
128
|
-
<div class="card-actions">
|
|
129
|
-
<button
|
|
130
|
-
type="button"
|
|
131
|
-
class="btn btn-link hidden-xs hidden-sm"
|
|
132
|
-
ng-click="vm.expand('right')"
|
|
133
|
-
ng-if="!vm.isExpanded('right')"
|
|
134
|
-
title="{{ 'Expand' | translate }}"
|
|
135
|
-
>
|
|
136
|
-
<i c8y-icon="expand" class="text-muted"></i>
|
|
137
|
-
</button>
|
|
138
|
-
<button
|
|
139
|
-
type="button"
|
|
140
|
-
class="btn btn-link hidden-xs hidden-sm"
|
|
141
|
-
title="{{ 'Collapse' | translate }}"
|
|
142
|
-
ng-click="vm.collapse()"
|
|
143
|
-
ng-if="vm.isExpanded('right')"
|
|
144
|
-
>
|
|
145
|
-
<i c8y-icon="compress" class="text-muted"></i>
|
|
146
|
-
</button>
|
|
147
|
-
</div>
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<uib-tabset justified="true" class="card-tabs-wrapper">
|
|
151
|
-
<uib-tab classes="one two three">
|
|
152
|
-
<uib-tab-heading>
|
|
153
|
-
<i c8y-icon="bell"></i>
|
|
154
|
-
<span translate>Alarms</span>
|
|
155
|
-
</uib-tab-heading>
|
|
156
|
-
<div class="card-block">
|
|
157
|
-
<c8y-event-processing-rule-alarms
|
|
158
|
-
rule="vm.module"
|
|
159
|
-
></c8y-event-processing-rule-alarms>
|
|
160
|
-
</div>
|
|
161
|
-
</uib-tab>
|
|
162
|
-
<uib-tab>
|
|
163
|
-
<uib-tab-heading>
|
|
164
|
-
<i c8y-icon="rss"></i>
|
|
165
|
-
<span translate>Notifications</span>
|
|
166
|
-
</uib-tab-heading>
|
|
167
|
-
<c8y-event-processing-rule-notifications
|
|
168
|
-
rule="vm.module"
|
|
169
|
-
class="d-contents"
|
|
170
|
-
></c8y-event-processing-rule-notifications>
|
|
171
|
-
</uib-tab>
|
|
172
|
-
<uib-tab>
|
|
173
|
-
<uib-tab-heading>
|
|
174
|
-
<i c8y-icon="line-chart"></i>
|
|
175
|
-
<span translate>Metrics</span>
|
|
176
|
-
</uib-tab-heading>
|
|
177
|
-
<c8y-event-processing-rule-metrics
|
|
178
|
-
rule="vm.module"
|
|
179
|
-
></c8y-event-processing-rule-metrics>
|
|
180
|
-
</uib-tab>
|
|
181
|
-
</uib-tabset>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
<div class="card-footer separator col-fullspan">
|
|
187
|
-
<button
|
|
188
|
-
type="button"
|
|
189
|
-
class="btn-default btn"
|
|
190
|
-
title="{{ 'Cancel' | translate }}"
|
|
191
|
-
ng-click="vm.cancel()"
|
|
192
|
-
>
|
|
193
|
-
{{ 'Cancel' | translate }}
|
|
194
|
-
</button>
|
|
195
|
-
<button
|
|
196
|
-
title="{{ 'Save' | translate }}"
|
|
197
|
-
type="submit"
|
|
198
|
-
class="btn btn-primary"
|
|
199
|
-
ng-click="vm.save(vm.module, vm.moduleForm)"
|
|
200
|
-
ng-disabled="!vm.permissions.canAdmin || vm.isSmartRuleModule(vm.module) || vm.moduleForm.$invalid || vm.moduleForm.$pristine"
|
|
201
|
-
>
|
|
202
|
-
{{ 'Save' | translate }}
|
|
203
|
-
</button>
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
</form>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(n){var t=this;_.assign(t,{$onChanges:function(e){e.rule&&t.rule&&n.getModuleMetrics(t.rule).then(function(e){t.metrics=e})}})}e.$inject=["eventProcessingSvc"],angular.module("c8y.eventProcessing").component("c8yEventProcessingRuleMetrics",{bindings:{rule:"<"},templateUrl:":::PLUGIN_PATH:::/details/eventProcessingRuleMetrics.html",controller:e,controllerAs:"vm"})}();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<div class="card-block" ng-if="vm.metrics.length === 0 || !vm.metrics">
|
|
2
|
-
<div class="card c8y-empty-state text-left">
|
|
3
|
-
<h1 c8y-icon="line-chart"></h1>
|
|
4
|
-
<p><strong translate>No metrics available</strong></p>
|
|
5
|
-
</div>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="card-block">
|
|
8
|
-
<div ng-if="vm.metrics.length > 0">
|
|
9
|
-
<div ng-repeat="metric in vm.metrics">
|
|
10
|
-
<div class="legend form-block center" ng-bind="metric.statement | humanize"></div>
|
|
11
|
-
<c8y-measurements-fragment-chart
|
|
12
|
-
fragment="metric.fragment"
|
|
13
|
-
device="metric.deviceId"
|
|
14
|
-
date-to="metric.dateTo"
|
|
15
|
-
date-from="metric.dateFrom"
|
|
16
|
-
realtime="true"
|
|
17
|
-
>
|
|
18
|
-
</c8y-measurements-fragment-chart>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
package/administration-eventProcessing/details/eventProcessingRuleNotifications.component.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function n(t,n){var s=this,e={connected:{text:n("Connected"),cls:"label-success"},pending:{text:n("Pending"),cls:"label-warning"},notdeployed:{text:n("Not deployed"),cls:"label-danger"}},c=null,o=[];function i(n){s.status=n}function r(n){if(!(c=n).connected)var e=n.$on("connected",function(){i("connected"),e()});i(n.connected?"connected":"pending"),n.$on("message",u)}function u(n,e){e.id=parseInt(e.id,10),s.msgs.push(e)}function l(){c&&c.unsubscribe()}function a(n){return e[n]||{}}function d(n){return o.indexOf(n)}function f(n){return-1<d(n)}_.assign(s,{$onChanges:function(n){n.rule&&s.rule&&function(n){if(l(),"DEPLOYED"===n.status){t.configure("debug");var e="/".concat(n.name,"/*");t.subscribe(e).then(r)}else i("notdeployed")}(s.rule)},$onDestroy:l,getStatementName:function(n){var e=_.get(n,"channel");return _.last(e.split("/"))},statusText:function(n){return a(n).text},statusClass:function(n){return a(n).cls},clearAll:function(){s.msgs.length=0},toggle:function(n){f(n)?o.splice(d(n),1):o.push(n)},isOpen:f,isError:function(n){return n.data&&n.data.message&&-1!==n.data.message.indexOf("ReferenceError")}}),s.msgs=[]}n.$inject=["c8yNotifications","gettext"],angular.module("c8y.eventProcessing").component("c8yEventProcessingRuleNotifications",{bindings:{rule:"<"},templateUrl:":::PLUGIN_PATH:::/details/eventProcessingRuleNotifications.html",controller:n,controllerAs:"vm"})}();
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<div class="sticky-top card-block bg-component" ng-if="vm.msgs.length > 0">
|
|
2
|
-
<div class="input-group">
|
|
3
|
-
<span class="input-group-addon">
|
|
4
|
-
<i c8y-icon="filter"></i>
|
|
5
|
-
</span>
|
|
6
|
-
<input
|
|
7
|
-
type="search"
|
|
8
|
-
class="form-control"
|
|
9
|
-
placeholder="{{'Filter notifications' | translate}}…"
|
|
10
|
-
ng-model="vm.notificationsFilter.text"
|
|
11
|
-
/>
|
|
12
|
-
<span class="input-group-addon">
|
|
13
|
-
<span class="label m-r-16" ng-class="vm.statusClass(vm.status)">
|
|
14
|
-
{{vm.statusText(vm.status) | translate}}
|
|
15
|
-
</span>
|
|
16
|
-
</span>
|
|
17
|
-
<span class="input-group-btn">
|
|
18
|
-
<button type="button" class="btn btn-default" ng-click="vm.clearAll()">
|
|
19
|
-
<i c8y-icon="times"></i>
|
|
20
|
-
</button>
|
|
21
|
-
</span>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="card-block" ng-if="vm.msgs.length === 0">
|
|
25
|
-
<div class="card c8y-empty-state text-left">
|
|
26
|
-
<h1 c8y-icon="rss"></h1>
|
|
27
|
-
<p><strong translate>No notifications received yet.</strong></p>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div class="card-block p-t-0" ng-if="vm.msgs.length > 0">
|
|
32
|
-
<table class="table">
|
|
33
|
-
<tr ng-repeat-start="msg in vm.msgs | filter:vm.notificationsFilter.text | orderBy:'id':true track by $index">
|
|
34
|
-
<td ng-class="{'alert, alert-danger': vm.isError(msg)}">
|
|
35
|
-
<span class="interact" ng-click="vm.toggle(msg)">
|
|
36
|
-
<b>
|
|
37
|
-
<span ng-if="vm.isError(msg)" translate>ERROR</span>
|
|
38
|
-
{{'Statement' | translate}}:
|
|
39
|
-
</b>
|
|
40
|
-
{{vm.getStatementName(msg)}}
|
|
41
|
-
</span>
|
|
42
|
-
<small class="text-muted">
|
|
43
|
-
{{'ID' | translate}}: {{msg.id}}
|
|
44
|
-
</small>
|
|
45
|
-
</td>
|
|
46
|
-
</tr>
|
|
47
|
-
<tr ng-repeat-end ng-if="vm.isOpen(msg)">
|
|
48
|
-
<td>
|
|
49
|
-
<h5>
|
|
50
|
-
<i c8y-icon="bars"></i> <translate>Details</translate>
|
|
51
|
-
</h5>
|
|
52
|
-
<pre><code ng-bind-html="msg.data | json"></code></pre>
|
|
53
|
-
</td>
|
|
54
|
-
</tr>
|
|
55
|
-
</table>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(e){_.assign(this,{RULES_LIST:"eventprocessing",isSmartRuleModule:e.isSmartRuleModule})}e.$inject=["c8yCepModule"],angular.module("c8y.eventProcessing").component("c8yEventProcessingRuleTitle",{templateUrl:":::PLUGIN_PATH:::/details/eventProcessingRuleTitle.html",bindings:{rule:"<",onSaveName:"&",ngDisabled:"="},controller:e,controllerAs:"vm"})}();
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<h1 class="title d-block">
|
|
2
|
-
<c8y-inplace-input
|
|
3
|
-
class="edit-in-place"
|
|
4
|
-
value="vm.rule.name"
|
|
5
|
-
on-save="vm.onSaveName({name: value})"
|
|
6
|
-
data-disabled="vm.ngDisabled || vm.isSmartRuleModule(vm.rule)"
|
|
7
|
-
placeholder="'e.g. myModule01' | translate"
|
|
8
|
-
>
|
|
9
|
-
<edit>
|
|
10
|
-
<div class="form-group">
|
|
11
|
-
<input
|
|
12
|
-
id="{{$parent.vm.id}}"
|
|
13
|
-
name="value"
|
|
14
|
-
type="text"
|
|
15
|
-
class="form-control"
|
|
16
|
-
ng-model="$parent.vm.value"
|
|
17
|
-
ng-model-options="{ allowInvalid: true }"
|
|
18
|
-
placeholder="{{$parent.vm.placeholder}}"
|
|
19
|
-
ng-pattern="/^[_A-Za-z][_A-Za-z0-9]*$/"
|
|
20
|
-
ng-change="$parent.vm.onValueChange()"
|
|
21
|
-
required
|
|
22
|
-
>
|
|
23
|
-
<span class="text-sizer"></span>
|
|
24
|
-
<c8y-error-feedback field="$parent.inplaceInputForm.value" check-on-dirty="true">
|
|
25
|
-
<span ng-message="pattern" translate>
|
|
26
|
-
Only letters, digits and underscore allowed, must not start with a digit.
|
|
27
|
-
</span>
|
|
28
|
-
</c8y-error-feedback>
|
|
29
|
-
</div>
|
|
30
|
-
</edit>
|
|
31
|
-
</c8y-inplace-input>
|
|
32
|
-
</h1>
|
|
33
|
-
|
|
34
|
-
<c8y-breadcrumbs-set>
|
|
35
|
-
<c8y-breadcrumbs-item
|
|
36
|
-
path="#/{{vm.RULES_LIST}}"
|
|
37
|
-
label="{{'Event processing' | translate}}"
|
|
38
|
-
icon="c8y-event-processing"
|
|
39
|
-
></c8y-breadcrumbs-item>
|
|
40
|
-
</c8y-breadcrumbs-set>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(e,s){var n=this,t={example:null};_.assign(n,{previewEditorOptions:{mode:"sql",useWrapMode:!0},examples:e,selection:t,filter:function(o){return function(e){var n=_.toLower(o),t=_.toLower(s.getString(e.name)),l=_.toLower(e.value);return!n||_.includes(t,o)||_.includes(l,o)}},select:function(e){t.example=e},isSelected:function(e){return t.example===e},append:function(){n.modalInstance.close(t.example)},cancel:function(){n.modalInstance.dismiss()}})}e.$inject=["c8yCepModuleExamples","gettextCatalog"],angular.module("c8y.eventProcessing").component("c8yEventProcessingRulesExamples",{bindings:{resolve:"<",modalInstance:"<"},templateUrl:":::PLUGIN_PATH:::/details/eventProcessingRulesExamples.html",controller:e,controllerAs:"vm"})}();
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<div class="viewport-modal">
|
|
2
|
-
<div class="modal-header">
|
|
3
|
-
<h3 id="modal-title" translate>Event processing rules examples</h3>
|
|
4
|
-
</div>
|
|
5
|
-
<div class="p-l-16 p-r-16">
|
|
6
|
-
<form class="row d-flex">
|
|
7
|
-
<div class="col-sm-6 d-flex d-col">
|
|
8
|
-
<div class="p-l-8 p-r-8 p-b-16">
|
|
9
|
-
<div class="input-group input-group-search">
|
|
10
|
-
<input
|
|
11
|
-
type="search"
|
|
12
|
-
class="form-control"
|
|
13
|
-
placeholder="{{ 'Search in examples' | translate }}…"
|
|
14
|
-
ng-model="vm.filterText"
|
|
15
|
-
/>
|
|
16
|
-
<span class="input-group-addon">
|
|
17
|
-
<i c8y-icon="search" ng-show="vm.filterText.length === 0 || !vm.filterText"></i>
|
|
18
|
-
<i
|
|
19
|
-
c8y-icon="times"
|
|
20
|
-
class="text-muted"
|
|
21
|
-
ng-show="vm.filterText.length > 0"
|
|
22
|
-
ng-click="vm.filterText = ''"
|
|
23
|
-
></i>
|
|
24
|
-
</span>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="modal-inner-scroll" id="modal-body">
|
|
28
|
-
<div class="p-l-8 p-t-0">
|
|
29
|
-
<div class="list-group">
|
|
30
|
-
<div
|
|
31
|
-
ng-repeat="example in vm.examples | filter:vm.filter(vm.filterText)"
|
|
32
|
-
class="list-group-item interact"
|
|
33
|
-
ng-class="{ active: vm.isSelected(example) }"
|
|
34
|
-
ng-click="vm.select(example)"
|
|
35
|
-
>
|
|
36
|
-
<div class="d-flex">
|
|
37
|
-
<span class="list-group-icon m-r-4">
|
|
38
|
-
<i c8y-icon="terminal"></i>
|
|
39
|
-
</span>
|
|
40
|
-
<span title="{{ example.name | translate }}">
|
|
41
|
-
{{ example.name | translate }}
|
|
42
|
-
</span>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
<div class="col-sm-6 d-flex d-col">
|
|
50
|
-
<div class="d-contents">
|
|
51
|
-
<div class="legend m-t-8 m-b-16 p-b-8 form-block" translate>Preview</div>
|
|
52
|
-
<div
|
|
53
|
-
class="fit-h"
|
|
54
|
-
style="min-height: 240px"
|
|
55
|
-
ui-ace="vm.previewEditorOptions"
|
|
56
|
-
ng-model="vm.selection.example.value"
|
|
57
|
-
readonly
|
|
58
|
-
></div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</form>
|
|
62
|
-
</div>
|
|
63
|
-
<div class="modal-footer">
|
|
64
|
-
<button
|
|
65
|
-
title="{{ 'Cancel' | translate }}"
|
|
66
|
-
type="button"
|
|
67
|
-
class="btn btn-default"
|
|
68
|
-
ng-click="vm.cancel()"
|
|
69
|
-
>
|
|
70
|
-
{{ 'Cancel' | translate }}
|
|
71
|
-
</button>
|
|
72
|
-
<button
|
|
73
|
-
title="{{ 'Append' | translate }}"
|
|
74
|
-
type="button"
|
|
75
|
-
class="btn btn-primary"
|
|
76
|
-
ng-click="vm.append()"
|
|
77
|
-
ng-disabled="!vm.selection.example"
|
|
78
|
-
>
|
|
79
|
-
{{ 'Append' | translate }}
|
|
80
|
-
</button>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(t){_.forEach({"/eventprocessing":{template:"<c8y-event-processing-rules-list />"},"/eventprocessing/new":{template:"<c8y-event-processing-rule-details />"},"/eventprocessing/:moduleId":{template:"<c8y-event-processing-rule-details />"}},function(e,n){t.when(n,e)})}function n(e,n){function t(e){return e.getPermissions().then(function(e){return e.canRead||e.canAdmin})}t.$inject=["eventProcessingSvc"],e.addNavigation({parent:n("Business rules"),name:n("Event processing"),path:"eventprocessing",icon:"c8y-event-processing",priority:3e3,routerLinkExact:!1,showIf:t})}n.$inject=["c8yNavigator","gettext"],e.$inject=["c8yViewsProvider"],angular.module("c8y.eventProcessing",[]).config(e).run(n)}();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(n,t,o,s,i,e,l,u){var r=this,c={DEPLOYED:{text:l("Deployed"),icon:"check-circle",cls:"text-success"},NOT_DEPLOYED:{text:l("Not deployed"),icon:"ban",cls:"text-warning"}};function a(e){return n.modules||(n.modules=[]),e.forEach(function(e){n.modules.push(e)}),n.paging=e.paging,n.modules.length}function g(e){return o.listWithSmartRules(e)}function d(){var e=_.get(n,"modules.length"),t={title:l("Event processing rules"),subtitle:_.isUndefined(e)?"":u.getPlural(e,"1 rule","{{$count}} rules",{})};i.changeTitle(t)}n.detail=function(e){t.path("/eventprocessing/".concat(e.id))},n.add=function(){t.path("/eventprocessing/new")},n.onClickDelete=function(e){s({title:l("Delete rule"),body:u.getString('You are about to delete the rule "{{name}}". Do you want to proceed?',e),labels:{ok:l("Delete")},status:"danger"}).then(angular.bind(o,o.remove,e)).then(_.partial(_.pull,n.modules,e)).then(d)},n.status=function(e){return c[e.status].text},n.statusIcon=function(e){return c[e.status].icon},n.statusClass=function(e){return c[e.status].cls},n.refresh=function(){n.refreshLoading=!0,g().then(function(e){return n.modules=null,n.refreshLoading=!1,e}).then(a).then(d)},n.loadNext=function(){n.paging.loading=!0,n.paging.next().then(a).then(d).finally(function(){n.paging.loading=!1})},n.isSmartRuleModule=o.isSmartRuleModule,e.redirectToRootIfPluginDisabled().then(g).then(a).then(d),e.getPermissions().then(function(e){return _.assign(r,{permissions:e})})}e.$inject=["$scope","$location","c8yCepModule","c8yModal","c8yTitle","eventProcessingSvc","gettext","gettextCatalog"],angular.module("c8y.eventProcessing").component("c8yEventProcessingRulesList",{templateUrl:":::PLUGIN_PATH:::/list/eventProcessingRulesList.html",controller:e,controllerAs:"vm"})}();
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
<c8y-ui-action-bar-set>
|
|
2
|
-
<li class="navbar-form hidden-xs" action-bar-position="left">
|
|
3
|
-
<c8y-list-display-control
|
|
4
|
-
list-length="modules.length"
|
|
5
|
-
on-list-class-change="vm.listClass = listClass"
|
|
6
|
-
></c8y-list-display-control>
|
|
7
|
-
</li>
|
|
8
|
-
|
|
9
|
-
<li class="navbar-form" action-bar-position="left">
|
|
10
|
-
<div class="input-group input-group-search">
|
|
11
|
-
<input
|
|
12
|
-
class="form-control"
|
|
13
|
-
title="{{ 'Filter event processing rules' | translate }}…"
|
|
14
|
-
type="search"
|
|
15
|
-
placeholder="{{ 'Filter' | translate }}…"
|
|
16
|
-
ng-model="vm.searchString"
|
|
17
|
-
/>
|
|
18
|
-
<span class="input-group-addon">
|
|
19
|
-
<i c8y-icon="search" ng-if="vm.searchString.length === 0 || !vm.searchString"></i>
|
|
20
|
-
<i
|
|
21
|
-
class="text-muted"
|
|
22
|
-
c8y-icon="times"
|
|
23
|
-
ng-if="vm.searchString.length > 0"
|
|
24
|
-
ng-click="vm.searchString = ''"
|
|
25
|
-
></i>
|
|
26
|
-
</span>
|
|
27
|
-
</div>
|
|
28
|
-
</li>
|
|
29
|
-
|
|
30
|
-
<li action-bar-position="right">
|
|
31
|
-
<button
|
|
32
|
-
class="btn btn-link"
|
|
33
|
-
type="button"
|
|
34
|
-
title="{{ 'Add rule' | translate }}"
|
|
35
|
-
ng-click="add()"
|
|
36
|
-
ng-disabled="!vm.permissions.canAdmin"
|
|
37
|
-
>
|
|
38
|
-
<i c8y-icon="plus-circle"></i>
|
|
39
|
-
<span>{{ 'Add rule' | translate }}</span>
|
|
40
|
-
</button>
|
|
41
|
-
</li>
|
|
42
|
-
|
|
43
|
-
<c8y-refresh-btn></c8y-refresh-btn>
|
|
44
|
-
</c8y-ui-action-bar-set>
|
|
45
|
-
|
|
46
|
-
<!-- Empty state -->
|
|
47
|
-
<c8y-ui-empty-state
|
|
48
|
-
ng-if="modules.length === 0"
|
|
49
|
-
[icon]="'c8y-event-processing'"
|
|
50
|
-
[title]="'No event processing rules to display.' | translate"
|
|
51
|
-
[subtitle]="'Click below to add your first event processing rule.' | translate"
|
|
52
|
-
>
|
|
53
|
-
<button
|
|
54
|
-
class="btn btn-primary"
|
|
55
|
-
type="button"
|
|
56
|
-
title="{{ 'Add rule' | translate }}"
|
|
57
|
-
ng-click="add()"
|
|
58
|
-
>
|
|
59
|
-
{{ 'Add rule' | translate }}
|
|
60
|
-
</button>
|
|
61
|
-
</c8y-ui-empty-state>
|
|
62
|
-
|
|
63
|
-
<!-- No results empty state -->
|
|
64
|
-
<c8y-ui-empty-state
|
|
65
|
-
ng-if="filtered.length === 0 && vm.searchString.length > 0"
|
|
66
|
-
[icon]="'search'"
|
|
67
|
-
[title]="'No results to display.' | translate"
|
|
68
|
-
[subtitle]="'Refine your search terms or check your spelling.' | translate"
|
|
69
|
-
></c8y-ui-empty-state>
|
|
70
|
-
|
|
71
|
-
<div class="card-group" ng-class="vm.listClass">
|
|
72
|
-
<div class="page-sticky-header hidden-xs" ng-if="modules.length > 0">
|
|
73
|
-
<div class="d-flex">
|
|
74
|
-
<div class="card-header card-column-30">
|
|
75
|
-
<div class="card-icon"></div>
|
|
76
|
-
<span translate>Rule</span>
|
|
77
|
-
</div>
|
|
78
|
-
<div class="card-block">
|
|
79
|
-
<div class="card-column-50">
|
|
80
|
-
<span translate>Last modified</span>
|
|
81
|
-
</div>
|
|
82
|
-
<div class="card-column-50">
|
|
83
|
-
<span translate>Status</span>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div class="card-actions-group">
|
|
87
|
-
<div class="btn btn-xs invisible" style="cursor: default"></div>
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<div
|
|
93
|
-
class="col-xs-12 col-sm-6 col-md-4"
|
|
94
|
-
ng-repeat="module in modules | orderBy:'name' | filter:vm.searchString as filtered"
|
|
95
|
-
>
|
|
96
|
-
<div class="card" ng-click="detail(module)">
|
|
97
|
-
<div class="card-actions" ng-click="$event.stopPropagation()">
|
|
98
|
-
<div class="dropdown settings" is-open uib-dropdown dropdown-append-to-body>
|
|
99
|
-
<button
|
|
100
|
-
class="dropdown-toggle c8y-dropdown btn-link"
|
|
101
|
-
type="button"
|
|
102
|
-
title="{{ 'Actions' | translate }}"
|
|
103
|
-
uib-dropdown-toggle
|
|
104
|
-
aria-haspopup="true"
|
|
105
|
-
>
|
|
106
|
-
<i c8y-icon="ellipsis-v"></i>
|
|
107
|
-
</button>
|
|
108
|
-
<ul class="dropdown-menu dropdown-menu-right" uib-dropdown-menu>
|
|
109
|
-
<li>
|
|
110
|
-
<button title="{{ 'Edit' | translate }}" type="button" ng-click="detail(module)">
|
|
111
|
-
<i c8y-icon="pencil"></i>
|
|
112
|
-
{{ 'Edit' | translate }}
|
|
113
|
-
</button>
|
|
114
|
-
</li>
|
|
115
|
-
<li ng-if="vm.permissions.canAdmin">
|
|
116
|
-
<button
|
|
117
|
-
title="{{ 'Delete' | translate }}"
|
|
118
|
-
type="button"
|
|
119
|
-
ng-show="!isSmartRuleModule(module)"
|
|
120
|
-
ng-click="onClickDelete(module)"
|
|
121
|
-
>
|
|
122
|
-
<i c8y-icon="delete"></i>
|
|
123
|
-
{{ 'Delete' | translate }}
|
|
124
|
-
</button>
|
|
125
|
-
</li>
|
|
126
|
-
</ul>
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div class="card-header separator card-column-30">
|
|
131
|
-
<div class="card-icon">
|
|
132
|
-
<i c8y-icon="c8y-event-processing" class="c8y-icon-duocolor"></i>
|
|
133
|
-
</div>
|
|
134
|
-
<div class="card-title btn-clean" title="{{ module.name }}">
|
|
135
|
-
{{ module.name }}
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
<div class="card-block">
|
|
140
|
-
<div class="d-flex">
|
|
141
|
-
<div class="card-column-50 flex-grow">
|
|
142
|
-
<div class="d-flex">
|
|
143
|
-
<div>
|
|
144
|
-
<span></span>
|
|
145
|
-
</div>
|
|
146
|
-
<div class="text-muted" title="{{ 'Last modified' | translate }}">
|
|
147
|
-
<i c8y-icon="calendar"></i>
|
|
148
|
-
<small>
|
|
149
|
-
{{ module.lastModified | absoluteDate }}
|
|
150
|
-
</small>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
<div class="card-column-50">
|
|
155
|
-
<span class="text-label-small m-r-4">
|
|
156
|
-
{{ 'Status' | translate }}
|
|
157
|
-
</span>
|
|
158
|
-
<button
|
|
159
|
-
class="btn-clean"
|
|
160
|
-
type="button"
|
|
161
|
-
aria-label="{{ status(module) }}"
|
|
162
|
-
uib-tooltip="{{ status(module) }}"
|
|
163
|
-
tooltip-popup-delay="500"
|
|
164
|
-
tooltip-append-to-body="true"
|
|
165
|
-
>
|
|
166
|
-
<i c8y-icon="{{ statusIcon(module) }}" ng-class="statusClass(module)"></i>
|
|
167
|
-
</button>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</div>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
|
|
175
|
-
<c8y-load-more></c8y-load-more>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(n,t,r,c,i,a,e){var u="c8y_CepAgent";return{getPermissions:function(){return t.all({canRead:o(),canAdmin:function(){var e={canRead:o(),userCanAdmin:r.hasAnyRole(["ROLE_CEP_MANAGEMENT_ADMIN"]),featureSubscribed:c.isAvailable({name:"feature-cep-custom-rules"})};return t.all(e).then(function(e){return e.canRead&&e.userCanAdmin&&e.featureSubscribed})}()})},redirectToRootIfPluginDisabled:function(){return o().then(s)},getModuleMetrics:function(e){var t,n=_.get(e,"name"),r="".concat(n,":");return l().then(function(e){return(t=e)?a.getSupportedMeasurements(t):[]}).then(function(e){return _.compact(_.map(e,function(e){var n;return _.startsWith(e,r)&&(n={deviceId:t.id,fragment:e,statement:_.last(e.split(":"))}),n}))})},getAlarmListFilters:function(e){var n="".concat(e.name,":");return l().then(function(e){return{source:e.id,orderMode:"ACTIVE_FIRST",displayFilter:function(e){return _.includes(e.type,n)}}})}};function o(){var e={cepMicroserviceAvailable:i.shouldShowEventProcessing(),userCanRead:r.hasAnyRole(["ROLE_CEP_MANAGEMENT_READ"])};return t.all(e).then(function(e){return e.cepMicroserviceAvailable&&e.userCanRead})}function s(e){return e?t.when(!0):(n.path("/"),t.reject())}function l(){return e.current().then(function(e){return a.list({fragmentType:"".concat(u,"_").concat(e.name)})}).then(_.first)}}e.$inject=["$location","$q","c8yPermissions","c8yApplication","c8yUiUtil","c8yInventory","c8yTenant"],angular.module("c8y.eventProcessing").factory("eventProcessingSvc",e)}();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function t(l,d,f,t){var m="cep/modules",p="cepModule",n={};return{list:function t(e){var n=f.url(m);var r=f.pageSizeFilter(e);var a={params:r};var u=f.cleanListCallback("modules",t,r);return l.get(n,a).then(o).then(u)},listWithSmartRules:u,isSmartRuleModule:e,detail:c,save:r,changeName:function(t,e){return c(t).then(function(t){return t.name=e,t}).then(r)},remove:function(t){var e=t.id||t,n=f.url("".concat(m,"/").concat(e));return l.delete(n)},examples:function(){return d.when(t)},detailByName:a,createOrDeploy:function(t){var e=t.name;n[e]||(n[e]=a(e).then(function(t){return"DEPLOYED"!==t.status?(t.status="DEPLOYED",r(t)):t},function(){return r(t)}));return n[e]},deploy:s,redeploy:function(t){return i(t).then(s)},undeploy:i};function o(t){return t.data.modules=_.filter(t.data.modules,_.negate(e)),t}function e(t){return t&&/^smartRule\d+$/.test(t.name)}function u(t){var e=f.url(m),n=f.pageSizeFilter(t),r={params:n},a=f.cleanListCallback("modules",u,n);return l.get(e,r).then(a)}function c(t,e,n){var r=t.id||t,a=f.url("".concat(m,"/").concat(r)),u=d.defer(),o=null,c=null,s=_.assign({headers:{"Content-Type":"text/plain",Accept:"text/plain"}},n),i=_.assign({headers:{Accept:f.mimeType(p)}},e);return l.get(a,i).then(function(t){c=t.data,l.get("".concat(a,"?text"),s).then(function(t){o=t.data,function(){if(o&&c){var t=/module (\w*);\s*\n*/;c.name=o.match(t)[1],c.body=o.replace(t,""),u.resolve(c)}}()})}),u.promise}function r(t,n){var r=d.defer(),a=_.cloneDeep(t);return(a.body?(a.name&&(a.body="module ".concat(a.name,";\n").concat(a.body)),function(t,e){var n=t.id,r=f.url(m+(n?"/".concat(n):"")),a=n?"put":"post",u=_.assign(f.contentHeaders(p,!0),{"Content-Type":"text/plain"}),o=_.assign({headers:u},e);return l[a](r,t.body,o)}(a,n).then(null,function(t){return r.reject(t),d.reject()})):c(a,n,n)).then(function(t){var e=t.body?t:t.data;a.status&&e.status!==a.status?(e.status=a.status,function(t,e){var n=f.url("".concat(m,"/").concat(t.id)),r=_.assign({headers:f.contentHeaders(p,!0)},e),a={status:t.status};if(!t.id)throw new Error("Module id no defined");return l.put(n,a,r)}(e,n).then(function(t){r.resolve(t.data)},function(t){r.reject(t.data)})):r.resolve(e)}),r.promise}function a(e){return u().then(function(t){return _.find(t,{name:e})||d.reject("not found")})}function s(t){return t.status="DEPLOYED",r(t)}function i(t){return t.status="NOT_DEPLOYED",r(t)}}t.$inject=["$http","$q","c8yBase","c8yCepModuleExamples"],angular.module("c8y.core").factory("c8yCepModule",t)}();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(e){return[{name:e("Change the severities of alarms based on activity time"),value:'/* Create "context" - definition of a group of events to be processed separately.\n * Context "Alarms" consists of AlarmCreated and AlarmUpdated: \n * with the same source and type = "power off". */\ncreate context Alarms partition by \nalarm.source from AlarmCreated(alarm.type = "power off"),\nalarm.source from AlarmUpdated(alarm.type = "power off");\n\n/* Update severity for all active AlarmCreated \n * after which there is no change to other status in 15 minutes. */\ncontext Alarms \ninsert into UpdateAlarm \nselect \n a.alarm.id as id,\n "MAJOR" as severity\nfrom pattern [\n every a = AlarmCreated(alarm.status = CumulocityAlarmStatuses.ACTIVE) \n -> (timer:interval(15 minutes) \n and not AlarmUpdated(alarm.status != CumulocityAlarmStatuses.ACTIVE))\n];'},{name:e("Create alarm if temperature was too low for 15 minutes"),value:'create schema NotZeroMeasurementCreated (\n measurement Measurement\n);\ncreate schema ZeroMeasurementCreated (\n measurement Measurement\n);\ncreate schema CheckTimeDifference (\n firstMeasurement Measurement,\n lastMeasurement Measurement\n);\ninsert into CreateAlarm\n select\n check.lastMeasurement.source as source,\n check.lastMeasurement.time as time,\n "c8y_LowTemperatureAlarm" as type,\n CumulocitySeverities.WARNING as severity,\n CumulocityAlarmStatuses.ACTIVE as status,\n "Temperature was too low for more than 15 minutes" as text\n from CheckTimeDifference check\n where check.lastMeasurement.time.after(check.firstMeasurement.time, 15min);\ninsert into CheckTimeDifference\n select\n firstZero.measurement as firstMeasurement,\n firstNotZeroAgain.measurement as lastMeasurement\n from pattern [\n every (lastNotZero = NotZeroMeasurementCreated ->\n firstZero = ZeroMeasurementCreated(measurement.source.value = lastNotZero.measurement.source.value)) ->\n ZeroMeasurementCreated until firstNotZeroAgain = NotZeroMeasurementCreated(measurement.source.value = lastNotZero.measurement.source.value)\n ];\ninsert into NotZeroMeasurementCreated\n select\n m.measurement as measurement\n from\n MeasurementCreated m\n where getNumber(m, "c8y_TemperatureMeasurement.T.value") > 0\n AND m.measurement.type = "c8y_TemperatureMeasurement";\ninsert into ZeroMeasurementCreated\n select\n m.measurement as measurement\n from\n MeasurementCreated m\n where getNumber(m, "c8y_TemperatureMeasurement.T.value") <= 0\n AND m.measurement.type = "c8y_TemperatureMeasurement";'},{name:e("Create alarm on not processed operation"),value:'create constant variable int operation_timeout_in_seconds = 300; \ncreate constant variable string alarm_severity = "MAJOR"; \ncreate constant variable string alarm_text = "Operation with id=#{id.value} haven\'t been finished!"; \ncreate constant variable string alarm_type = "c8y_OperationNotFinished"; \ncreate schema OperationNotFinished ( operation com.cumulocity.model.operation.Operation ); \ncreate schema OperationFinished ( operation com.cumulocity.model.operation.Operation, alarm Alarm); \n@Name("create_alarm_from_not_finished_operation")\ninsert into CreateAlarm\n select \n operation.deviceId as source,\n "ACTIVE" as status,\n alarm_severity as severity,\n alarm_type as type,\n current_timestamp().toDate() as time,\n replaceAllPlaceholders(alarm_text, operation) as text,\n { "operationId", operation.id.value } as fragments \n from OperationNotFinished;\n@Name("handle_not_finished_operation")\ninsert into OperationNotFinished\n select\n prevOp.operation as operation\n from pattern [ \n every prevOp = OperationCreated \n -> (timer:interval(operation_timeout_in_seconds second)\n and not OperationUpdated(\n operation.id.value = prevOp.operation.id.value\n and (operation.status in (OperationStatus.SUCCESSFUL, OperationStatus.FAILED))\n )) ];\n'},{name:e("Create alarm when temperature below 0 degree"),value:'insert into CreateAlarm \n select\n e.measurement.time as time,\n e.measurement.source.value as source,\n "com_cumulocity_TemperatureAlert" as type,\n "Temperature too low" as text,\n "ACTIVE" as status,\n "CRITICAL" as severity\n from MeasurementCreated e\n where getNumber(e, "c8y_TemperatureMeasurement.T.value") < 0'},{name:e("Create alarm when temperature over 100 degree"),value:'insert into CreateAlarm \n select\n e.measurement.time as time,\n e.measurement.source.value as source,\n "com_cumulocity_TemperatureAlert" as type,\n "Temperature too high" as text,\n "ACTIVE" as status,\n "CRITICAL" as severity\n from MeasurementCreated e\n where getNumber(e, "c8y_TemperatureMeasurement.T.value") > 100'},{name:e("Create close relay operation when temperature readings over 100 degree"),value:'insert into CreateOperation\n select\n "PENDING" as status,\n «heating ID» as deviceId,\n {\n "c8y_Relay.relayState", "CLOSED"\n } as fragments\n from MeasurementCreated e\n where getNumber(e, "c8y_TemperatureMeasurement.T.value") > 100'},{name:e("Display current temperature on device"),value:'expression string js:prepareText(temp) [\n function format(text, params){\n for(param in params) {\n text = text.replace("{" + param + "}", params[param])\n }\n return text\n }\n format("Current temperature is {0}", [temp])\n]\ninsert into CreateOperation\n select\n "PENDING" as status,\n e.measurement.source.value as deviceId,\n { "c8y_Message.text", prepareText(\n getNumber(e, "c8y_TemperatureMeasurement.T.value")\n ) } as fragments\n from MeasurementCreated e\n where e.measurement.type = "c8y_TemperatureMeasurement";'},{name:e("Schedule device restart every day at 1am"),value:'insert into CreateOperation\nselect\n "PENDING" as status,\n «device ID» as deviceId,\n { "c8y_Restart", {} } as fragments\nfrom pattern [every timer:at(*, 1, *, *, *, *)];'},{name:e("Select location change event once for 60 seconds"),value:'select * from EventCreated e\nwhere getObject(e, "c8y_LocationMeasurement") is not null\noutput first every 60 seconds'},{name:e("Select temperature readings over 100 degree"),value:'select * from MeasurementCreated e\nwhere getNumber(e, "c8y_TemperatureMeasurement.T.value") > 100'},{name:e("Send alarms that are active since 30 minutes to email"),value:'insert into SendEmail\nselect\n "<RECEIVER@COMPANY.COM>" as receiver,\n "Alarm active since 30 mins: " || e.alarm.text as subject,\n "Time: " || e.alarm.time.format() || \n " Severity: " || e.alarm.severity.name() || \n " Source: " || findManagedObjectById(e.alarm.source.value).getName() as text,\n "<REPLY_TO@COMPANY.COM>" as replyTo\nfrom pattern [\n every e = AlarmCreated(alarm.status = CumulocityAlarmStatuses.ACTIVE, alarm.severity = CumulocitySeverities.CRITICAL) \n -> (timer:interval(30 minutes) \n and not AlarmUpdated(alarm.status != CumulocityAlarmStatuses.ACTIVE, alarm.id.value = e.alarm.id.value))\n];'},{name:e("Send sales to Zapier"),value:'@Name("sales")\nselect\n getString(e, "com_nsn_startups_vendme_fragments_SalesReportInfo.vendingMachine_name") as id,\n getString(e, "com_nsn_startups_vendme_fragments_SalesReportInfo.product_name") as name,\n e.event.time.format() as time,\n getNumber(e, "com_nsn_startups_vendme_fragments_SalesReportInfo.totalPaid") as value,\n getString(e, "com_nsn_startups_vendme_fragments_SalesReportInfo.payment_type") as text\nfrom EventCreated e\n where e.event.type = "com_nsn_startups_vendme_LiveSalesReport"\n'},{name:e("Send simulator temperature to Zapier"),value:'@Name("simulatortemperature")\nselect\n e.measurement.source.value as id,\n findManagedObjectById(e.measurement.source.value).getName() as name,\n e.measurement.time.format() as time,\n getNumber(e, "c8y_TemperatureMeasurement.T.value") as value\nfrom MeasurementCreated e\n where e.measurement.type = "TemperatureMeasurement"\n'}]}e.$inject=["gettext"],angular.module("c8y.core").factory("c8yCepModuleExamples",e)}();
|