@c8y/ng1-modules 1018.166.0 → 1018.167.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.166.0",
3
+ "version": "1018.167.0",
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 _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _objectSpread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?Object(arguments[e]):{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.forEach(function(e){_defineProperty(r,e,t[e])})}return r}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"===_typeof(r)?r:String(r)}function _toPrimitive(e,r){if("object"!==_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===r?String:Number)(e);var n=t.call(e,r||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,s,l=[],a=!0,u=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),l.length!==r);a=!0);}catch(e){u=!0,o=e}finally{try{if(!a&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw o}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}!function(){function e(e,r,t,o,i,n,s,l){var a=this;function u(){r.listInventoryRoles(a.userId).then(t.getResData).then(function(e){a.assignedRoles=_.keyBy(e.inventoryAssignments,"managedObject")}),r.detail(a.userId).then(t.getResData).then(function(e){a.user=e,a.user.owner?r.listInventoryRoles(a.user.owner).then(t.getResData).then(function(e){a.ownerAssignedRoles=_.keyBy(e.inventoryAssignments,"managedObject"),_.isEmpty(a.ownerAssignedRoles)&&(a.displayNoOwnerRolesAlert=!0),a.failedToFetchOwnerInventoryRoles=!1}).catch(function(){a.failedToFetchOwnerInventoryRoles=!0}):a.failedToFetchOwnerInventoryRoles=!1})}function c(){u(),s.success(l.getPlural(y(),"Inventory role updated","Inventory roles updated",{}))}function y(){return _.filter(a.assignedRoles,"isModified").length}function f(e){var r="replace"===e.process,t=e.roles,n=_.map(a.assignedRoles);return o.copyUserRoles(t,n,a.userId,r).then(u).then(i.successUserRolesCopy)}_.assign(a,{$onChange:function(e){e.user&&u()},onChangeRoles:function(e){var r=e.roles,t=e.managedObjectId;a.assignedRoles[t]=a.assignedRoles[t]||{},_.assign(a.assignedRoles[t],{managedObject:t,roles:r,isModified:!0}),a.assignedRoles=_objectSpread({},a.assignedRoles)},onSaveInventoryRoles:function(){o.onSaveInventoryRoles(a.userId,a.assignedRoles).then(c)},copyRoles:function(){i.copyFromUserDialog(a.userId).then(f)},loadAssignedRoles:u,isUnchanged:function(){return 0===y()},pageSize:20,scrollToTop:function(){var e=_slicedToArray(angular.element(document.querySelector("#inventory-roles-container")),1)[0];e&&e.scrollTo(0,0)},helpLink:n.getUserGuideLink(_.get(i.STRINGS,"LINKS.ROLES_INVENTORY")),displayNoOwnerRolesAlert:!1,failedToFetchOwnerInventoryRoles:null}),u()}e.$inject=["$q","c8yUser","c8yBase","c8yUserInventoryRoles","c8yUserRolesUi","c8yDocs","c8yAlert","gettextCatalog"],angular.module("c8y.userRoles").component("c8yUserInventoryRolesTab",{templateUrl:":::PLUGIN_PATH:::/inventoryRolesTab/inventoryRolesTab.html",controllerAs:"vm",controller:e,bindings:{userId:"<"}})}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _objectSpread(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?Object(arguments[e]):{},o=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&o.push.apply(o,Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.forEach(function(e){_defineProperty(n,e,t[e])})}return n}function _defineProperty(e,n,t){return(n=_toPropertyKey(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _toPropertyKey(e){var n=_toPrimitive(e,"string");return"symbol"===_typeof(n)?n:String(n)}function _toPrimitive(e,n){if("object"!==_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===n?String:Number)(e);var o=t.call(e,n||"default");if("object"!==_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(e,n,t,r,s,o,i,l){var c=this;function u(){n.listInventoryRoles(c.userId).then(t.getResData).then(function(e){c.assignedRoles=_.keyBy(e.inventoryAssignments,"managedObject")}),n.detail(c.userId).then(t.getResData).then(function(e){c.user=e,c.user.owner?n.listInventoryRoles(c.user.owner).then(t.getResData).then(function(e){c.ownerAssignedRoles=_.keyBy(e.inventoryAssignments,"managedObject"),_.isEmpty(c.ownerAssignedRoles)&&(c.displayNoOwnerRolesAlert=!0),c.failedToFetchOwnerInventoryRoles=!1}).catch(function(){c.failedToFetchOwnerInventoryRoles=!0}):c.failedToFetchOwnerInventoryRoles=!1})}function a(){u(),i.success(l.getPlural(y(),"Inventory role updated","Inventory roles updated",{}))}function y(){return _.filter(c.assignedRoles,"isModified").length}function f(e){var n="replace"===e.process,t=e.roles,o=_.map(c.assignedRoles);return r.copyUserRoles(t,o,c.userId,n).then(u).then(s.successUserRolesCopy)}_.assign(c,{$onChange:function(e){e.user&&u()},onChangeRoles:function(e,n){c.assignedRoles[n]=c.assignedRoles[n]||{},_.assign(c.assignedRoles[n],{managedObject:n,roles:e,isModified:!0}),c.assignedRoles=_objectSpread({},c.assignedRoles)},onSaveInventoryRoles:function(){r.onSaveInventoryRoles(c.userId,c.assignedRoles).then(a)},copyRoles:function(){s.copyFromUserDialog(c.userId).then(f)},loadAssignedRoles:u,isUnchanged:function(){return 0===y()},helpLink:o.getUserGuideLink(_.get(s.STRINGS,"LINKS.ROLES_INVENTORY")),displayNoOwnerRolesAlert:!1,failedToFetchOwnerInventoryRoles:null}),u()}e.$inject=["$q","c8yUser","c8yBase","c8yUserInventoryRoles","c8yUserRolesUi","c8yDocs","c8yAlert","gettextCatalog"],angular.module("c8y.userRoles").component("c8yUserInventoryRolesTab",{templateUrl:":::PLUGIN_PATH:::/inventoryRolesTab/inventoryRolesTab.html",controllerAs:"vm",controller:e,bindings:{userId:"<"}})}();
@@ -31,7 +31,7 @@
31
31
  popover-placement="bottom"
