@c8y/ng1-modules 1018.208.0 → 1018.209.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/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,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)}();
|
package/notifications/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";!function(){function e(t,e,n,r,s){var a;function i(e){return e?n.list({severity:n.severity.MAJOR,status:n.status.ACTIVE}).then(function(e){return _.find(e,function(e){return e.c8y_ExceptionDetails})}):t.resolve(!1)}a=s.getString('Errors occurred while running event processing rules. <br> Please check the <a href="/apps/devicemanagement/#/alarms">alarms created</a> for more details.'),e.hasAllRoles(["ROLE_ALARM_READ"]).then(i).then(function(e){e&&r.add({text:a,type:"warning",allowHtml:!0})})}e.$inject=["$q","c8yPermissions","c8yAlarms","c8yAlert","gettextCatalog"],angular.module("c8y.notifications",[]).run(e)}();
|