@c8y/ng1-modules 1018.503.93 → 1018.503.97
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.
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
<div
|
|
2
|
-
sf-array="form"
|
|
3
2
|
class="schema-form-array {{ form.htmlClass }}"
|
|
3
|
+
sf-array="form"
|
|
4
4
|
ng-model="$$value$$"
|
|
5
5
|
ng-model-options="form.ngModelOptions"
|
|
6
|
+
ng-init="visibleItems = 10"
|
|
6
7
|
>
|
|
7
|
-
<label
|
|
8
|
-
|
|
8
|
+
<label
|
|
9
|
+
class="control-label"
|
|
10
|
+
ng-show="showTitle()"
|
|
11
|
+
>
|
|
12
|
+
{{ form.title | translate }}
|
|
13
|
+
</label>
|
|
14
|
+
<ol
|
|
15
|
+
class="list-unstyled"
|
|
16
|
+
ng-model="modelArray"
|
|
17
|
+
>
|
|
9
18
|
<!--
|
|
10
19
|
Removed ui-sortable, i suppose we don't use this
|
|
11
20
|
anywhere and it only brings confusion to the UI
|
|
12
21
|
|
|
13
22
|
ui-sortable="form.uiSortable || ''"
|
|
14
23
|
-->
|
|
15
|
-
<li
|
|
24
|
+
<li
|
|
25
|
+
class="{{ form.fieldHtmlClass }}"
|
|
26
|
+
ng-repeat="item in modelArray.slice(0, visibleItems) track by $index"
|
|
27
|
+
>
|
|
16
28
|
<div class="d-flex a-i-start">
|
|
17
29
|
<sf-decorator
|
|
18
30
|
class="flex-grow"
|
|
@@ -21,27 +33,49 @@
|
|
|
21
33
|
></sf-decorator>
|
|
22
34
|
<div class="a-s-start">
|
|
23
35
|
<button
|
|
36
|
+
class="btn btn-link"
|
|
24
37
|
title="{{ 'Delete' | translate }}"
|
|
38
|
+
type="button"
|
|
25
39
|
ng-hide="form.readonly || form.remove === null"
|
|
26
40
|
ng-click="deleteFromArray($index)"
|
|
27
|
-
type="button"
|
|
28
|
-
class="btn btn-link"
|
|
29
41
|
>
|
|
30
|
-
<span
|
|
42
|
+
<span
|
|
43
|
+
class="text-danger"
|
|
44
|
+
c8y-icon="minus-circle"
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
></span>
|
|
31
47
|
</button>
|
|
32
48
|
</div>
|
|
33
49
|
</div>
|
|
34
50
|
</li>
|
|
35
51
|
</ol>
|
|
52
|
+
|
|
53
|
+
<div
|
|
54
|
+
class="p-t-8 p-b-8"
|
|
55
|
+
ng-show="visibleItems < modelArray.length"
|
|
56
|
+
>
|
|
57
|
+
<button
|
|
58
|
+
class="btn-default btn btn-block m-b-16 d-block"
|
|
59
|
+
style="border: 1px solid"
|
|
60
|
+
type="button"
|
|
61
|
+
ng-click="visibleItems = visibleItems + 10"
|
|
62
|
+
>
|
|
63
|
+
<i c8y-icon="repeat"></i>
|
|
64
|
+
<span>{{ 'Load more' | translate }}</span>
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
36
67
|
<div class="p-t-8 p-b-8">
|
|
37
68
|
<button
|
|
69
|
+
class="btn btn-xs {{ form.style.add || 'btn-default' }}"
|
|
38
70
|
title="{{ form.add || 'Add' | translate }}"
|
|
71
|
+
type="button"
|
|
39
72
|
ng-hide="form.readonly || form.add === null"
|
|
40
73
|
ng-click="appendToArray()"
|
|
41
|
-
type="button"
|
|
42
|
-
class="btn btn-xs {{ form.style.add || 'btn-default' }}"
|
|
43
74
|
>
|
|
44
|
-
<i
|
|
75
|
+
<i
|
|
76
|
+
class="m-r-4"
|
|
77
|
+
c8y-icon="plus"
|
|
78
|
+
></i>
|
|
45
79
|
{{ form.add || 'Add' | translate }}
|
|
46
80
|
</button>
|
|
47
81
|
</div>
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function e(t,e,n,i,c,l){var s,o=this,r={},d={},a=null,u={open:!1},f={text:""};function h(e){r={},d={},_.forEach(e,function(e){r[e.id]=!0,d[e.id]=!0})}function g(e){return d[e.id]}function p(e){d[e.id]=!0}function A(){return e("filter")(s,f.text)}function
|
|
1
|
+
"use strict";!function(){function e(t,e,n,i,c,l){var s,o=this,r={},d={},a=null,u={open:!1},f={text:""};function h(e){r={},d={},_.forEach(e,function(e){r[e.id]=!0,d[e.id]=!0})}function g(e){return d[e.id]}function p(e){d[e.id]=!0}function A(){return e("filter")(s,f.text)}function C(e){d[e.id]=!1}o.isSelected=g,o.selectAllVisible=function(){_.forEach(A(),p)},o.select=p,o.deselectAllVisible=function(){_.forEach(A(),C)},o.deselect=C,o.toggle=function(e){d[e.id]=!d[e.id]},o.areAllVisibleSelected=function(){var e=A();return!!e&&_.filter(e,g).length===e.length},o.getSelectedStatusText=function(){var e=_.filter(r,_.identity).length;return e===a?l.getString("All children active`assets`"):0===e?l.getString("No children active`assets`"):l.getPlural(e,"1 child active`asset`","{{$count}} children active`asset`",{})},o.apply=function(){t.onSelectionConfirmed&&t.onSelectionConfirmed({selection:_.filter(s,g)}),u.open=!1},o.filterCfg=f,o.dropdownStatus=u,t.$watch("parentMo()",function(e){o.parentMoId=e.id||e,c.detail(o.parentMoId).then(i.getResData).then(function(e){o.childAssets=_.map(e.childAssets.references,"managedObject").concat(_.map(e.childDevices.references,"managedObject")),s=o.childAssets,o.allChildAssetsCount=o.childAssets.length,a=o.allChildAssetsCount})}),t.$watch("selectedChildAssets()",h),t.$watch("ctrl.dropdownStatus.open",function(e){e&&h(t.selectedChildAssets()),n(function(){o.dropdownOpeningFinished=e})})}e.$inject=["$scope","$filter","$timeout","c8yBase","c8yInventory","gettextCatalog"],angular.module("c8y.smartRules").controller("c8yChildAssetsSelectorCtrl",e)}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function e(i,r,e,o,t,n,
|
|
1
|
+
"use strict";!function(){function e(i,r,e,o,t,n,a,j,c,u,l,s,d,f,h,g,v,m){var p,S=r.deviceId||r.groupId,A={},R={},y={done:!1,inProgress:!1},x={true:{text:v("Active"),icon:"check-circle",cls:"text-success"},false:{text:v("Inactive"),icon:"ban",cls:"text-danger"}},C=s.getContext(),b=v("Global smart rules");function I(){return o.when().then(w).then(M).then(N).then(U).then(D).catch(E)}function w(){y.inProgress=!0}function D(){y.inProgress=!1,y.done=!0,y.error=!1}function E(e){e.data&&e.data.message&&l.danger(e.data.message),y.inProgress=!1,y.done=!0,y.error=!0}function M(){return h.list().then(T)}function T(e){_.forEach(e||[],function(e){A[e.name]=e})}function N(){var e=S?g.listByContext(S):o.resolve([]),t=f.hasPermissions().then(function(e){return e?g.list():o.when([])});return o.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;S&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return O(e)&&!n.test(t)}}(S)));return t}(_.concat(e.listByContext,e.list))})}function O(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function L(e){return g.hasSource(e,S)}function U(){var e,t;return!(Array.isArray(i.rules)&&0<i.rules.length)||null===(t=s.getContext()).context?o.resolve():(e=a.childAssets(t.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}),t=a.childDevices(t.id,{params:{pageSize:2e3,withChildren:!1}}),o.all([e,t]).then(_.flatten).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=P(e)})}))}function P(t){return _.filter(i.children,function(e){return g.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:S,loadingStatus:y,refresh:I,paging:{refresh:I},ruleTemplates:A,getLinkToDM:function(){var e={deviceId:S};return t(p||"")(e)},add:function(){g.addNewWithUI().then(I)},edit:function(e){g.editWithUI(e).then(I)},clone:function(e){g.cloneWithUI(e).then(I)},remove:function(e){u({title:v("Delete smart rule"),body:m.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:v("Delete")},status:"danger"}).then(angular.bind(g,g.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return l.success(v("Smart rule deleted."))})},hasSource:L,getChildrenEnabledForSmartRule:P,toggleRuleActivationForContextMO:function(e){if(L(e))return g.deactivate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" deactivated.',e))});return g.activate(e,S,!1).then(function(){l.success(m.getString('Smart rule "{{name}}" activated.',e))})},toggleRuleActivationForChildrenMOs:function(e,n){var t=_.filter(n,function(t){return!_.find(i.ruleChildren[e.id],function(e){return e.id===t.id})}),r=_.filter(i.ruleChildren[e.id],function(t){return!_.find(n,function(e){return t.id===e.id})});return g.updateSources(e,t,r,!1).then(N).then(U).then(function(){l.success(m.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":v("Activate for this group"),"for device":v("Activate for this device"),"for object":v("Activate for this object")},deactivate:{"for group":v("Deactivate for this group"),"for device":v("Deactivate for this device"),"for object":v("Deactivate for this object")}},e=e.enabled&&L(e)?"deactivate":"activate",n=r.groupId?"group":"object";return n=r.deviceId?"device":n,t[e]["for ".concat(n)]},type:function(e){var t,e=A[e.ruleTemplateName];e&&(t=e.label.full?m.getString(e.label.full):"".concat(m.getString(e.label.input)," ").concat(m.getString(e.label.output)));return t},status:function(e){return x[e.enabled].text},statusIcon:function(e){return x[e.enabled].icon},statusClass:function(e){return x[e.enabled].cls},showTitle:function(){return null!==s.getContext().context},title:b,context:C,inputIcon:function(e){var t,e=A[e.ruleTemplateName];e&&(t=e.paramGroups.input.icon);return t},outputIcon:function(e){var t,e=A[e.ruleTemplateName];e&&(t=e.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(A,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=R.canAddRules;e&&!t&&(n=!1);_.isUndefined(n)&&(e=i.context?c.isAllowed({adminMOs:[i.context.id]}):o.all({isAllowedInventory:c.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:c.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,e=e.isAllowedSmartRules;return t&&e}),R.canAddRules=e.then(function(e){return R.canAddRules=e,R.canAddRules}),n=!1);return n},canModify:function(t){R.rules=R.rules||{};var n=R.rules,e=n[t.id];_.isUndefined(e)&&(n[t.id]=c.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canApplyOnChildren:function(e){return!O(e)},canSeeSection:function(){var e=R.canSeeSection;_.isUndefined(e)&&(R.canSeeSection=(n.checkIfModulesExist(["c8y.cockpit.config"])?f.shouldShowLocalSmartRules():o.when(!1)).then(function(e){return R.canSeeSection=e,R.canSeeSection}),e=!1);return e},isConfigurationGlobalSmartRulesContext:void 0}),i.isConfigurationGlobalSmartRulesContext=e.path().includes("/rules"),I(),null===s.getContext().context&&d.changeTitle({title:b}),"device"===C.context&&n.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$location","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
|