32
32
  ></button>
33
33
  </div>
34
- <div class="inner-scroll" id="inventory-roles-container">
34
+ <div class="inner-scroll">
35
35
  <div class="card-block sticky-top overflow-visible p-b-0">
36
36
  <div class="alert alert-info" ng-show="vm.displayNoOwnerRolesAlert" translate>
37
37
  No device groups available due to the device owner permissions. The device owner must be
@@ -48,8 +48,6 @@
48
48
  class="form-control"
49
49
  placeholder="{{ 'Filter device groups…' | translate }}"
50
50
  ng-model="searchTearm"
51
- ng-model-options="{ allowInvalid: true, debounce: 1000 }"
52
- ng-change="vm.currentPage = 1; vm.scrollToTop()"
53
51
  />
54
52
  <span class="input-group-addon">
55
53
  <i
@@ -123,20 +121,17 @@
123
121
  </div>
124
122
  </div>
125
123
  <div class="card-block p-t-0 p-b-0">
126
- <c8y-roles-asset-tree-downgraded
127
- [user]="vm.user"
128
- [expand-groups]="vm.expandGroups"
129
- [owner-assigned-roles]="vm.ownerAssignedRoles"
130
- [search-filter]="searchTearm"
131
- [assigned-roles]="vm.assignedRoles"
132
- [page-size]="vm.pageSize"
133
- [pagination-offset]="(vm.currentPage - 1) * vm.pageSize"
134
- (on-change-roles)="vm.onChangeRoles($event)"
135
- (on-change-item-count)="vm.totalItemsCount = $event"
136
- ></c8y-roles-asset-tree-downgraded>
124
+ <c8y-roles-asset-tree
125
+ user="vm.user"
126
+ expand-groups="vm.expandGroups"
127
+ owner-assigned-roles="vm.ownerAssignedRoles"
128
+ search-filter="searchTearm"
129
+ assigned-roles="vm.assignedRoles"
130
+ on-change-roles="vm.onChangeRoles(roles, managedObjectId)"
131
+ ></c8y-roles-asset-tree>
137
132
  </div>
138
133
  </div>
139
- <div class="d-flex card-footer separator sticky-bottom">
134
+ <div class="card-footer separator sticky-bottom">
140
135
  <button
141
136
  title="{{ 'Clear changes' | translate }}"
142
137
  ng-click="vm.loadAssignedRoles()"
