@c8y/ng1-modules 1018.0.265 → 1018.0.268

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 class="control-label" ng-show="showTitle()">{{ form.title | translate }}</label>
8
- <ol class="list-unstyled" ng-model="modelArray">
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 class="{{ form.fieldHtmlClass }}" ng-repeat="item in modelArray track by $index">
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 aria-hidden="true" c8y-icon="minus-circle" class="text-danger"></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 c8y-icon="plus" class="m-r-4"></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,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.0.265",
3
+ "version": "1018.0.268",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -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 S(e){d[e.id]=!1}o.isSelected=g,o.selectAllVisible=function(){_.forEach(A(),p)},o.select=p,o.deselectAllVisible=function(){_.forEach(A(),S)},o.deselect=S,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"),s=o.childAssets,a=e.childAssets.references.length})}),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
+ "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,c,o,t,n,r,a,u,l,s,d,e,f,h,v,g,m){var p,A=c.deviceId||c.groupId,S={},R={},y={done:!1,inProgress:!1},E={true:{text:g("Active"),icon:"check-circle",cls:"text-success"},false:{text:g("Inactive"),icon:"ban",cls:"text-danger"}},I=d.getContext(),b=g("Global smart rules");function x(){return o.when().then(C).then(w).then(T).then(L).then(M).catch(N)}function C(){y.inProgress=!0}function M(){y.inProgress=!1,y.done=!0,y.error=!1}function N(e){e.data&&e.data.message&&s.danger(e.data.message),y.inProgress=!1,y.done=!0,y.error=!0}function w(){return h.list().then(D)}function D(e){_.forEach(e||[],function(e){S[e.name]=e})}function T(){var e=A?v.listByContext(A):o.resolve([]),t=f.hasPermissions().then(function(e){return e?v.list():o.when([])});return o.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;A&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return P(e)&&!n.test(t)}}(A)));return t}(_.concat(e.listByContext,e.list))})}function P(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function O(e){return v.hasSource(e,A)}function L(){return Array.isArray(i.rules)&&0<i.rules.length?function(){var e=d.getContext();return null!==e.context?r.childAssets(e.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=U(e)})}):o.resolve()}():o.resolve()}function U(t){return _.filter(i.children,function(e){return v.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:A,loadingStatus:y,refresh:x,paging:{refresh:x},ruleTemplates:S,getLinkToDM:function(){var e={deviceId:A};return t(p||"")(e)},add:function(){v.addNewWithUI().then(x)},edit:function(e){v.editWithUI(e).then(x)},clone:function(e){v.cloneWithUI(e).then(x)},remove:function(e){l({title:g("Delete smart rule"),body:m.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:g("Delete")},status:"danger"}).then(angular.bind(v,v.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return s.success(g("Smart rule deleted."))})},hasSource:O,getChildrenEnabledForSmartRule:U,toggleRuleActivationForContextMO:function(e){if(O(e))return v.deactivate(e,A,!1).then(function(){s.success(m.getString('Smart rule "{{name}}" deactivated.',e))});return v.activate(e,A,!1).then(function(){s.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 v.updateSources(e,t,r,!1).then(T).then(L).then(function(){s.success(m.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":g("Activate for this group"),"for device":g("Activate for this device"),"for object":g("Activate for this object")},deactivate:{"for group":g("Deactivate for this group"),"for device":g("Deactivate for this device"),"for object":g("Deactivate for this object")}},n=e.enabled&&O(e)?"deactivate":"activate",r=c.groupId?"group":"object";return r=c.deviceId?"device":r,t[n]["for ".concat(r)]},type:function(e){var t,n=S[e.ruleTemplateName];n&&(t=n.label.full?m.getString(n.label.full):"".concat(m.getString(n.label.input)," ").concat(m.getString(n.label.output)));return t},status:function(e){return E[e.enabled].text},statusIcon:function(e){return E[e.enabled].icon},statusClass:function(e){return E[e.enabled].cls},showTitle:function(){return null!==d.getContext().context},title:b,context:I,inputIcon:function(e){var t,n=S[e.ruleTemplateName];n&&(t=n.paramGroups.input.icon);return t},outputIcon:function(e){var t,n=S[e.ruleTemplateName];n&&(t=n.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(S,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=R.canAddRules;e&&!t&&(n=!1);if(_.isUndefined(n)){var r;r=i.context?u.isAllowed({adminMOs:[i.context.id]}):o.all({isAllowedInventory:u.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:u.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,n=e.isAllowedSmartRules;return t&&n}),R.canAddRules=r.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]=u.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canInspect:function(){var e=R.canInspect;_.isUndefined(e)&&(R.canInspect=o.all({administrationAccess:a.listByUser().then(function(e){return!!_.find(e,{contextPath:"administration"})}),eventProcessingAccess:u.isAllowed({anyRole:["ROLE_CEP_MANAGEMENT_READ","ROLE_CEP_MANAGEMENT_ADMIN"]}),eventProcessingEnabled:v.eventProcessingEnabled()}).then(function(e){return R.canInspect=e.administrationAccess&&e.eventProcessingAccess&&e.eventProcessingEnabled,R.canInspect}),e=!1);return e},canApplyOnChildren:function(e){return!P(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}}),x(),null===d.getContext().context&&e.changeTitle({title:b}),"device"===I.context&&n.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();
1
+ "use strict";!function(){function e(i,c,o,t,n,r,a,u,l,s,d,e,f,h,v,g,m){var p,A=c.deviceId||c.groupId,S={},R={},y={done:!1,inProgress:!1},E={true:{text:g("Active"),icon:"check-circle",cls:"text-success"},false:{text:g("Inactive"),icon:"ban",cls:"text-danger"}},I=d.getContext(),b=g("Global smart rules");function x(){return o.when().then(C).then(w).then(T).then(L).then(M).catch(N)}function C(){y.inProgress=!0}function M(){y.inProgress=!1,y.done=!0,y.error=!1}function N(e){e.data&&e.data.message&&s.danger(e.data.message),y.inProgress=!1,y.done=!0,y.error=!0}function w(){return h.list().then(D)}function D(e){_.forEach(e||[],function(e){S[e.name]=e})}function T(){var e=A?v.listByContext(A):o.resolve([]),t=f.hasPermissions().then(function(e){return e?v.list():o.when([])});return o.all({listByContext:e,list:t}).then(function(e){i.rules=function(e){var t=e;A&&(t=_.reject(e,function(e){var n=new RegExp("".concat(e,"/dashboard"));return function(e){var t=_.get(e,"config.url","");return P(e)&&!n.test(t)}}(A)));return t}(_.concat(e.listByContext,e.list))})}function P(e){return"sendDashboardsViaEmail"===e.ruleTemplateName}function O(e){return v.hasSource(e,A)}function L(){return Array.isArray(i.rules)&&0<i.rules.length?function(){var e=d.getContext();if(null===e.context)return o.resolve();var t=r.childAssets(e.id,{skipDetail:!0,params:{pageSize:2e3,withChildren:!1}}),n=r.childDevices(e.id,{params:{pageSize:2e3,withChildren:!1}});return o.all([t,n]).then(_.flatten).then(function(e){i.children=e}).then(function(){i.ruleChildren={},_.forEach(i.rules,function(e){i.ruleChildren[e.id]=U(e)})})}():o.resolve()}function U(t){return _.filter(i.children,function(e){return v.hasSource(t,e)})}_.assign(i,{isOpen:{},moId:A,loadingStatus:y,refresh:x,paging:{refresh:x},ruleTemplates:S,getLinkToDM:function(){var e={deviceId:A};return t(p||"")(e)},add:function(){v.addNewWithUI().then(x)},edit:function(e){v.editWithUI(e).then(x)},clone:function(e){v.cloneWithUI(e).then(x)},remove:function(e){l({title:g("Delete smart rule"),body:m.getString('You are about to delete smart rule "{{name}}". Do you want to proceed?',e),labels:{ok:g("Delete")},status:"danger"}).then(angular.bind(v,v.remove,e)).then(function(){return _.pull(i.rules,e)}).then(function(){return s.success(g("Smart rule deleted."))})},hasSource:O,getChildrenEnabledForSmartRule:U,toggleRuleActivationForContextMO:function(e){if(O(e))return v.deactivate(e,A,!1).then(function(){s.success(m.getString('Smart rule "{{name}}" deactivated.',e))});return v.activate(e,A,!1).then(function(){s.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 v.updateSources(e,t,r,!1).then(T).then(L).then(function(){s.success(m.getString('Smart rule "{{name}}" activated/deactivated for children.',e))})},tooltip:function(e){var t={activate:{"for group":g("Activate for this group"),"for device":g("Activate for this device"),"for object":g("Activate for this object")},deactivate:{"for group":g("Deactivate for this group"),"for device":g("Deactivate for this device"),"for object":g("Deactivate for this object")}},n=e.enabled&&O(e)?"deactivate":"activate",r=c.groupId?"group":"object";return r=c.deviceId?"device":r,t[n]["for ".concat(r)]},type:function(e){var t,n=S[e.ruleTemplateName];n&&(t=n.label.full?m.getString(n.label.full):"".concat(m.getString(n.label.input)," ").concat(m.getString(n.label.output)));return t},status:function(e){return E[e.enabled].text},statusIcon:function(e){return E[e.enabled].icon},statusClass:function(e){return E[e.enabled].cls},showTitle:function(){return null!==d.getContext().context},title:b,context:I,inputIcon:function(e){var t,n=S[e.ruleTemplateName];n&&(t=n.paramGroups.input.icon);return t},outputIcon:function(e){var t,n=S[e.ruleTemplateName];n&&(t=n.paramGroups.output.icon);return t},canAddRules:function(e){var t=_.get(S,"".concat(_.get(e,"ruleTemplateName"),"._active")),n=R.canAddRules;e&&!t&&(n=!1);if(_.isUndefined(n)){var r;r=i.context?u.isAllowed({adminMOs:[i.context.id]}):o.all({isAllowedInventory:u.isAllowed({anyRole:["ROLE_INVENTORY_ADMIN","ROLE_MANAGED_OBJECT_ADMIN"]}),isAllowedSmartRules:u.isAllowed({anyRole:["ROLE_SMARTRULE_ADMIN","ROLE_CEP_MANAGEMENT_ADMIN"]})}).then(function(e){var t=e.isAllowedInventory,n=e.isAllowedSmartRules;return t&&n}),R.canAddRules=r.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]=u.isAllowed({adminMOs:[t.id]}).then(function(e){return n[t.id]=e,n[t.id]}),e=!1);return e},canInspect:function(){var e=R.canInspect;_.isUndefined(e)&&(R.canInspect=o.all({administrationAccess:a.listByUser().then(function(e){return!!_.find(e,{contextPath:"administration"})}),eventProcessingAccess:u.isAllowed({anyRole:["ROLE_CEP_MANAGEMENT_READ","ROLE_CEP_MANAGEMENT_ADMIN"]}),eventProcessingEnabled:v.eventProcessingEnabled()}).then(function(e){return R.canInspect=e.administrationAccess&&e.eventProcessingAccess&&e.eventProcessingEnabled,R.canInspect}),e=!1);return e},canApplyOnChildren:function(e){return!P(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}}),x(),null===d.getContext().context&&e.changeTitle({title:b}),"device"===I.context&&n.getStaticLinkTemplate("devicemanagementDeviceDetails").then(function(e){p=e})}e.$inject=["$scope","$routeParams","$q","$interpolate","c8yBase","c8yInventory","c8yApplication","c8yPermissions","c8yModal","c8yAlert","c8yUiUtil","c8yTitle","c8ySmartRulesAvailability","smartRuleTemplatesSvc","smartRulesSvc","gettext","gettextCatalog"],angular.module("c8y.smartRules").controller("SmartRulesListCtrl",e)}();