@@ -155,17 +150,6 @@
155
150
  >
156
151
  {{ 'Save' | translate }}
157
152
  </button>
158
-
159
- <div class="m-l-auto">
160
- <pagination
161
- [total-items]="vm.totalItemsCount"
162
- [items-per-page]="vm.pageSize"
163
- [max-size]="10"
164
- rotate="{{ true }}"
165
- ng-model="vm.currentPage"
166
- ng-change="vm.scrollToTop()"
167
- ></pagination>
168
- </div>
169
153
  </div>
170
154
  </div>
171
155
  </div>
@@ -1 +1 @@
1
- "use strict";!function(){function e(n,e,o){var s,t=this;_.assign(t,{filterAsset:function(e){return!t.ownerAllAssignedRoles||_.get(t.ownerAllAssignedRoles,[e.id,"length"])},onApply:function(e,n){return t.onChangeRoles({managedObjectId:n,roles:e})},$onChanges:function(e){(e.assignedRoles||e.ownerAssignedRoles)&&l.then(u);e.expandGroups&&t.expandGroups&&n.expandAll(s,i)},loadChildren:function(e){e.isOpened?(e._subGroups=[],e.isOpened=!1,i()):(n.loadChildren(e).then(i),e.isOpened=!0)},title:function(e){var n=e._subGroups,s=o.getString("Click to fetch subgroups");Array.isArray(n)&&e.isOpened&&(s=0<n.length?o.getPlural(n.length,"1 subgroup","{{$count}} subgroups",{}):o.getString("No subgroups"));return s}});var r,l=(r=t.user.owner,n.listRootGroups({onlyRootsUser:r}).then(function(e){s=e,i()}));function i(){t.flatAssetTree=n.flatTree(s),u()}function u(){if(t.assignedRoles&&(t.inheritedRoles=a(t.flatAssetTree,t.assignedRoles)),t.ownerAssignedRoles){var e=a(t.flatAssetTree,t.ownerAssignedRoles);t.ownerAllAssignedRoles=_.mergeWith(e,t.ownerAssignedRoles,function(e,n){return n?e?_.uniqBy(e.concat(n.roles),"id"):n.roles:e})}}function a(e,s){return _.reduce(e,function(e,n){return e[n.id]=_(n._parentGroups).map(function(e){return _.get(s,e.id)}).filter(_.identity).map(_.property("roles")).flatten().uniqBy("id").value(),e},{})}e.list().then(function(e){t.inventoryRoles=e})}e.$inject=["c8yUserInventoryRoles","c8yRoles","gettextCatalog"],angular.module("c8y.userRoles").component("c8yRolesAssetTree",{templateUrl:":::PLUGIN_PATH:::/rolesAssetTree/rolesAssetTree.html",controllerAs:"vm",controller:e,bindings:{user:"<",searchFilter:"<",assignedRoles:"<",ownerAssignedRoles:"<",expandGroups:"<",pageSize:"<",paginationOffset:"<",onChangeRoles:"&",onChangeItemCount:"&"}})}();
1
+ "use strict";!function(){function e(n,e,o){var s,t=this;_.assign(t,{filterAsset:function(e){return!t.ownerAllAssignedRoles||_.get(t.ownerAllAssignedRoles,[e.id,"length"])},onApply:function(e,n){return t.onChangeRoles({managedObjectId:n,roles:e})},$onChanges:function(e){(e.assignedRoles||e.ownerAssignedRoles)&&l.then(u);e.expandGroups&&t.expandGroups&&n.expandAll(s,i)},loadChildren:function(e){e.isOpened?(e._subGroups=[],e.isOpened=!1,i()):(n.loadChildren(e).then(i),e.isOpened=!0)},title:function(e){var n=e._subGroups,s=o.getString("Click to fetch subgroups");Array.isArray(n)&&e.isOpened&&(s=0<n.length?o.getPlural(n.length,"1 subgroup","{{$count}} subgroups",{}):o.getString("No subgroups"));return s}});var r,l=(r=t.user.owner,n.listRootGroups({onlyRootsUser:r}).then(function(e){s=e,i()}));function i(){t.flatAssetTree=n.flatTree(s),u()}function u(){if(t.assignedRoles&&(t.inheritedRoles=a(t.flatAssetTree,t.assignedRoles)),t.ownerAssignedRoles){var e=a(t.flatAssetTree,t.ownerAssignedRoles);t.ownerAllAssignedRoles=_.mergeWith(e,t.ownerAssignedRoles,function(e,n){return n?e?_.uniqBy(e.concat(n.roles),"id"):n.roles:e})}}function a(e,s){return _.reduce(e,function(e,n){return e[n.id]=_(n._parentGroups).map(function(e){return _.get(s,e.id)}).filter(_.identity).map(_.property("roles")).flatten().uniqBy("id").value(),e},{})}e.list().then(function(e){t.inventoryRoles=e})}e.$inject=["c8yUserInventoryRoles","c8yRoles","gettextCatalog"],angular.module("c8y.userRoles").component("c8yRolesAssetTree",{templateUrl:":::PLUGIN_PATH:::/rolesAssetTree/rolesAssetTree.html",controllerAs:"vm",controller:e,bindings:{user:"<",searchFilter:"<",assignedRoles:"<",ownerAssignedRoles:"<",expandGroups:"<",onChangeRoles:"&"}})}();
@@ -1,16 +1,6 @@
1
- <!-- @Deprecated: Component migrated to angular.-->
2
- <!--packages/ngx-components/user-roles/roles-asset-tree/roles-asset-tree.component.ts-->
3
-
4
- <div hidden="true">
5
- {{
6
- vm.onChangeItemCount({
7
- count: (vm.flatAssetTree | filter: vm.filterAsset | filter: { name: vm.searchFilter }).length
8
- })
9
- }}
10
- </div>
11
1
  <div class="c8y-list__group m-b-0 no-border-last">
12
2
  <div
13
- ng-repeat="asset in vm.flatAssetTree | filter:vm.filterAsset | filter:{name:vm.searchFilter} | limitTo : vm.pageSize : vm.paginationOffset"
3
+ ng-repeat="asset in vm.flatAssetTree | filter:vm.filterAsset | filter:{name:vm.searchFilter}"
14
4
  class="c8y-list__item"
15
5
  >
16
6
  <div
@@ -19,36 +9,26 @@
19
9
  >
20
10
  <div ng-style="::{'padding-left': asset._depth * 8}"></div>
21
11
  <div class="c8y-list__item__icon m-t-4 p-l-0">
22
- <button
23
- class="btn-clean"
12
+ <button class="btn-clean"
24
13
  ng-click="vm.loadChildren(asset)"
25
14
  type="button"
26
15
  aria-label="{{ 'Open' | translate }}"
27
16
  >
28
- <i
29
- c8y-icon="c8y-group"
30
- class="c8y-icon-duocolor"
31
- ng-if="!asset.isOpened"
32
- ></i>
33
- <i
34
- c8y-icon="c8y-group-open"
35
- class="c8y-icon-duocolor"
36
- ng-if="asset.isOpened"
37
- ></i>
17
+ <i c8y-icon="c8y-group" class="c8y-icon-duocolor" ng-if="!asset.isOpened"></i>
18
+ <i c8y-icon="c8y-group-open" class="c8y-icon-duocolor" ng-if="asset.isOpened"></i>
38
19
  </button>
39
20
  </div>
40
21
  <div class="c8y-list__item__body">
41
22
  <div class="d-flex a-i-center">
42
23
  <div class="col-sm-7 p-l-0 col-xs-12">
43
- <button
44
- class="btn-clean"
24
+ <button class="btn-clean"
45
25
  type="button"
46
26
  ng-click="vm.loadChildren(asset)"
47
27
  >
48
28
  <span
49
29
  class="text-truncate"
50
30
  title="{{::asset.name}}"
51
- ng-style="{ cursor: asset._subGroups === undefined ? 'pointer' : 'default' }"
31
+ ng-style="{cursor: asset._subGroups === undefined ? 'pointer' : 'default'}"
52
32
  >
53
33
  {{::asset.name}}
54
34
  </span>
@@ -65,7 +45,8 @@
65
45
  inventory-roles="::vm.inventoryRoles"
66
46
  on-apply="::vm.onApply(roles, asset.id)"
67
47
  ng-click="$event.stopPropagation()"
68
- ></c8y-inventory-role-selector>
48
+ >
49
+ </c8y-inventory-role-selector>
69
50
  </div>
70
51
  </div>
71
52
  </div>