@c8y/ngx-components 1011.0.33 → 1011.0.35

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.
Files changed (34) hide show
  1. package/bundles/c8y-ngx-components-sub-assets.umd.js +4 -5
  2. package/bundles/c8y-ngx-components-sub-assets.umd.js.map +1 -1
  3. package/bundles/c8y-ngx-components-sub-assets.umd.min.js +1 -1
  4. package/bundles/c8y-ngx-components-sub-assets.umd.min.js.map +1 -1
  5. package/bundles/c8y-ngx-components-upgrade.umd.js +6 -5
  6. package/bundles/c8y-ngx-components-upgrade.umd.js.map +1 -1
  7. package/bundles/c8y-ngx-components-upgrade.umd.min.js +1 -1
  8. package/bundles/c8y-ngx-components-upgrade.umd.min.js.map +1 -1
  9. package/bundles/c8y-ngx-components.umd.js +62 -20
  10. package/bundles/c8y-ngx-components.umd.js.map +1 -1
  11. package/bundles/c8y-ngx-components.umd.min.js +1 -1
  12. package/bundles/c8y-ngx-components.umd.min.js.map +1 -1
  13. package/c8y-ngx-components.metadata.json +1 -1
  14. package/core/action-bar/action-bar.component.d.ts +22 -6
  15. package/core/common/outlet.directive.d.ts +7 -0
  16. package/core/data-grid/data-grid.component.d.ts +3 -0
  17. package/esm2015/core/action-bar/action-bar.component.js +41 -15
  18. package/esm2015/core/bootstrap/bootstrap.component.js +2 -2
  19. package/esm2015/core/common/outlet.directive.js +19 -2
  20. package/esm2015/core/data-grid/data-grid.component.js +6 -2
  21. package/esm2015/sub-assets/sub-assets-grid.component.js +6 -7
  22. package/esm2015/upgrade/action-bar.factory.js +6 -2
  23. package/esm2015/upgrade/bridge.service.js +2 -5
  24. package/fesm2015/c8y-ngx-components-sub-assets.js +4 -5
  25. package/fesm2015/c8y-ngx-components-sub-assets.js.map +1 -1
  26. package/fesm2015/c8y-ngx-components-upgrade.js +5 -5
  27. package/fesm2015/c8y-ngx-components-upgrade.js.map +1 -1
  28. package/fesm2015/c8y-ngx-components.js +62 -17
  29. package/fesm2015/c8y-ngx-components.js.map +1 -1
  30. package/package.json +2 -2
  31. package/sub-assets/c8y-ngx-components-sub-assets.metadata.json +1 -1
  32. package/sub-assets/sub-assets-grid.component.d.ts +3 -3
  33. package/upgrade/action-bar.factory.d.ts +1 -0
  34. package/upgrade/c8y-ngx-components-upgrade.metadata.json +1 -1
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function h(e,t){function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function v(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function g(e,t){var n,s,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,s=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){o.label=i[1];break}if(6===i[0]&&o.label<r[1]){o.label=r[1],r=i;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(i);break}r[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var s,r,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}var f=function(){function e(e,t){this.context=e,this.deviceGroupService=t}return e.prototype.ngOnInit=function(){this.isAnyGroup=this.deviceGroupService.isAnyGroup(this.context.item),this.isDevice=this.deviceGroupService.isDevice(this.context.item),this.groupIcon=this.deviceGroupService.icon(this.context.item),this.iconTitle=this.getIconTitle(this.groupIcon)},e.prototype.getIconTitle=function(e){switch(e){case"c8y-group":return s.gettext("Group");case"c8y-group-smart":return s.gettext("Smart group");case"c8y-group-remote-inactive":return"Inactive remote group";case"c8y-group-remote":return s.gettext("Remote group");default:return s.gettext("Child device")}},e}();f.decorators=[{type:t.Component,args:[{template:'<device-status class="m-l-8" [mo]="context.item" *ngIf="isDevice"></device-status>\n<i\n [c8yIcon]="groupIcon"\n title="{{ iconTitle | translate }}"\n class="m-l-8 c8y-icon-duocolor"\n *ngIf="isAnyGroup || !isDevice"\n></i>\n'}]}],f.ctorParameters=function(){return[{type:s.CellRendererContext},{type:r.DeviceGroupService}]};var y=function(e){function t(t){var n=e.call(this,t)||this;return n.name="type",n.header=s.gettext("Type"),n.dataType="icon",n.cellRendererComponent=f,n.sortable=!0,n.sortingConfig={pathSortingConfigs:[{path:"c8y_IsDeviceGroup"}]},n}return h(t,e),t}(o.BaseDeviceGridColumn),b=function(e){function t(t,n,s,r,i,o,a,c,u,l,p){var d=e.call(this,n,t,u,p)||this;return d.translateService=t,d.inventoryService=n,d.appState=s,d.user=r,d.assetNodeService=i,d.deviceGroupService=o,d.smartGroupsService=a,d.smartRulesService=c,d.alertService=u,d.permissionsService=l,d.modal=p,d.GRID_CONFIG_DEFAULT_STORAGE_KEY="sub-assets-grid-config",d.IS_DEVICE_GROUP_FRAGMENT="c8y_IsDeviceGroup",d.IS_DYNAMIC_GROUP_FRAGMENT="c8y_IsDynamicGroup",d}return h(t,e),t.prototype.getDefaultColumns=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),[new y({sortOrder:"desc"}),new o.NameDeviceGridColumn({sortOrder:"asc"}),new o.ModelDeviceGridColumn,new o.SerialNumberDeviceGridColumn({visible:!1}),new o.RegistrationDateDeviceGridColumn({visible:!1}),new o.SystemIdDeviceGridColumn({visible:!1}),new o.ImeiDeviceGridColumn({visible:!1}),new o.AlarmsDeviceGridColumn]},t.prototype.getDefaultPagination=function(){return{pageSize:this.getConfig().pagination.pageSize,currentPage:1}},t.prototype.getDefaultActionControls=function(){return[]},t.prototype.unassignAsset=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i;return g(this,(function(o){switch(o.label){case 0:if(n=e.id,r=t.id,!this.isDevice(e))return[3,6];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.inventoryService.childAssetsRemove(n,r)];case 2:return o.sent(),i=this.translateService.instant(s.gettext("Asset unassigned.")),this.alertService.success(i),[3,4];case 3:return o.sent(),i=this.translateService.instant(s.gettext("Could not unassign asset.")),this.alertService.danger(i),[3,4];case 4:return[4,this.deactivateSmartrulesForAsset(e,t)];case 5:o.sent(),o.label=6;case 6:return[2]}}))}))},t.prototype.isDevice=function(e){return!e.hasOwnProperty(this.IS_DEVICE_GROUP_FRAGMENT)&&!e.hasOwnProperty(this.IS_DYNAMIC_GROUP_FRAGMENT)},t.prototype.deleteAsset=function(e,t,n){return void 0===n&&(n={}),v(this,void 0,void 0,(function(){return g(this,(function(s){switch(s.label){case 0:return e.hasOwnProperty(this.IS_DEVICE_GROUP_FRAGMENT)||this.smartGroupsService.isSmartGroup(e)?[4,this.deleteGroup(e,n)]:[3,2];case 1:return s.sent(),[3,4];case 2:return[4,this.deleteDevice(e,n)];case 3:s.sent(),s.label=4;case 4:return!t||this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)?[3,6]:[4,this.deactivateSmartrulesForAsset(e,t)];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))},t.prototype.shouldShowWithDeviceUserCheckbox=function(e){var t=e.owner,n=e.c8y_IsDevice,s=e.owner&&this.isDeviceUser(t);return Boolean(n&&s)},t.prototype.getDefaultBulkActionControls=function(){return[]},t.prototype.getData=function(e,t,n,s){return void 0===s&&(s={}),v(this,void 0,void 0,(function(){var r,i;return g(this,(function(o){return!n?(r=this.buildCombinedRootQueryFilter(e,t),[2,this.assetNodeService.getRootNodes(Object.assign(Object.assign({},t),{query:r}))]):(i=Object.assign(Object.assign({},this.getAssetsFilters(e,t,s)),{withParents:!1}),this.deviceGroupService.isGroup(n)?[2,this.assetNodeService.getGroupItems(n.id,i)]:this.deviceGroupService.isDynamicGroup(n)?[2,this.assetNodeService.getDynamicGroupItems(n.c8y_DeviceQueryString,i)]:this.deviceGroupService.isDevice(n)?[2,this.assetNodeService.getDeviceChildren(n.id,i)]:[2])}))}))},t.prototype.getCount=function(e,t,n,s){return void 0===s&&(s={}),v(this,void 0,void 0,(function(){var r,i;return g(this,(function(o){return r={pageSize:1,withChildren:!1},i=n?Object.assign(Object.assign({},this.getAssetsFilters(e,t,s)),r):Object.assign({query:this.buildCombinedRootQueryFilter(e,t)},r),[2,this.getAssetsStatistics(n,i)]}))}))},t.prototype.getTotal=function(e,t){void 0===t&&(t={});var n=this.assetNodeService.rootQueryFilter(),s=e?t:this.queriesUtil.addAndFilter(n,t),r={query:this.queriesUtil.buildQuery(s),withChildren:!1,withTotalPages:!0,pageSize:1};return this.getAssetsStatistics(e,r)},t.prototype.canEditGroup=function(e){return v(this,void 0,void 0,(function(){return g(this,(function(t){switch(t.label){case 0:return[4,this.permissionsService.canEdit(["ROLE_INVENTORY_ADMIN"],e)];case 1:return[2,t.sent()]}}))}))},t.prototype.canCreateGroup=function(){var e=this.appState.currentUser.value;return this.user.hasAnyRole(e,["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"])},t.prototype.canAssignDevice=function(e){return v(this,void 0,void 0,(function(){return g(this,(function(t){switch(t.label){case 0:return[4,this.permissionsService.canEdit(["ROLE_INVENTORY_ADMIN"],e)];case 1:return[2,t.sent()]}}))}))},t.prototype.canEditSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_UPDATE","ROLE_SMARTGROUP_ADMIN"])},t.prototype.canDeleteSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_ADMIN","ROLE_INVENTORY_ADMIN"])},t.prototype.isSmartGroup=function(e){return this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)},t.prototype.isUsingInventoryRoles=function(){var e=this.appState.currentUser.value;return!this.user.hasAnyRole(e,["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_READ","ROLE_INVENTORY_CREATE"])},t.prototype.getAssetsStatistics=function(e,t){return v(this,void 0,void 0,(function(){return g(this,(function(n){switch(n.label){case 0:return!e?[4,this.assetNodeService.getRootNodes(t)]:[3,2];case 1:return[2,n.sent().paging.totalPages];case 2:return this.deviceGroupService.isGroup(e)?[4,this.assetNodeService.getGroupItems(e.id,t)]:[3,4];case 3:return[2,n.sent().paging.totalPages];case 4:return this.deviceGroupService.isDynamicGroup(e)?[4,this.assetNodeService.getDynamicGroupItems(e.c8y_DeviceQueryString,t)]:[3,6];case 5:return[2,n.sent().paging.totalPages];case 6:return this.deviceGroupService.isDevice(e)?[4,this.assetNodeService.getDeviceChildren(e.id,t)]:[3,8];case 7:return[2,n.sent().paging.totalPages];case 8:return[2]}}))}))},t.prototype.buildCombinedRootQueryFilter=function(e,t){var n=this.assetNodeService.rootQueryFilter(),s=this.getQueryObj(e,t),r=this.queriesUtil.addOrderbys(n,s.__orderby,"append"),i=this.queriesUtil.addAndFilter(r,s.__filter);return this.queriesUtil.buildQuery(i)},t.prototype.deleteGroup=function(e,t){return void 0===t&&(t={}),v(this,void 0,void 0,(function(){var n,r;return g(this,(function(i){switch(i.label){case 0:n=t.cascade,i.label=1;case 1:return i.trys.push([1,6,,7]),this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)?[4,this.smartGroupsService.delete(e,{cascade:n})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this.inventoryService.delete(e,{cascade:n})];case 4:i.sent(),i.label=5;case 5:return r=this.translateService.instant(s.gettext("Asset deleted.")),this.alertService.success(r),[3,7];case 6:return i.sent(),r=this.translateService.instant(s.gettext("Could not delete asset.")),this.alertService.danger(r),[3,7];case 7:return[2]}}))}))},t.prototype.deleteDevice=function(e,t){return void 0===t&&(t={}),v(this,void 0,void 0,(function(){var n,r,i,o;return g(this,(function(a){switch(a.label){case 0:n=t.cascade,r=t.withDeviceUser,a.label=1;case 1:return a.trys.push([1,6,,7]),i=e.owner,r&&i&&this.isDeviceUser(i)?[4,this.deleteDeviceWithUser(e,n)]:[3,3];case 2:return a.sent(),[3,5];case 3:return[4,this.inventoryService.delete(e,{cascade:n})];case 4:a.sent(),a.label=5;case 5:return o=this.translateService.instant(s.gettext("Asset deleted.")),this.alertService.success(o),[3,7];case 6:return a.sent(),o=this.translateService.instant(s.gettext("Could not delete asset.")),this.alertService.danger(o),[3,7];case 7:return[2]}}))}))},t.prototype.deactivateSmartrulesForAsset=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,a,c=this;return g(this,(function(u){switch(u.label){case 0:return n=e.id,r=t.id,[4,this.smartRulesService.listByContext(r)];case 1:i=u.sent().data,o=i.map((function(e){return c.smartRulesService.bulkDeactivateEnabledSources(e,[n])})),u.label=2;case 2:return u.trys.push([2,4,,5]),[4,Promise.all(o)];case 3:return u.sent(),[3,5];case 4:return u.sent(),a=this.translateService.instant(s.gettext("Could not deactivate smart rules.")),this.alertService.danger(a),[3,5];case 5:return[2]}}))}))},t.prototype.isDeviceUser=function(e){return e.match(/^device_/)},t.prototype.deleteDeviceWithUser=function(e,t){return v(this,void 0,void 0,(function(){var n;return g(this,(function(s){switch(s.label){case 0:n={cascade:t,withDeviceUser:!0},s.label=1;case 1:return s.trys.push([1,3,,5]),[4,this.inventoryService.delete(e,n)];case 2:return[2,s.sent()];case 3:return s.sent(),[4,this.inventoryService.delete(e,{cascade:t})];case 4:return[2,s.sent()];case 5:return[2]}}))}))},t.prototype.getAssetsFilters=function(e,t,n){var s=this.queriesUtil.addAndFilter(this.getQueryObj(e),n);return{query:this.queriesUtil.buildQuery(s),pageSize:t.pageSize||this.DEFAULT_PAGE_SIZE,currentPage:t.currentPage,withTotalPages:!0}},t}(o.DeviceGridService);b.decorators=[{type:t.Injectable}],b.ctorParameters=function(){return[{type:i.TranslateService},{type:n.InventoryService},{type:s.AppStateService},{type:n.UserService},{type:r.AssetNodeService},{type:r.DeviceGroupService},{type:n.SmartGroupsService},{type:n.SmartRulesService},{type:s.AlertService},{type:s.Permissions},{type:s.ModalService}]};var S=function(){function e(e,n,r,i,o,a,c){this.inventory=e,this.subAssetsService=n,this.deviceGroupService=r,this.smartGroupsService=i,this.alertService=o,this.translate=a,this.modalService=c,this.onGroupChange=new t.EventEmitter,this.filterMsg=s.gettext("Smart groups are groups dynamically constructed based on filtering criteria."),this.canEditMsg=s.gettext("You can edit the filter here."),this.GROUP_UPDATED_MSG=s.gettext("Group updated.")}return e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e,t;return g(this,(function(n){switch(n.label){case 0:return e=this,this.smartGroupsService.isSmartGroupV2(this.group)?(t=this.subAssetsService.canEditSmartGroup(),[3,3]):[3,1];case 1:return[4,this.subAssetsService.canEditGroup(this.group)];case 2:t=n.sent(),n.label=3;case 3:return e.canEdit=t,this.groupIcon=this.deviceGroupService.icon(this.group),this.smartGroupFilter=this.group.c8y_DeviceQueryString,this.setHintMsg(),[2]}}))}))},e.prototype.isSmartGroup=function(){return this.subAssetsService.isSmartGroup(this.group)},e.prototype.update=function(e){return v(this,void 0,void 0,(function(){var t;return g(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),this.subAssetsService.isSmartGroup(this.group)?[4,this.updateSmartGroup(e)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this.updateGroup(e)];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return t=n.sent(),this.alertService.addServerFailure(t),[3,6];case 6:return[2]}}))}))},e.prototype.setHintMsg=function(){var e=this.translate.instant(this.filterMsg),t=this.translate.instant(this.canEditMsg);this.filterHintMsg=this.canEdit?e+" "+t:this.filterMsg},e.prototype.updateGroup=function(e){return v(this,void 0,void 0,(function(){var t,n,s;return g(this,(function(r){switch(r.label){case 0:return t=this.group.id,n=Object.assign({id:t},e),[4,this.inventory.update(n)];case 1:return s=r.sent().data,this.setGroup(s),[2]}}))}))},e.prototype.updateSmartGroup=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,a;return g(this,(function(c){switch(c.label){case 0:return t=this.group.id,n=e.c8y_DeviceQueryString,r=Object.assign({id:t},e),n?[3,2]:[4,this.smartGroupsService.update(r)];case 1:return i=c.sent().data,this.setGroup(i),[2];case 2:return c.trys.push([2,5,,6]),o=s.gettext("You are about to change the smart group filter. Do you want to proceed?"),a=s.gettext("Smart group filter"),[4,this.modalService.confirm(a,o,s.Status.WARNING,{ok:s.gettext("Save"),cancel:s.gettext("Cancel")})];case 3:return c.sent(),[4,this.isQueryExecutable(n)];case 4:return c.sent()?[3,6]:[2];case 5:return c.sent(),[2];case 6:return[4,this.smartGroupsService.update(r)];case 7:return i=c.sent().data,this.setGroup(i),[2]}}))}))},e.prototype.setGroup=function(e){this.onGroupChange.emit(e),this.alertService.success(this.GROUP_UPDATED_MSG)},e.prototype.isQueryExecutable=function(e){return v(this,void 0,void 0,(function(){var t,n;return g(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t={q:e},[4,this.inventory.list(t)];case 1:return s.sent(),[2,!0];case 2:return n=s.sent(),this.alertService.addServerFailure(n),[2,!1];case 3:return[2]}}))}))},e}();S.decorators=[{type:t.Component,args:[{selector:"c8y-group-info",template:'<div class="bg-gray-white">\n <div class="card-block p-t-24 p-b-24 large-padding">\n <div class="content-flex-70">\n <div class="text-center">\n <i class="c8y-icon-duocolor icon-48" [c8yIcon]="groupIcon + \'-open\'"></i>\n <p>\n <small class="label label-info" *ngIf="group.c8y_IsDynamicGroup">\n {{ \'Smart group\' | translate }}\n </small>\n <small\n class="label label-info"\n *ngIf="!group.c8y_IsDynamicGroup && !group.com_cumulocity_model_Agent"\n >\n {{ \'Group\' | translate }}\n </small>\n <small class="label label-info" *ngIf="group.com_cumulocity_model_Agent">\n {{ \'Remote group\' | translate }}\n </small>\n </p>\n </div>\n\n <div class="flex-grow col-10">\n <div class="content-flex-80">\n <div class="col-9">\n <form #groupNameForm="ngForm">\n <c8y-form-group class="form-group-lg m-b-0">\n <label class="sr-only" translate>\n Name\n </label>\n\n <p *ngIf="!canEdit" class="form-control-static">{{ group.name }}</p>\n <div *ngIf="canEdit" class="input-group input-group-editable">\n <input\n type="text"\n class="form-control"\n [(ngModel)]="group.name"\n name="name"\n title="{{ \'Name\' | translate }}"\n size="{{ group.name.length + 2 }}"\n placeholder="{{ \'e.g. My group\' | translate }}"\n maxlength="254"\n required\n />\n <span></span>\n <div class="input-group-btn">\n <button\n (click)="update({ name: group.name }); groupNameForm.form.markAsPristine()"\n class="btn btn-primary"\n title="{{ \'Save\' | translate }}"\n [disabled]="groupNameForm.form.invalid"\n >\n {{ \'Save\' | translate }}\n </button>\n </div>\n </div>\n </c8y-form-group>\n </form>\n <form #groupDescriptionForm="ngForm">\n <label class="sr-only" translate>\n Description\n </label>\n <p *ngIf="!canEdit" class="form-control-static">{{ group.c8y_Notes }}</p>\n <div *ngIf="canEdit" class="input-group input-group-editable">\n <textarea\n class="form-control"\n [(ngModel)]="group.c8y_Notes"\n name="description"\n title="{{ \'Description\' | translate }}"\n cols="{{ group.c8y_Notes ? group.c8y_Notes.length : 25 }}"\n placeholder="{{ \'e.g. My description\' | translate }}"\n ></textarea>\n <span></span>\n <div class="input-group-btn">\n <button\n (click)="\n update({ c8y_Notes: group.c8y_Notes });\n groupDescriptionForm.form.markAsPristine()\n "\n class="btn btn-primary"\n title="{{ \'Save\' | translate }}"\n [disabled]="groupDescriptionForm.form.invalid"\n >\n {{ \'Save\' | translate }}\n </button>\n </div>\n </div>\n </form>\n\n <form #smartGroupFilterForm="ngForm" *ngIf="isSmartGroup()">\n <c8y-form-group class="m-b-0 m-t-8">\n <label class="m-b-0 text-nowrap">\n {{ \'Smart group filter\' | translate }}\n <button\n class="btn-clean text-primary m-r-4"\n type="button"\n popover="{{ filterHintMsg | translate }}"\n triggers="focus"\n >\n <i c8yIcon="question-circle-o"></i>\n </button>\n </label>\n\n <p *ngIf="!canEdit" class="form-control-static">\n {{ smartGroupFilter }}\n </p>\n <div *ngIf="canEdit" class="input-group input-group-editable">\n <input\n type="text"\n class="form-control"\n [(ngModel)]="smartGroupFilter"\n name="filter"\n size="{{ smartGroupFilter.length + 2 }}"\n placeholder="{{ \'e.g.\' | translate }} $filter=(id eq \'12*\')"\n maxlength="254"\n title="{{ \'Smart group filter\' | translate }}"\n />\n <span></span>\n <div class="input-group-btn">\n <button\n (click)="\n update({ c8y_DeviceQueryString: smartGroupFilter });\n smartGroupFilterForm.form.markAsPristine()\n "\n class="btn btn-primary"\n title="{{ \'Save\' | translate }}"\n [disabled]="smartGroupFilterForm.form.invalid"\n >\n {{ \'Save\' | translate }}\n </button>\n </div>\n </div>\n </c8y-form-group>\n </form>\n </div>\n <div class="flex-grow">\n <p class="m-b-8">\n <i c8yIcon="info-circle" class="text-info m-r-8"></i>\n <span class="text-label-small">{{ \'Group info\' | translate }}</span>\n </p>\n <ul class="list-unstyled small">\n <li class="p-t-4 p-b-4 flex-row separator-top-bottom text-nowrap">\n <label class="small m-b-0 m-r-8">{{ \'Created\' | translate }}</label>\n <span class="flex-item-right">{{ group.creationTime | c8yDate }}</span>\n </li>\n <li class="p-t-4 p-b-4 flex-row separator-bottom text-nowrap">\n <label class="small m-b-0 m-r-8">{{ \'Last updated\' | translate }}</label>\n <span class="flex-item-right">{{ group.lastUpdated | c8yDate }}</span>\n </li>\n\n <li\n *ngIf="group.com_cumulocity_model_Agent"\n class="p-t-4 p-b-4 flex-row separator-bottom text-nowrap"\n >\n <label class="small m-b-0 m-r-8">{{ \'Status\' | translate }}</label>\n <span class="flex-item-right" *ngIf="group.c8y_BrokerSource">\n {{ group.c8y_BrokerSource.status }}\n </span>\n <span class="flex-item-right" *ngIf="!group.c8y_BrokerSource">\n {{ \'Offline\' | translate }}\n </span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n'}]}],S.ctorParameters=function(){return[{type:n.InventoryService},{type:b},{type:r.DeviceGroupService},{type:n.SmartGroupsService},{type:s.AlertService},{type:i.TranslateService},{type:s.ModalService}]},S.propDecorators={group:[{type:t.Input}],onGroupChange:[{type:t.Output}]};var G=function(){function e(e,n,s,r){var i=this;this.route=e,this.appState=n,this.deviceGroupService=s,this.subAssetsService=r,this.toggle=!1,this.showAddGroup=!1,this.showAssignDevices=!1,this.showGroupInfo=!0,this.showAssignChildDevices=!1,this.refresh=new t.EventEmitter,this.filterable=!0,this.shouldDisableAddGroup=!1,this.shouldDisableAssignDevices=!1,this.dataSub=this.route.parent.data.subscribe((function(e){var t=e.contextData;i.title=t.name,i.currentGroupId=t.id,i.group=t,i.filterable=!i.deviceGroupService.isDynamicGroup(t)}))}return e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e,t=this;return g(this,(function(n){switch(n.label){case 0:return this.appState.state$.subscribe((function(e){t.showGroupInfo="cockpit"===e.app.name||"devicemanagement"===e.app.name})),this.shouldDisableAddGroup=!this.subAssetsService.canCreateGroup(),e=this,[4,!this.subAssetsService.canAssignDevice(this.group)];case 1:return e.shouldDisableAssignDevices=n.sent(),this.displayOptions={striped:!0,bordered:!1,gridHeader:!0,filter:!this.isSmartGroup()},[2]}}))}))},e.prototype.groupChange=function(e){Object.assign(this.group,e),this.title=e.name,this.refresh.emit()},e.prototype.isSmartGroup=function(){return this.subAssetsService.isSmartGroup(this.group)},e.prototype.ngOnDestroy=function(){this.dataSub&&this.dataSub.unsubscribe()},e}();G.decorators=[{type:t.Component,args:[{selector:"c8y-sub-assets",template:'<c8y-title>\n {{ title }}\n</c8y-title>\n\n<c8y-action-bar-item [placement]="\'right\'" *ngIf="!isSmartGroup()">\n <button\n class="btn btn-link"\n title="{{ \'Add group\' | translate }}"\n (click)="showAddGroup = !showAddGroup"\n [disabled]="shouldDisableAddGroup"\n >\n <i c8yIcon="plus-circle" class="m-r-4"></i><span translate>Add group</span>\n </button>\n</c8y-action-bar-item>\n\n<c8y-action-bar-item [placement]="\'right\'" *ngIf="!isSmartGroup()">\n <button\n class="btn btn-link"\n title="{{ \'Assign devices\' | translate }}"\n (click)="showAssignDevices = !showAssignDevices"\n [disabled]="shouldDisableAssignDevices"\n >\n <i c8yIcon="plus-circle" class="m-r-4"></i><span translate>Assign devices</span>\n </button>\n</c8y-action-bar-item>\n\n<div class="card content-fullpage d-flex d-col">\n <c8y-group-info\n *ngIf="showGroupInfo"\n [group]="group"\n (onGroupChange)="groupChange($event)"\n ></c8y-group-info>\n <c8y-sub-assets-grid\n [refresh]="refresh"\n [parent-group]="group"\n [filterable]="filterable"\n [displayOptions]="displayOptions"\n class="d-contents"\n ></c8y-sub-assets-grid>\n</div>\n\n<div [ngClass]="{ drawerOpen: showAddGroup }">\n <div class="bottom-drawer">\n <c8y-add-group\n [currentGroupId]="currentGroupId"\n [refresh]="refresh"\n (onCancel)="showAddGroup = false"\n *ngIf="showAddGroup"\n ></c8y-add-group>\n </div>\n</div>\n\n<div [ngClass]="{ drawerOpen: showAssignDevices }">\n <div class="bottom-drawer">\n <div class="d-flex d-col no-align-items fit-h">\n <c8y-assign-devices\n class="d-contents"\n (onCancel)="showAssignDevices = false"\n [refresh]="refresh"\n [currentGroupId]="currentGroupId"\n (onShowChildDevices)="showAssignChildDevices=$event"\n (selectedDevice)="showChildrenForDevice=$event"\n *ngIf="showAssignDevices"\n ></c8y-assign-devices>\n </div>\n </div>\n</div>\n\n<div [ngClass]="{ drawerOpen: showAssignChildDevices }" >\n <div class="bottom-drawer m-t-40">\n <div class="d-flex d-col no-align-items fit-h">\n <c8y-assign-child-devices\n *ngIf="showAssignChildDevices"\n class="d-contents"\n (onCancel)="showAssignChildDevices = false"\n [refresh]="refresh"\n [currentGroupId]="currentGroupId"\n [parentDevice]="showChildrenForDevice"\n ></c8y-assign-child-devices>\n </div>\n </div>\n</div>\n'}]}],G.ctorParameters=function(){return[{type:a.ActivatedRoute},{type:s.AppStateService},{type:r.DeviceGroupService},{type:b}]};var A=function(){function e(e){this.translateService=e,this.showWithCascadeCheckbox=!0,this.showWithDeviceUserCheckbox=!1,this.closeSubject=new u.Subject,this.labels={ok:s.gettext("Delete"),cancel:s.gettext("Cancel")},this.title=s.gettext("Delete asset"),this.status=s.Status.DANGER,this.config={cascade:!1,withDeviceUser:!1}}return e.prototype.ngOnInit=function(){this.message=this.translateService.instant(s.gettext('You are about to delete asset: "{{name}}". This operation is irreversible. Do you want to proceed?'),{name:this.asset.name})},e.prototype.ngAfterViewInit=function(){return v(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.modalRef.result];case 1:return e.sent(),this.onClose(),[3,3];case 2:return e.sent(),this.onDismiss(),[3,3];case 3:return[2]}}))}))},e.prototype.onClose=function(){this.closeSubject.next(this.config),this.closeSubject.complete()},e.prototype.onDismiss=function(){this.closeSubject.complete()},e}();A.decorators=[{type:t.Component,args:[{selector:"c8y-delete-assets-modal",template:'<c8y-confirm-modal [title]="title" [status]="status" [labels]="labels" #modalRef>\n <form #assetsForm="ngForm">\n <p class="text-wrap m-b-16">\n {{ message | translate }}\n </p>\n <c8y-form-group *ngIf="showWithCascadeCheckbox" class="m-b-0">\n <label title="{{ \'Delete devices\' | translate }}" class="c8y-checkbox">\n <input type="checkbox" name="cascade" [(ngModel)]="config.cascade" />\n <span></span>\n <span>\n {{ \'Also delete all devices inside selected asset and its subassets.\' | translate }}\n </span>\n </label>\n </c8y-form-group>\n <c8y-form-group *ngIf="showWithDeviceUserCheckbox" class="m-b-0">\n <label title="{{ \'Delete associated device owner\' | translate }}" class="c8y-checkbox">\n <input type="checkbox" name="withDeviceUser" [(ngModel)]="config.withDeviceUser" />\n <span></span>\n <span>\n {{ \'Also delete associated device owner.\' | translate }}\n </span>\n </label>\n </c8y-form-group>\n </form>\n</c8y-confirm-modal>\n'}]}],A.ctorParameters=function(){return[{type:i.TranslateService}]},A.propDecorators={showWithCascadeCheckbox:[{type:t.Input}],showWithDeviceUserCheckbox:[{type:t.Input}],asset:[{type:t.Input}],modalRef:[{type:t.ViewChild,args:["modalRef",{static:!1}]}]};var D=function(){function e(e){this.translateService=e,this.closeSubject=new u.Subject,this.labels={ok:s.gettext("Unassign"),cancel:s.gettext("Cancel")},this.title=s.gettext("Unassign asset"),this.status=s.Status.WARNING}return e.prototype.ngOnInit=function(){this.message=this.translateService.instant(s.gettext('You are about to unassign asset "{{name}}". Do you want to proceed?'),{name:this.asset.name})},e.prototype.ngAfterViewInit=function(){return v(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.modalRef.result];case 1:return e.sent(),this.onClose(),[3,3];case 2:return e.sent(),this.onDismiss(),[3,3];case 3:return[2]}}))}))},e.prototype.onClose=function(){this.closeSubject.next(!0),this.closeSubject.complete()},e.prototype.onDismiss=function(){this.closeSubject.complete()},e}();D.decorators=[{type:t.Component,args:[{selector:"c8y-unassign-modal",template:'<c8y-confirm-modal [title]="title" [status]="status" [labels]="labels" #modalRef>\n <span>{{ message | translate }}</span>\n</c8y-confirm-modal>\n'}]}],D.ctorParameters=function(){return[{type:i.TranslateService}]},D.propDecorators={asset:[{type:t.Input}],modalRef:[{type:t.ViewChild,args:["modalRef",{static:!1}]}]};var C=function(){function e(e,n,r,i){this.subAssetsGridService=e,this.alert=n,this.bsModalService=r,this.smartGroupsService=i,this.title=s.gettext("Subassets"),this.emptyStateText=s.gettext("Add your first group or assign devices using the buttons on the toolbar."),this.loadingItemsLabel=s.gettext("Loading assets…"),this.selectable=!1,this.baseQuery={},this.filterable=!0,this.sortable=!0,this.onColumnsChange=new t.EventEmitter,this.itemsSelect=new t.EventEmitter,this.pagination=this.subAssetsGridService.getDefaultPagination(),this.bulkActionControls=this.subAssetsGridService.getDefaultBulkActionControls(),this.displayOptions={striped:!0,bordered:!1,gridHeader:!0,filter:!0},this.serverSideDataCallback=this.onDataSourceModifier.bind(this)}return Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(e){this._columns=e?this.subAssetsGridService.getUserConfiguredColumns(e):this.subAssetsGridService.getUserConfiguredColumns(this.subAssetsGridService.getDefaultColumns())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_pagination",{set:function(e){this.pagination=e||this.subAssetsGridService.getDefaultPagination()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_actionControls",{set:function(e){this.actionControls=e||this.subAssetsGridService.getDefaultActionControls()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_bulkActionControls",{set:function(e){this.bulkActionControls=e||this.subAssetsGridService.getDefaultBulkActionControls()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRootGroup",{get:function(){return!this.parentGroup},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getInfiniteScrollMode",{get:function(){return this.isRootGroup&&this.subAssetsGridService.isUsingInventoryRoles()?"auto":void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_displayOptions",{set:function(e){this.displayOptions=Object.assign(Object.assign({},this.displayOptions),e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.columns=this.subAssetsGridService.getDefaultColumns(this.filterable,this.sortable),this.filterable&&this.sortable||this.columns.forEach((function(t){t.filterable=e.filterable,t.sortable=e.sortable})),this.setActionControls()},e.prototype.setActionControls=function(){return v(this,void 0,void 0,(function(){var e,t,n,r,i=this;return g(this,(function(o){switch(o.label){case 0:return e=[],[4,this.smartGroupsService.isSmartGroupsV2MicroserviceInstalled()];case 1:return t=o.sent().data,n={type:"DELETE",callback:function(e){return i.onDeleteAsset(e,i.parentGroup)},showIf:function(e){return i.smartGroupsService.isSmartGroupV2(e)?!!t&&i.subAssetsGridService.canDeleteSmartGroup():!i.smartGroupsService.isSmartGroup(e)||i.subAssetsGridService.canDeleteSmartGroup()}},e.push(n),r={type:"UNASSIGN",icon:"unlink",text:s.gettext("Unassign"),callback:function(e){return i.onUnassignAsset(e,i.parentGroup)},showIf:function(e){return i.subAssetsGridService.isDevice(e)&&!i.subAssetsGridService.isSmartGroup(i.parentGroup)}},e.push(r),this.actionControls||(this.actionControls=e),[2]}}))}))},e.prototype.onUnassignAsset=function(e,t){var n=this,s={asset:e};this.bsModalService.show(D,{initialState:s}).content.closeSubject.subscribe((function(s){return v(n,void 0,void 0,(function(){return g(this,(function(n){switch(n.label){case 0:return s?[4,this.subAssetsGridService.unassignAsset(e,t)]:[3,2];case 1:n.sent(),this.refresh.emit(),n.label=2;case 2:return[2]}}))}))}))},e.prototype.onDeleteAsset=function(e,t){return v(this,void 0,void 0,(function(){var n,r=this;return g(this,(function(i){return n={showWithDeviceUserCheckbox:this.subAssetsGridService.shouldShowWithDeviceUserCheckbox(e),asset:e,showWithCascadeCheckbox:!this.smartGroupsService.isSmartGroup(e)&&!this.smartGroupsService.isSmartGroupV2(e)},this.bsModalService.show(A,{initialState:n}).content.closeSubject.subscribe((function(n){return v(r,void 0,void 0,(function(){return g(this,(function(r){switch(r.label){case 0:return n?[4,this.subAssetsGridService.deleteAsset(e,t,n)]:[3,2];case 1:r.sent(),this.alert.warning(s.gettext("The counter for the total number of items might be inaccurate.")),this.refresh.emit(),r.label=2;case 2:return[2]}}))}))})),[2]}))}))},e.prototype.ngOnChanges=function(e){e.parentGroup&&!e.parentGroup.firstChange&&this.dataGrid.reload()},e.prototype.trackByName=function(e,t){return t.name},e.prototype.onDataSourceModifier=function(e){return v(this,void 0,void 0,(function(){var t,n,s,r,i,o;return g(this,(function(a){switch(a.label){case 0:return(t=[]).push(this.subAssetsGridService.getData(e.columns,e.pagination,this.parentGroup,this.baseQuery)),t.push(this.subAssetsGridService.getTotal(this.parentGroup,this.baseQuery)),t.push(this.subAssetsGridService.getCount(e.columns,e.pagination,this.parentGroup,this.baseQuery)),[4,Promise.all(t)];case 1:return s=m.apply(void 0,[a.sent(),3]),r=s[0],i=s[1],o=s[2],n||(n={size:i,filteredSize:o}),this.onColumnsChange.emit(e.columns),[2,Object.assign({res:r.res,data:r.data,paging:r.paging},n)]}}))}))},e.prototype.configChange=function(e){this.subAssetsGridService.saveConfig(e)},e}();C.decorators=[{type:t.Component,args:[{selector:"c8y-sub-assets-grid",template:'<c8y-data-grid\n [title]="title"\n [loadingItemsLabel]="loadingItemsLabel"\n [columns]="columns"\n [pagination]="pagination"\n [actionControls]="actionControls"\n [selectable]="selectable"\n [bulkActionControls]="bulkActionControls"\n [serverSideDataCallback]="serverSideDataCallback"\n [infiniteScroll]="getInfiniteScrollMode"\n [refresh]="refresh"\n [displayOptions]="displayOptions"\n (onConfigChange)="configChange($event)"\n (itemsSelect)="itemsSelect.emit($event)"\n class="d-contents"\n>\n <ng-container *ngFor="let column of columns; trackBy: trackByName">\n <c8y-column [name]="column.name"></c8y-column>\n </ng-container>\n <div class="c8y-empty-state">\n <h1 c8yIcon="c8y-group-add" class="c8y-icon-duocolor"></h1>\n <div>\n <p>\n <strong>{{ \'No items to display.\' | translate }}</strong>\n </p>\n <small>{{ emptyStateText | translate }}</small>\n </div>\n </div>\n</c8y-data-grid>\n'}]}],C.ctorParameters=function(){return[{type:b},{type:s.AlertService},{type:c.BsModalService},{type:n.SmartGroupsService}]},C.propDecorators={parentGroup:[{type:t.Input,args:["parent-group"]}],refresh:[{type:t.Input}],title:[{type:t.Input}],emptyStateText:[{type:t.Input}],loadingItemsLabel:[{type:t.Input}],columns:[{type:t.Input}],_pagination:[{type:t.Input,args:["pagination"]}],_actionControls:[{type:t.Input,args:["actionControls"]}],selectable:[{type:t.Input}],baseQuery:[{type:t.Input}],_bulkActionControls:[{type:t.Input,args:["bulkActionControls"]}],filterable:[{type:t.Input}],sortable:[{type:t.Input}],onColumnsChange:[{type:t.Output}],itemsSelect:[{type:t.Output}],dataGrid:[{type:t.ViewChild,args:[s.DataGridComponent,{static:!0}]}],_displayOptions:[{type:t.Input,args:["displayOptions"]}]};var w=function(){function e(e){this.inventoryService=e,this.GROUP_FRAGMENT_TYPE="c8y_IsDeviceGroup"}return e.prototype.createGroupAndAssignDevices=function(e,t,n){return v(this,void 0,void 0,(function(){var s,r,i,o;return g(this,(function(a){switch(a.label){case 0:return r=e.name,i=e.description,o=this.getGroupMO(r,i,t),t?[4,this.inventoryService.childAssetsCreate(o,t)]:[3,2];case 1:return s=a.sent().data,[3,4];case 2:return[4,this.inventoryService.create(o)];case 3:s=a.sent().data,a.label=4;case 4:return n.length>0?[4,this.assignDevices(s.id,n)]:[3,6];case 5:a.sent(),a.label=6;case 6:return[2,s]}}))}))},e.prototype.getGroupMO=function(e,t,n){var s;return void 0===t&&(t=""),(s={type:this.getGroupType(n)})[this.GROUP_FRAGMENT_TYPE]={},s.name=e,s.c8y_Notes=t,s},e.prototype.getGroupType=function(e){return e?r.GroupFragment.subGroupType:r.GroupFragment.groupType},e.prototype.assignDevices=function(e,t){return v(this,void 0,void 0,(function(){var n,s=this;return g(this,(function(r){switch(r.label){case 0:return n=[],t.forEach((function(t){n.push(s.inventoryService.childAssetsAdd(t,e))})),[4,Promise.all(n)];case 1:return[2,r.sent()]}}))}))},e}();w.decorators=[{type:t.Injectable}],w.ctorParameters=function(){return[{type:n.InventoryService}]};var I=function(){function e(e,n,r,i,o){this.deviceGridService=e,this.fb=n,this.addGroupService=r,this.alert=i,this.subAssetsService=o,this.refresh=new t.EventEmitter,this.onDeviceQueryStringChange=new t.EventEmitter,this.onCancel=new t.EventEmitter,this.pendingStatus=!1,this.pagination={pageSize:20,currentPage:1},this.selected=[],this.canCreateGroup=!1,this.canAssignDevice=!1,this.ITEMS_SELECT_LIMIT=15,this.btnLabels={next:s.gettext("Next"),cancel:s.gettext("Cancel"),create:s.gettext("Create")}}return e.prototype.onEnterKeyDown=function(e){this.isGroupDetailsStep()&&!this.canAssignDevice||this.isAssignDeviceStep()?this.createGroup():this.stepper.next()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e,t=this;return g(this,(function(n){switch(n.label){case 0:return this.formGroupStepOne=this.fb.group({name:["",p.Validators.required],description:[""]}),this.subscription=this.onCancel.subscribe((function(){return t.resetStepper()})),this.canCreateGroup=this.subAssetsService.canCreateGroup(),e=this,[4,this.subAssetsService.canAssignDevice({id:this.currentGroupId})];case 1:return e.canAssignDevice=n.sent(),[2]}}))}))},e.prototype.ngAfterViewInit=function(){this.nameInput=this.nameInputRef.nativeElement,this.setFocusOnNameInput()},e.prototype.createGroup=function(){return v(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return!1===this.canCreateGroup?[2]:(this.pendingStatus=!0,[4,this.addGroupService.createGroupAndAssignDevices(this.formGroupStepOne.value,this.currentGroupId,this.selected)]);case 1:return e.sent(),this.pendingStatus=!1,this.resetStepper(),this.alert.success(s.gettext("Group created.")),this.refresh.emit(),this.onCancel.emit(),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e.prototype.resetStepper=function(){this.stepper.reset(),this.stepper.selectedIndex=1,this.selected=[]},e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},e.prototype.isGroupDetailsStep=function(){return 0===this.stepper.selectedIndex},e.prototype.isAssignDeviceStep=function(){return 1===this.stepper.selectedIndex},e.prototype.setFocusOnNameInput=function(){this.nameInput&&(this.nameInput.focus(),this.nameInput.select())},e}();I.decorators=[{type:t.Component,args:[{selector:"c8y-add-group",template:'<c8y-title *ngIf="!currentGroupId">\n {{ \'Add group\' | translate }}\n</c8y-title>\n\n<div class="d-contents" *ngIf="!currentGroupId; else stepper">\n <ng-container [ngTemplateOutlet]="stepper"></ng-container>\n</div>\n\n<ng-template #stepper>\n <c8y-stepper\n class="flex-col flex-nowrap no-align-items fit-h c8y-stepper--no-btns"\n [disableDefaultIcons]="{ edit: true, done: false }"\n [customClasses]="[\'col-md-6\', \'col-md-offset-3\', \'p-t-16\', \'p-b-32\', \'flex-no-shrink\']"\n linear\n >\n <cdk-step [stepControl]="formGroupStepOne" [label]="\'New group\' | translate">\n <div class="p-16 p-t-0 flex-no-shrink separator-bottom col-xs-12">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'New group\' | translate }}\n </h4>\n </div>\n </div>\n </div>\n <div class="col-xs-12 flex-grow no-gutter">\n <div class="card-inner-scroll fit-h">\n <div class="card-block p-b-0">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <c8y-form-group>\n <div [formGroup]="formGroupStepOne">\n <c8y-form-group>\n <label translate>Name</label>\n <input\n class="form-control"\n type="text"\n formControlName="name"\n placeholder="{{ \'e.g. First floor\' | translate }} "\n #nameRef\n required\n />\n <c8y-messages>\n <c8y-message *ngIf="!formGroupStepOne.untouched && !nameRef.value" translate\n >This field is required.</c8y-message\n >\n </c8y-messages>\n </c8y-form-group>\n\n <c8y-form-group>\n <label translate>Description</label>\n <input\n class="form-control"\n type="text"\n formControlName="description"\n placeholder="{{ \'e.g. first floor devices\' | translate }}"\n />\n </c8y-form-group>\n </div>\n </c8y-form-group>\n <c8y-form-group>\n <div [formGroup]="formGroupStepOne"></div>\n </c8y-form-group>\n <div class="alert alert-info max-width-100" translate *ngIf="!canAssignDevice">\n You don\'t have permission to assign devices.\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <c8y-stepper-buttons\n class="d-block card-footer p-24 separator"\n (onCancel)="onCancel.emit()"\n (onCustom)="createGroup()"\n [disabled]="!canCreateGroup"\n [labels]="\n canAssignDevice\n ? { next: btnLabels.next, cancel: btnLabels.cancel }\n : { custom: btnLabels.create, cancel: btnLabels.cancel }\n "\n [showButtons]="\n canAssignDevice ? { next: true, cancel: true } : { custom: true, cancel: true }\n "\n ></c8y-stepper-buttons>\n </cdk-step>\n <cdk-step [label]="\'Assign devices\' | translate">\n <div class="p-16 p-t-0 flex-no-shrink separator-bottom col-xs-12">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'Assign devices\' | translate }}\n </h4>\n </div>\n </div>\n </div>\n <div class="col-xs-12 no-gutter flex-grow">\n <c8y-device-grid\n [title]="\'Select target devices\' | translate"\n [actionControls]="[]"\n [infiniteScroll]="\'auto\'"\n [selectable]="\'true\'"\n [pagination]="pagination"\n (itemsSelect)="onSelected($event)"\n [refresh]="refresh"\n class="d-contents"\n >\n <div class="c8y-empty-state">\n <h1 c8yIcon="search"></h1>\n <div>\n <p>\n <strong>{{ \'No matching devices.\' | translate }}</strong>\n </p>\n <small>{{ \'Refine your search terms\' | translate }}</small>\n </div>\n </div>\n </c8y-device-grid>\n </div>\n <c8y-stepper-buttons\n class="d-block card-footer p-24 separator"\n (onCancel)="onCancel.emit()"\n (onCustom)="createGroup()"\n [labels]="{ custom: btnLabels.create }"\n [disabled]="!canAssignDevice"\n [pending]="pendingStatus"\n ></c8y-stepper-buttons>\n </cdk-step>\n </c8y-stepper>\n</ng-template>\n'}]}],I.ctorParameters=function(){return[{type:o.DeviceGridService},{type:p.FormBuilder},{type:w},{type:s.AlertService},{type:b}]},I.propDecorators={currentGroupId:[{type:t.Input}],refresh:[{type:t.Input}],onDeviceQueryStringChange:[{type:t.Output}],onCancel:[{type:t.Output}],stepper:[{type:t.ViewChild,args:[s.C8yStepper,{static:!1}]}],nameInputRef:[{type:t.ViewChild,args:["nameRef",{static:!1}]}],onEnterKeyDown:[{type:t.HostListener,args:["document:keydown.enter",["$event"]]}],onEscapeKeyDown:[{type:t.HostListener,args:["document:keydown.escape",["$event"]]}]};var x=[{path:"add-group",component:I}],E=function(){};E.decorators=[{type:t.NgModule,args:[{declarations:[I],imports:[s.CoreModule,o.DeviceGridModule,p.FormsModule,p.ReactiveFormsModule],entryComponents:[I],exports:[I],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:x,multi:!0},w]}]}];var O=function(){function e(e,n){this.permissions=e,this.subAssetsService=n,this.refresh=new t.EventEmitter,this.showAddGroup=!1,this.filterable=!1,this.sortable=!0,this.shouldDisableAddGroup=!1}return e.prototype.ngOnInit=function(){this.permissions.hasRole("ROLE_INVENTORY_READ")||(this.sortable=!1),this.shouldDisableAddGroup=!this.subAssetsService.canCreateGroup()},e}();O.decorators=[{type:t.Component,args:[{selector:"c8y-groups-name",template:'<c8y-title>\n {{ \'Groups\' | translate }}\n</c8y-title>\n<c8y-action-bar-item [placement]="\'right\'">\n <button\n class="btn btn-link"\n title="{{ \'Add group\' | translate }}"\n (click)="showAddGroup = !showAddGroup"\n [disabled]="shouldDisableAddGroup"\n >\n <i c8yIcon="plus-circle" class="m-r-4"></i><span translate>Add group</span>\n </button>\n</c8y-action-bar-item>\n \x3c!-- TODO: uncomment when help is available \n <c8y-help src="/users-guide/device-management/#grouping-devices"></c8y-help> \n--\x3e\n\n<div [ngClass]="{ drawerOpen: showAddGroup }">\n <div class="bottom-drawer">\n <c8y-add-group\n [refresh]="refresh"\n (onCancel)="showAddGroup = false"\n *ngIf="showAddGroup"\n ></c8y-add-group>\n </div>\n</div>\n<c8y-sub-assets-grid\n [refresh]="refresh"\n [filterable]="filterable"\n [sortable]="sortable"\n class="content-fullpage d-flex d-col"\n></c8y-sub-assets-grid>\n'}]}],O.ctorParameters=function(){return[{type:s.Permissions},{type:b}]};var _=function(){function e(e,n,s){this.alert=e,this.subAssetsService=n,this.inventoryService=s,this.refresh=new t.EventEmitter,this.onCancel=new t.EventEmitter,this.onShowChildDevices=new t.EventEmitter,this.selectedDevice=new t.EventEmitter,this.pendingStatus=!1,this.pagination={pageSize:20,currentPage:1},this.selected=[],this.canAssignDevice=!1,this.actionControls=[],this.isSelectable=!0}return e.prototype.onEnterKeyDown=function(e){this.selected.length>0&&this.assignDevices()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.setNotIncludedInGroupQuery(),e=this,[4,this.subAssetsService.canAssignDevice({id:this.currentGroupId})];case 1:return e.canAssignDevice=t.sent(),[2]}}))}))},e.prototype.setNotIncludedInGroupQuery=function(){var e={__not:{__bygroupid:this.currentGroupId}};this.baseQuery=e},e.prototype.setActionControls=function(e){var t=this,n=[],r={type:"SELECT_CHILDREN",icon:"enter-bottom",text:s.gettext("Select children"),callback:function(e){return t.selectChildren(e)},showIf:function(e){return e.childDevices.references.length>0}};e&&n.push(r),this.actionControls=n,this.refresh.emit()},e.prototype.assignDevices=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:if(!1===this.canAssignDevice)return[2];this.pendingStatus=!0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.inventoryService.childAssetsBulkAdd(this.selected,this.currentGroupId)];case 2:return t.sent(),this.refresh.emit(),this.alert.success(s.gettext("Devices assigned to the group.")),[3,4];case 3:return e=t.sent(),this.alert.danger(s.gettext("Could not assign devices to the group"),e),[3,4];case 4:return this.pendingStatus=!1,this.selected=[],this.onCancel.emit(),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e.prototype.selectChildren=function(e){this.onShowChildDevices.emit(!0),this.selectedDevice.emit(e)},e}();_.decorators=[{type:t.Component,args:[{selector:"c8y-assign-devices",template:'<div class="card-block flex-no-shrink separator-bottom col-xs-12 large-padding p-t-24 p-b-24">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'Assign devices\' | translate }}\n </h4>\n </div>\n </div>\n</div>\n<c8y-device-grid\n [title]="\'Select target devices\' | translate"\n [actionControls]="actionControls"\n [infiniteScroll]="\'auto\'"\n [selectable]="isSelectable"\n [pagination]="pagination"\n (itemsSelect)="onSelected($event)"\n [refresh]="refresh"\n [baseQuery]="baseQuery"\n (onChildDevices)="setActionControls($event)"\n [showChildDevices]="{ show: true, value: false }"\n class="flex-grow col-xs-12 no-gutter"\n>\n <div class="c8y-empty-state">\n <h1 c8yIcon="search"></h1>\n <div>\n <p>\n <strong>{{ \'No matching devices.\' | translate }}</strong>\n </p>\n <small>{{ \'Refine your search terms\' | translate }}</small>\n </div>\n </div>\n</c8y-device-grid>\n\n<div class="text-center card-footer p-24 separator">\n <button\n (click)="onCancel.emit()"\n type="button"\n class="btn btn-default"\n title="{{ \'Cancel\' | translate }}"\n >\n <span>{{ \'Cancel\' | translate }}</span>\n </button>\n <button\n (click)="assignDevices()"\n type="button"\n class="btn btn-primary"\n [ngClass]="{ \'btn-pending\': pendingStatus }"\n title="{{ \'Assign\' | translate }}"\n [disabled]="selected.length === 0 || !canAssignDevice"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'}]}],_.ctorParameters=function(){return[{type:s.AlertService},{type:b},{type:n.InventoryService}]},_.propDecorators={currentGroupId:[{type:t.Input}],refresh:[{type:t.Input}],onCancel:[{type:t.Output}],onShowChildDevices:[{type:t.Output}],selectedDevice:[{type:t.Output}],onEnterKeyDown:[{type:t.HostListener,args:["document:keydown.enter",["$event"]]}],onEscapeKeyDown:[{type:t.HostListener,args:["document:keydown.escape",["$event"]]}]};var R=function(){function e(e,n,s){this.alert=e,this.subAssetsService=n,this.inventoryService=s,this.onCancel=new t.EventEmitter,this.refresh=new t.EventEmitter,this.selected=[],this.canAssignDevice=!1,this.pendingStatus=!1}return e.prototype.onEnterKeyDown=function(e){this.selected.length>0&&this.assignDevices()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.setNotIncludedInGroupQuery(),e=this,[4,this.subAssetsService.canAssignDevice({id:this.currentGroupId})];case 1:return e.canAssignDevice=t.sent(),[2]}}))}))},e.prototype.setNotIncludedInGroupQuery=function(){var e={__not:{__bygroupid:this.currentGroupId}};this.baseQuery=e},e.prototype.assignDevices=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:if(!1===this.canAssignDevice)return[2];this.pendingStatus=!0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.inventoryService.childAssetsBulkAdd(this.selected,this.currentGroupId)];case 2:return t.sent(),this.refresh.emit(),this.alert.success(s.gettext("Child devices assigned to the group.")),[3,4];case 3:return e=t.sent(),this.alert.danger(s.gettext("Could not assign child devices to the group"),e),[3,4];case 4:return this.pendingStatus=!1,this.selected=[],this.onCancel.emit(),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e}();R.decorators=[{type:t.Component,args:[{selector:"c8y-assign-child-devices",template:'<div class="card-block flex-no-shrink separator-bottom col-xs-12 large-padding p-t-24 p-b-24">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'Assign child devices\' | translate }}\n </h4>\n </div>\n </div>\n</div>\n\n<div class="d-flex d-col no-align-items fit-h">\n <c8y-sub-assets-grid\n [title]="\'Select target child devices\' | translate"\n [emptyStateText]="\'All child devices are already assigned to the group\' | translate"\n [refresh]="refresh"\n [actionControls]="[]"\n [selectable]="true"\n [parent-group]="parentDevice"\n [baseQuery]="baseQuery"\n (itemsSelect)="onSelected($event)"\n class="d-contents"\n >\n </c8y-sub-assets-grid>\n</div>\n\n<div class="text-center card-footer p-24 separator">\n <button\n (click)="onCancel.emit()"\n type="button"\n class="btn btn-default"\n title="{{ \'Cancel\' | translate }}"\n >\n <span>{{ \'Cancel\' | translate }}</span>\n </button>\n <button\n (click)="assignDevices()"\n type="button"\n class="btn btn-primary"\n [ngClass]="{ \'btn-pending\': pendingStatus }"\n title="{{ \'Assign\' | translate }}"\n [disabled]="selected.length === 0 || !canAssignDevice"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'}]}],R.ctorParameters=function(){return[{type:s.AlertService},{type:b},{type:n.InventoryService}]},R.propDecorators={currentGroupId:[{type:t.Input}],parentDevice:[{type:t.Input}],onCancel:[{type:t.Output}],refresh:[{type:t.Input}],onEnterKeyDown:[{type:t.HostListener,args:["document:keydown.enter",["$event"]]}],onEscapeKeyDown:[{type:t.HostListener,args:["document:keydown.escape",["$event"]]}]};var N=[{context:s.ViewContext.Group,path:"subassets",priority:1e3,icon:"c8y-group-open",label:s.gettext("Subassets"),component:G},{path:"group",component:O}],k=function(){};k.decorators=[{type:t.NgModule,args:[{declarations:[G,C,f,O,S,A,D,_,R],imports:[s.CoreModule,o.DeviceGridModule,E,l.PopoverModule],entryComponents:[G,f,O,A,D],exports:[],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:N,multi:!0},b]}]}],e.AddGroupComponent=I,e.AddGroupModule=E,e.AddGroupService=w,e.AssetTypeCellRendererComponent=f,e.AssetTypeGridColumn=y,e.AssignChildDevicesComponent=R,e.AssignDevicesComponent=_,e.DeleteAssetsModalComponent=A,e.GroupInfoComponent=S,e.GroupsComponent=O,e.SubAssetsComponent=G,e.SubAssetsGridComponent=C,e.SubAssetsModule=k,e.SubAssetsService=b,e.UnassignModalComponent=D,e.ɵ0=N,e.ɵa=f,e.ɵb=A,e.ɵc=D,e.ɵd=E,e.ɵe=I,e.ɵf=w,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */var d=function(e,t){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function h(e,t){function n(){this.constructor=e}d(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function v(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{c(s.next(e))}catch(e){i(e)}}function a(e){try{c(s.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function g(e,t){var n,s,r,i,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,s&&(r=2&i[0]?s.return:i[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,i[1])).done)return r;switch(s=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,s=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){o.label=i[1];break}if(6===i[0]&&o.label<r[1]){o.label=r[1],r=i;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(i);break}r[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],s=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var s,r,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}var f=function(){function e(e,t){this.context=e,this.deviceGroupService=t}return e.prototype.ngOnInit=function(){this.isAnyGroup=this.deviceGroupService.isAnyGroup(this.context.item),this.isDevice=this.deviceGroupService.isDevice(this.context.item),this.groupIcon=this.deviceGroupService.icon(this.context.item),this.iconTitle=this.getIconTitle(this.groupIcon)},e.prototype.getIconTitle=function(e){switch(e){case"c8y-group":return s.gettext("Group");case"c8y-group-smart":return s.gettext("Smart group");case"c8y-group-remote-inactive":return"Inactive remote group";case"c8y-group-remote":return s.gettext("Remote group");default:return s.gettext("Child device")}},e}();f.decorators=[{type:t.Component,args:[{template:'<device-status class="m-l-8" [mo]="context.item" *ngIf="isDevice"></device-status>\n<i\n [c8yIcon]="groupIcon"\n title="{{ iconTitle | translate }}"\n class="m-l-8 c8y-icon-duocolor"\n *ngIf="isAnyGroup || !isDevice"\n></i>\n'}]}],f.ctorParameters=function(){return[{type:s.CellRendererContext},{type:r.DeviceGroupService}]};var y=function(e){function t(t){var n=e.call(this,t)||this;return n.name="type",n.header=s.gettext("Type"),n.dataType="icon",n.cellRendererComponent=f,n.sortable=!0,n.sortingConfig={pathSortingConfigs:[{path:"c8y_IsDeviceGroup"}]},n}return h(t,e),t}(o.BaseDeviceGridColumn),b=function(e){function t(t,n,s,r,i,o,a,c,u,l,p){var d=e.call(this,n,t,u,p)||this;return d.translateService=t,d.inventoryService=n,d.appState=s,d.user=r,d.assetNodeService=i,d.deviceGroupService=o,d.smartGroupsService=a,d.smartRulesService=c,d.alertService=u,d.permissionsService=l,d.modal=p,d.GRID_CONFIG_DEFAULT_STORAGE_KEY="sub-assets-grid-config",d.IS_DEVICE_GROUP_FRAGMENT="c8y_IsDeviceGroup",d.IS_DYNAMIC_GROUP_FRAGMENT="c8y_IsDynamicGroup",d}return h(t,e),t.prototype.getDefaultColumns=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),[new y({sortOrder:"desc"}),new o.NameDeviceGridColumn({sortOrder:"asc"}),new o.ModelDeviceGridColumn,new o.SerialNumberDeviceGridColumn({visible:!1}),new o.RegistrationDateDeviceGridColumn({visible:!1}),new o.SystemIdDeviceGridColumn({visible:!1}),new o.ImeiDeviceGridColumn({visible:!1}),new o.AlarmsDeviceGridColumn]},t.prototype.getDefaultPagination=function(){return{pageSize:this.getConfig().pagination.pageSize,currentPage:1}},t.prototype.getDefaultActionControls=function(){return[]},t.prototype.unassignAsset=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i;return g(this,(function(o){switch(o.label){case 0:if(n=e.id,r=t.id,!this.isDevice(e))return[3,6];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.inventoryService.childAssetsRemove(n,r)];case 2:return o.sent(),i=this.translateService.instant(s.gettext("Asset unassigned.")),this.alertService.success(i),[3,4];case 3:return o.sent(),i=this.translateService.instant(s.gettext("Could not unassign asset.")),this.alertService.danger(i),[3,4];case 4:return[4,this.deactivateSmartrulesForAsset(e,t)];case 5:o.sent(),o.label=6;case 6:return[2]}}))}))},t.prototype.isDevice=function(e){return!e.hasOwnProperty(this.IS_DEVICE_GROUP_FRAGMENT)&&!e.hasOwnProperty(this.IS_DYNAMIC_GROUP_FRAGMENT)},t.prototype.deleteAsset=function(e,t,n){return void 0===n&&(n={}),v(this,void 0,void 0,(function(){return g(this,(function(s){switch(s.label){case 0:return e.hasOwnProperty(this.IS_DEVICE_GROUP_FRAGMENT)||this.smartGroupsService.isSmartGroup(e)?[4,this.deleteGroup(e,n)]:[3,2];case 1:return s.sent(),[3,4];case 2:return[4,this.deleteDevice(e,n)];case 3:s.sent(),s.label=4;case 4:return!t||this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)?[3,6]:[4,this.deactivateSmartrulesForAsset(e,t)];case 5:s.sent(),s.label=6;case 6:return[2]}}))}))},t.prototype.shouldShowWithDeviceUserCheckbox=function(e){var t=e.owner,n=e.c8y_IsDevice,s=e.owner&&this.isDeviceUser(t);return Boolean(n&&s)},t.prototype.getDefaultBulkActionControls=function(){return[]},t.prototype.getData=function(e,t,n,s){return void 0===s&&(s={}),v(this,void 0,void 0,(function(){var r,i;return g(this,(function(o){return!n?(r=this.buildCombinedRootQueryFilter(e,t),[2,this.assetNodeService.getRootNodes(Object.assign(Object.assign({},t),{query:r}))]):(i=Object.assign(Object.assign({},this.getAssetsFilters(e,t,s)),{withParents:!1}),this.deviceGroupService.isGroup(n)?[2,this.assetNodeService.getGroupItems(n.id,i)]:this.deviceGroupService.isDynamicGroup(n)?[2,this.assetNodeService.getDynamicGroupItems(n.c8y_DeviceQueryString,i)]:this.deviceGroupService.isDevice(n)?[2,this.assetNodeService.getDeviceChildren(n.id,i)]:[2])}))}))},t.prototype.getCount=function(e,t,n,s){return void 0===s&&(s={}),v(this,void 0,void 0,(function(){var r,i;return g(this,(function(o){return r={pageSize:1,withChildren:!1},i=n?Object.assign(Object.assign({},this.getAssetsFilters(e,t,s)),r):Object.assign({query:this.buildCombinedRootQueryFilter(e,t)},r),[2,this.getAssetsStatistics(n,i)]}))}))},t.prototype.getTotal=function(e,t){void 0===t&&(t={});var n=this.assetNodeService.rootQueryFilter(),s=e?t:this.queriesUtil.addAndFilter(n,t),r={query:this.queriesUtil.buildQuery(s),withChildren:!1,withTotalPages:!0,pageSize:1};return this.getAssetsStatistics(e,r)},t.prototype.canEditGroup=function(e){return v(this,void 0,void 0,(function(){return g(this,(function(t){switch(t.label){case 0:return[4,this.permissionsService.canEdit(["ROLE_INVENTORY_ADMIN"],e)];case 1:return[2,t.sent()]}}))}))},t.prototype.canCreateGroup=function(){var e=this.appState.currentUser.value;return this.user.hasAnyRole(e,["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_CREATE"])},t.prototype.canAssignDevice=function(e){return v(this,void 0,void 0,(function(){return g(this,(function(t){switch(t.label){case 0:return[4,this.permissionsService.canEdit(["ROLE_INVENTORY_ADMIN"],e)];case 1:return[2,t.sent()]}}))}))},t.prototype.canEditSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_UPDATE","ROLE_SMARTGROUP_ADMIN"])},t.prototype.canDeleteSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_ADMIN","ROLE_INVENTORY_ADMIN"])},t.prototype.isSmartGroup=function(e){return this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)},t.prototype.isUsingInventoryRoles=function(){var e=this.appState.currentUser.value;return!this.user.hasAnyRole(e,["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_READ","ROLE_INVENTORY_CREATE"])},t.prototype.getAssetsStatistics=function(e,t){return v(this,void 0,void 0,(function(){return g(this,(function(n){switch(n.label){case 0:return!e?[4,this.assetNodeService.getRootNodes(t)]:[3,2];case 1:return[2,n.sent().paging.totalPages];case 2:return this.deviceGroupService.isGroup(e)?[4,this.assetNodeService.getGroupItems(e.id,t)]:[3,4];case 3:return[2,n.sent().paging.totalPages];case 4:return this.deviceGroupService.isDynamicGroup(e)?[4,this.assetNodeService.getDynamicGroupItems(e.c8y_DeviceQueryString,t)]:[3,6];case 5:return[2,n.sent().paging.totalPages];case 6:return this.deviceGroupService.isDevice(e)?[4,this.assetNodeService.getDeviceChildren(e.id,t)]:[3,8];case 7:return[2,n.sent().paging.totalPages];case 8:return[2]}}))}))},t.prototype.buildCombinedRootQueryFilter=function(e,t){var n=this.assetNodeService.rootQueryFilter(),s=this.getQueryObj(e,t),r=this.queriesUtil.addOrderbys(n,s.__orderby,"append"),i=this.queriesUtil.addAndFilter(r,s.__filter);return this.queriesUtil.buildQuery(i)},t.prototype.deleteGroup=function(e,t){return void 0===t&&(t={}),v(this,void 0,void 0,(function(){var n,r;return g(this,(function(i){switch(i.label){case 0:n=t.cascade,i.label=1;case 1:return i.trys.push([1,6,,7]),this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)?[4,this.smartGroupsService.delete(e,{cascade:n})]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this.inventoryService.delete(e,{cascade:n})];case 4:i.sent(),i.label=5;case 5:return r=this.translateService.instant(s.gettext("Asset deleted.")),this.alertService.success(r),[3,7];case 6:return i.sent(),r=this.translateService.instant(s.gettext("Could not delete asset.")),this.alertService.danger(r),[3,7];case 7:return[2]}}))}))},t.prototype.deleteDevice=function(e,t){return void 0===t&&(t={}),v(this,void 0,void 0,(function(){var n,r,i,o;return g(this,(function(a){switch(a.label){case 0:n=t.cascade,r=t.withDeviceUser,a.label=1;case 1:return a.trys.push([1,6,,7]),i=e.owner,r&&i&&this.isDeviceUser(i)?[4,this.deleteDeviceWithUser(e,n)]:[3,3];case 2:return a.sent(),[3,5];case 3:return[4,this.inventoryService.delete(e,{cascade:n})];case 4:a.sent(),a.label=5;case 5:return o=this.translateService.instant(s.gettext("Asset deleted.")),this.alertService.success(o),[3,7];case 6:return a.sent(),o=this.translateService.instant(s.gettext("Could not delete asset.")),this.alertService.danger(o),[3,7];case 7:return[2]}}))}))},t.prototype.deactivateSmartrulesForAsset=function(e,t){return v(this,void 0,void 0,(function(){var n,r,i,o,a,c=this;return g(this,(function(u){switch(u.label){case 0:return n=e.id,r=t.id,[4,this.smartRulesService.listByContext(r)];case 1:i=u.sent().data,o=i.map((function(e){return c.smartRulesService.bulkDeactivateEnabledSources(e,[n])})),u.label=2;case 2:return u.trys.push([2,4,,5]),[4,Promise.all(o)];case 3:return u.sent(),[3,5];case 4:return u.sent(),a=this.translateService.instant(s.gettext("Could not deactivate smart rules.")),this.alertService.danger(a),[3,5];case 5:return[2]}}))}))},t.prototype.isDeviceUser=function(e){return e.match(/^device_/)},t.prototype.deleteDeviceWithUser=function(e,t){return v(this,void 0,void 0,(function(){var n;return g(this,(function(s){switch(s.label){case 0:n={cascade:t,withDeviceUser:!0},s.label=1;case 1:return s.trys.push([1,3,,5]),[4,this.inventoryService.delete(e,n)];case 2:return[2,s.sent()];case 3:return s.sent(),[4,this.inventoryService.delete(e,{cascade:t})];case 4:return[2,s.sent()];case 5:return[2]}}))}))},t.prototype.getAssetsFilters=function(e,t,n){var s=this.queriesUtil.addAndFilter(this.getQueryObj(e),n);return{query:this.queriesUtil.buildQuery(s),pageSize:t.pageSize||this.DEFAULT_PAGE_SIZE,currentPage:t.currentPage,withTotalPages:!0}},t}(o.DeviceGridService);b.decorators=[{type:t.Injectable}],b.ctorParameters=function(){return[{type:i.TranslateService},{type:n.InventoryService},{type:s.AppStateService},{type:n.UserService},{type:r.AssetNodeService},{type:r.DeviceGroupService},{type:n.SmartGroupsService},{type:n.SmartRulesService},{type:s.AlertService},{type:s.Permissions},{type:s.ModalService}]};var S=function(){function e(e,n,r,i,o,a,c){this.inventory=e,this.subAssetsService=n,this.deviceGroupService=r,this.smartGroupsService=i,this.alertService=o,this.translate=a,this.modalService=c,this.onGroupChange=new t.EventEmitter,this.filterMsg=s.gettext("Smart groups are groups dynamically constructed based on filtering criteria."),this.canEditMsg=s.gettext("You can edit the filter here."),this.GROUP_UPDATED_MSG=s.gettext("Group updated.")}return e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e,t;return g(this,(function(n){switch(n.label){case 0:return e=this,this.smartGroupsService.isSmartGroupV2(this.group)?(t=this.subAssetsService.canEditSmartGroup(),[3,3]):[3,1];case 1:return[4,this.subAssetsService.canEditGroup(this.group)];case 2:t=n.sent(),n.label=3;case 3:return e.canEdit=t,this.groupIcon=this.deviceGroupService.icon(this.group),this.smartGroupFilter=this.group.c8y_DeviceQueryString,this.setHintMsg(),[2]}}))}))},e.prototype.isSmartGroup=function(){return this.subAssetsService.isSmartGroup(this.group)},e.prototype.update=function(e){return v(this,void 0,void 0,(function(){var t;return g(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),this.subAssetsService.isSmartGroup(this.group)?[4,this.updateSmartGroup(e)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,this.updateGroup(e)];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return t=n.sent(),this.alertService.addServerFailure(t),[3,6];case 6:return[2]}}))}))},e.prototype.setHintMsg=function(){var e=this.translate.instant(this.filterMsg),t=this.translate.instant(this.canEditMsg);this.filterHintMsg=this.canEdit?e+" "+t:this.filterMsg},e.prototype.updateGroup=function(e){return v(this,void 0,void 0,(function(){var t,n,s;return g(this,(function(r){switch(r.label){case 0:return t=this.group.id,n=Object.assign({id:t},e),[4,this.inventory.update(n)];case 1:return s=r.sent().data,this.setGroup(s),[2]}}))}))},e.prototype.updateSmartGroup=function(e){return v(this,void 0,void 0,(function(){var t,n,r,i,o,a;return g(this,(function(c){switch(c.label){case 0:return t=this.group.id,n=e.c8y_DeviceQueryString,r=Object.assign({id:t},e),n?[3,2]:[4,this.smartGroupsService.update(r)];case 1:return i=c.sent().data,this.setGroup(i),[2];case 2:return c.trys.push([2,5,,6]),o=s.gettext("You are about to change the smart group filter. Do you want to proceed?"),a=s.gettext("Smart group filter"),[4,this.modalService.confirm(a,o,s.Status.WARNING,{ok:s.gettext("Save"),cancel:s.gettext("Cancel")})];case 3:return c.sent(),[4,this.isQueryExecutable(n)];case 4:return c.sent()?[3,6]:[2];case 5:return c.sent(),[2];case 6:return[4,this.smartGroupsService.update(r)];case 7:return i=c.sent().data,this.setGroup(i),[2]}}))}))},e.prototype.setGroup=function(e){this.onGroupChange.emit(e),this.alertService.success(this.GROUP_UPDATED_MSG)},e.prototype.isQueryExecutable=function(e){return v(this,void 0,void 0,(function(){var t,n;return g(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t={q:e},[4,this.inventory.list(t)];case 1:return s.sent(),[2,!0];case 2:return n=s.sent(),this.alertService.addServerFailure(n),[2,!1];case 3:return[2]}}))}))},e}();S.decorators=[{type:t.Component,args:[{selector:"c8y-group-info",template:'<div class="bg-gray-white">\n <div class="card-block p-t-24 p-b-24 large-padding">\n <div class="content-flex-70">\n <div class="text-center">\n <i class="c8y-icon-duocolor icon-48" [c8yIcon]="groupIcon + \'-open\'"></i>\n <p>\n <small class="label label-info" *ngIf="group.c8y_IsDynamicGroup">\n {{ \'Smart group\' | translate }}\n </small>\n <small\n class="label label-info"\n *ngIf="!group.c8y_IsDynamicGroup && !group.com_cumulocity_model_Agent"\n >\n {{ \'Group\' | translate }}\n </small>\n <small class="label label-info" *ngIf="group.com_cumulocity_model_Agent">\n {{ \'Remote group\' | translate }}\n </small>\n </p>\n </div>\n\n <div class="flex-grow col-10">\n <div class="content-flex-80">\n <div class="col-9">\n <form #groupNameForm="ngForm">\n <c8y-form-group class="form-group-lg m-b-0">\n <label class="sr-only" translate>\n Name\n </label>\n\n <p *ngIf="!canEdit" class="form-control-static">{{ group.name }}</p>\n <div *ngIf="canEdit" class="input-group input-group-editable">\n <input\n type="text"\n class="form-control"\n [(ngModel)]="group.name"\n name="name"\n title="{{ \'Name\' | translate }}"\n size="{{ group.name.length + 2 }}"\n placeholder="{{ \'e.g. My group\' | translate }}"\n maxlength="254"\n required\n />\n <span></span>\n <div class="input-group-btn">\n <button\n (click)="update({ name: group.name }); groupNameForm.form.markAsPristine()"\n class="btn btn-primary"\n title="{{ \'Save\' | translate }}"\n [disabled]="groupNameForm.form.invalid"\n >\n {{ \'Save\' | translate }}\n </button>\n </div>\n </div>\n </c8y-form-group>\n </form>\n <form #groupDescriptionForm="ngForm">\n <label class="sr-only" translate>\n Description\n </label>\n <p *ngIf="!canEdit" class="form-control-static">{{ group.c8y_Notes }}</p>\n <div *ngIf="canEdit" class="input-group input-group-editable">\n <textarea\n class="form-control"\n [(ngModel)]="group.c8y_Notes"\n name="description"\n title="{{ \'Description\' | translate }}"\n cols="{{ group.c8y_Notes ? group.c8y_Notes.length : 25 }}"\n placeholder="{{ \'e.g. My description\' | translate }}"\n ></textarea>\n <span></span>\n <div class="input-group-btn">\n <button\n (click)="\n update({ c8y_Notes: group.c8y_Notes });\n groupDescriptionForm.form.markAsPristine()\n "\n class="btn btn-primary"\n title="{{ \'Save\' | translate }}"\n [disabled]="groupDescriptionForm.form.invalid"\n >\n {{ \'Save\' | translate }}\n </button>\n </div>\n </div>\n </form>\n\n <form #smartGroupFilterForm="ngForm" *ngIf="isSmartGroup()">\n <c8y-form-group class="m-b-0 m-t-8">\n <label class="m-b-0 text-nowrap">\n {{ \'Smart group filter\' | translate }}\n <button\n class="btn-clean text-primary m-r-4"\n type="button"\n popover="{{ filterHintMsg | translate }}"\n triggers="focus"\n >\n <i c8yIcon="question-circle-o"></i>\n </button>\n </label>\n\n <p *ngIf="!canEdit" class="form-control-static">\n {{ smartGroupFilter }}\n </p>\n <div *ngIf="canEdit" class="input-group input-group-editable">\n <input\n type="text"\n class="form-control"\n [(ngModel)]="smartGroupFilter"\n name="filter"\n size="{{ smartGroupFilter.length + 2 }}"\n placeholder="{{ \'e.g.\' | translate }} $filter=(id eq \'12*\')"\n maxlength="254"\n title="{{ \'Smart group filter\' | translate }}"\n />\n <span></span>\n <div class="input-group-btn">\n <button\n (click)="\n update({ c8y_DeviceQueryString: smartGroupFilter });\n smartGroupFilterForm.form.markAsPristine()\n "\n class="btn btn-primary"\n title="{{ \'Save\' | translate }}"\n [disabled]="smartGroupFilterForm.form.invalid"\n >\n {{ \'Save\' | translate }}\n </button>\n </div>\n </div>\n </c8y-form-group>\n </form>\n </div>\n <div class="flex-grow">\n <p class="m-b-8">\n <i c8yIcon="info-circle" class="text-info m-r-8"></i>\n <span class="text-label-small">{{ \'Group info\' | translate }}</span>\n </p>\n <ul class="list-unstyled small">\n <li class="p-t-4 p-b-4 flex-row separator-top-bottom text-nowrap">\n <label class="small m-b-0 m-r-8">{{ \'Created\' | translate }}</label>\n <span class="flex-item-right">{{ group.creationTime | c8yDate }}</span>\n </li>\n <li class="p-t-4 p-b-4 flex-row separator-bottom text-nowrap">\n <label class="small m-b-0 m-r-8">{{ \'Last updated\' | translate }}</label>\n <span class="flex-item-right">{{ group.lastUpdated | c8yDate }}</span>\n </li>\n\n <li\n *ngIf="group.com_cumulocity_model_Agent"\n class="p-t-4 p-b-4 flex-row separator-bottom text-nowrap"\n >\n <label class="small m-b-0 m-r-8">{{ \'Status\' | translate }}</label>\n <span class="flex-item-right" *ngIf="group.c8y_BrokerSource">\n {{ group.c8y_BrokerSource.status }}\n </span>\n <span class="flex-item-right" *ngIf="!group.c8y_BrokerSource">\n {{ \'Offline\' | translate }}\n </span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n'}]}],S.ctorParameters=function(){return[{type:n.InventoryService},{type:b},{type:r.DeviceGroupService},{type:n.SmartGroupsService},{type:s.AlertService},{type:i.TranslateService},{type:s.ModalService}]},S.propDecorators={group:[{type:t.Input}],onGroupChange:[{type:t.Output}]};var G=function(){function e(e,n,s,r){var i=this;this.route=e,this.appState=n,this.deviceGroupService=s,this.subAssetsService=r,this.toggle=!1,this.showAddGroup=!1,this.showAssignDevices=!1,this.showGroupInfo=!0,this.showAssignChildDevices=!1,this.refresh=new t.EventEmitter,this.filterable=!0,this.shouldDisableAddGroup=!1,this.shouldDisableAssignDevices=!1,this.dataSub=this.route.parent.data.subscribe((function(e){var t=e.contextData;i.title=t.name,i.currentGroupId=t.id,i.group=t,i.filterable=!i.deviceGroupService.isDynamicGroup(t)}))}return e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e,t=this;return g(this,(function(n){switch(n.label){case 0:return this.appState.state$.subscribe((function(e){t.showGroupInfo="cockpit"===e.app.name||"devicemanagement"===e.app.name})),this.shouldDisableAddGroup=!this.subAssetsService.canCreateGroup(),e=this,[4,!this.subAssetsService.canAssignDevice(this.group)];case 1:return e.shouldDisableAssignDevices=n.sent(),this.displayOptions={striped:!0,bordered:!1,gridHeader:!0,filter:!this.isSmartGroup()},[2]}}))}))},e.prototype.groupChange=function(e){Object.assign(this.group,e),this.title=e.name,this.refresh.emit()},e.prototype.isSmartGroup=function(){return this.subAssetsService.isSmartGroup(this.group)},e.prototype.ngOnDestroy=function(){this.dataSub&&this.dataSub.unsubscribe()},e}();G.decorators=[{type:t.Component,args:[{selector:"c8y-sub-assets",template:'<c8y-title>\n {{ title }}\n</c8y-title>\n\n<c8y-action-bar-item [placement]="\'right\'" *ngIf="!isSmartGroup()">\n <button\n class="btn btn-link"\n title="{{ \'Add group\' | translate }}"\n (click)="showAddGroup = !showAddGroup"\n [disabled]="shouldDisableAddGroup"\n >\n <i c8yIcon="plus-circle" class="m-r-4"></i><span translate>Add group</span>\n </button>\n</c8y-action-bar-item>\n\n<c8y-action-bar-item [placement]="\'right\'" *ngIf="!isSmartGroup()">\n <button\n class="btn btn-link"\n title="{{ \'Assign devices\' | translate }}"\n (click)="showAssignDevices = !showAssignDevices"\n [disabled]="shouldDisableAssignDevices"\n >\n <i c8yIcon="plus-circle" class="m-r-4"></i><span translate>Assign devices</span>\n </button>\n</c8y-action-bar-item>\n\n<div class="card content-fullpage d-flex d-col">\n <c8y-group-info\n *ngIf="showGroupInfo"\n [group]="group"\n (onGroupChange)="groupChange($event)"\n ></c8y-group-info>\n <c8y-sub-assets-grid\n [refresh]="refresh"\n [parent-group]="group"\n [filterable]="filterable"\n [displayOptions]="displayOptions"\n class="d-contents"\n ></c8y-sub-assets-grid>\n</div>\n\n<div [ngClass]="{ drawerOpen: showAddGroup }">\n <div class="bottom-drawer">\n <c8y-add-group\n [currentGroupId]="currentGroupId"\n [refresh]="refresh"\n (onCancel)="showAddGroup = false"\n *ngIf="showAddGroup"\n ></c8y-add-group>\n </div>\n</div>\n\n<div [ngClass]="{ drawerOpen: showAssignDevices }">\n <div class="bottom-drawer">\n <div class="d-flex d-col no-align-items fit-h">\n <c8y-assign-devices\n class="d-contents"\n (onCancel)="showAssignDevices = false"\n [refresh]="refresh"\n [currentGroupId]="currentGroupId"\n (onShowChildDevices)="showAssignChildDevices=$event"\n (selectedDevice)="showChildrenForDevice=$event"\n *ngIf="showAssignDevices"\n ></c8y-assign-devices>\n </div>\n </div>\n</div>\n\n<div [ngClass]="{ drawerOpen: showAssignChildDevices }" >\n <div class="bottom-drawer m-t-40">\n <div class="d-flex d-col no-align-items fit-h">\n <c8y-assign-child-devices\n *ngIf="showAssignChildDevices"\n class="d-contents"\n (onCancel)="showAssignChildDevices = false"\n [refresh]="refresh"\n [currentGroupId]="currentGroupId"\n [parentDevice]="showChildrenForDevice"\n ></c8y-assign-child-devices>\n </div>\n </div>\n</div>\n'}]}],G.ctorParameters=function(){return[{type:a.ActivatedRoute},{type:s.AppStateService},{type:r.DeviceGroupService},{type:b}]};var A=function(){function e(e){this.translateService=e,this.showWithCascadeCheckbox=!0,this.showWithDeviceUserCheckbox=!1,this.closeSubject=new u.Subject,this.labels={ok:s.gettext("Delete"),cancel:s.gettext("Cancel")},this.title=s.gettext("Delete asset"),this.status=s.Status.DANGER,this.config={cascade:!1,withDeviceUser:!1}}return e.prototype.ngOnInit=function(){this.message=this.translateService.instant(s.gettext('You are about to delete asset: "{{name}}". This operation is irreversible. Do you want to proceed?'),{name:this.asset.name})},e.prototype.ngAfterViewInit=function(){return v(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.modalRef.result];case 1:return e.sent(),this.onClose(),[3,3];case 2:return e.sent(),this.onDismiss(),[3,3];case 3:return[2]}}))}))},e.prototype.onClose=function(){this.closeSubject.next(this.config),this.closeSubject.complete()},e.prototype.onDismiss=function(){this.closeSubject.complete()},e}();A.decorators=[{type:t.Component,args:[{selector:"c8y-delete-assets-modal",template:'<c8y-confirm-modal [title]="title" [status]="status" [labels]="labels" #modalRef>\n <form #assetsForm="ngForm">\n <p class="text-wrap m-b-16">\n {{ message | translate }}\n </p>\n <c8y-form-group *ngIf="showWithCascadeCheckbox" class="m-b-0">\n <label title="{{ \'Delete devices\' | translate }}" class="c8y-checkbox">\n <input type="checkbox" name="cascade" [(ngModel)]="config.cascade" />\n <span></span>\n <span>\n {{ \'Also delete all devices inside selected asset and its subassets.\' | translate }}\n </span>\n </label>\n </c8y-form-group>\n <c8y-form-group *ngIf="showWithDeviceUserCheckbox" class="m-b-0">\n <label title="{{ \'Delete associated device owner\' | translate }}" class="c8y-checkbox">\n <input type="checkbox" name="withDeviceUser" [(ngModel)]="config.withDeviceUser" />\n <span></span>\n <span>\n {{ \'Also delete associated device owner.\' | translate }}\n </span>\n </label>\n </c8y-form-group>\n </form>\n</c8y-confirm-modal>\n'}]}],A.ctorParameters=function(){return[{type:i.TranslateService}]},A.propDecorators={showWithCascadeCheckbox:[{type:t.Input}],showWithDeviceUserCheckbox:[{type:t.Input}],asset:[{type:t.Input}],modalRef:[{type:t.ViewChild,args:["modalRef",{static:!1}]}]};var D=function(){function e(e){this.translateService=e,this.closeSubject=new u.Subject,this.labels={ok:s.gettext("Unassign"),cancel:s.gettext("Cancel")},this.title=s.gettext("Unassign asset"),this.status=s.Status.WARNING}return e.prototype.ngOnInit=function(){this.message=this.translateService.instant(s.gettext('You are about to unassign asset "{{name}}". Do you want to proceed?'),{name:this.asset.name})},e.prototype.ngAfterViewInit=function(){return v(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.modalRef.result];case 1:return e.sent(),this.onClose(),[3,3];case 2:return e.sent(),this.onDismiss(),[3,3];case 3:return[2]}}))}))},e.prototype.onClose=function(){this.closeSubject.next(!0),this.closeSubject.complete()},e.prototype.onDismiss=function(){this.closeSubject.complete()},e}();D.decorators=[{type:t.Component,args:[{selector:"c8y-unassign-modal",template:'<c8y-confirm-modal [title]="title" [status]="status" [labels]="labels" #modalRef>\n <span>{{ message | translate }}</span>\n</c8y-confirm-modal>\n'}]}],D.ctorParameters=function(){return[{type:i.TranslateService}]},D.propDecorators={asset:[{type:t.Input}],modalRef:[{type:t.ViewChild,args:["modalRef",{static:!1}]}]};var C=function(){function e(e,n,r){this.subAssetsGridService=e,this.bsModalService=n,this.smartGroupsService=r,this.title=s.gettext("Subassets"),this.emptyStateText=s.gettext("Add your first group or assign devices using the buttons on the toolbar."),this.loadingItemsLabel=s.gettext("Loading assets…"),this.selectable=!1,this.baseQuery={},this.filterable=!0,this.sortable=!0,this.onColumnsChange=new t.EventEmitter,this.itemsSelect=new t.EventEmitter,this.pagination=this.subAssetsGridService.getDefaultPagination(),this.showCounterWarning=!1,this.bulkActionControls=this.subAssetsGridService.getDefaultBulkActionControls(),this.displayOptions={striped:!0,bordered:!1,gridHeader:!0,filter:!0},this.serverSideDataCallback=this.onDataSourceModifier.bind(this)}return Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(e){this._columns=e?this.subAssetsGridService.getUserConfiguredColumns(e):this.subAssetsGridService.getUserConfiguredColumns(this.subAssetsGridService.getDefaultColumns())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_pagination",{set:function(e){this.pagination=e||this.subAssetsGridService.getDefaultPagination()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_actionControls",{set:function(e){this.actionControls=e||this.subAssetsGridService.getDefaultActionControls()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_bulkActionControls",{set:function(e){this.bulkActionControls=e||this.subAssetsGridService.getDefaultBulkActionControls()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRootGroup",{get:function(){return!this.parentGroup},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getInfiniteScrollMode",{get:function(){return this.isRootGroup&&this.subAssetsGridService.isUsingInventoryRoles()?"auto":void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_displayOptions",{set:function(e){this.displayOptions=Object.assign(Object.assign({},this.displayOptions),e)},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.columns=this.subAssetsGridService.getDefaultColumns(this.filterable,this.sortable),this.filterable&&this.sortable||this.columns.forEach((function(t){t.filterable=e.filterable,t.sortable=e.sortable})),this.setActionControls()},e.prototype.setActionControls=function(){return v(this,void 0,void 0,(function(){var e,t,n,r,i=this;return g(this,(function(o){switch(o.label){case 0:return e=[],[4,this.smartGroupsService.isSmartGroupsV2MicroserviceInstalled()];case 1:return t=o.sent().data,n={type:"DELETE",callback:function(e){return i.onDeleteAsset(e,i.parentGroup)},showIf:function(e){return i.smartGroupsService.isSmartGroupV2(e)?!!t&&i.subAssetsGridService.canDeleteSmartGroup():!i.smartGroupsService.isSmartGroup(e)||i.subAssetsGridService.canDeleteSmartGroup()}},e.push(n),r={type:"UNASSIGN",icon:"unlink",text:s.gettext("Unassign"),callback:function(e){return i.onUnassignAsset(e,i.parentGroup)},showIf:function(e){return i.subAssetsGridService.isDevice(e)&&!i.subAssetsGridService.isSmartGroup(i.parentGroup)}},e.push(r),this.actionControls||(this.actionControls=e),[2]}}))}))},e.prototype.onUnassignAsset=function(e,t){var n=this,s={asset:e};this.bsModalService.show(D,{initialState:s}).content.closeSubject.subscribe((function(s){return v(n,void 0,void 0,(function(){return g(this,(function(n){switch(n.label){case 0:return s?[4,this.subAssetsGridService.unassignAsset(e,t)]:[3,2];case 1:n.sent(),this.refresh.emit(),n.label=2;case 2:return[2]}}))}))}))},e.prototype.onDeleteAsset=function(e,t){return v(this,void 0,void 0,(function(){var n,s=this;return g(this,(function(r){return n={showWithDeviceUserCheckbox:this.subAssetsGridService.shouldShowWithDeviceUserCheckbox(e),asset:e,showWithCascadeCheckbox:!this.smartGroupsService.isSmartGroup(e)&&!this.smartGroupsService.isSmartGroupV2(e)},this.bsModalService.show(A,{initialState:n}).content.closeSubject.subscribe((function(n){return v(s,void 0,void 0,(function(){return g(this,(function(s){switch(s.label){case 0:return n?[4,this.subAssetsGridService.deleteAsset(e,t,n)]:[3,2];case 1:s.sent(),this.showCounterWarning=!0,this.refresh.emit(),s.label=2;case 2:return[2]}}))}))})),[2]}))}))},e.prototype.ngOnChanges=function(e){e.parentGroup&&!e.parentGroup.firstChange&&this.dataGrid.reload()},e.prototype.trackByName=function(e,t){return t.name},e.prototype.onDataSourceModifier=function(e){return v(this,void 0,void 0,(function(){var t,n,s,r,i,o;return g(this,(function(a){switch(a.label){case 0:return(t=[]).push(this.subAssetsGridService.getData(e.columns,e.pagination,this.parentGroup,this.baseQuery)),t.push(this.subAssetsGridService.getTotal(this.parentGroup,this.baseQuery)),t.push(this.subAssetsGridService.getCount(e.columns,e.pagination,this.parentGroup,this.baseQuery)),[4,Promise.all(t)];case 1:return s=m.apply(void 0,[a.sent(),3]),r=s[0],i=s[1],o=s[2],n||(n={size:i,filteredSize:o}),this.onColumnsChange.emit(e.columns),[2,Object.assign({res:r.res,data:r.data,paging:r.paging},n)]}}))}))},e.prototype.configChange=function(e){this.subAssetsGridService.saveConfig(e)},e}();C.decorators=[{type:t.Component,args:[{selector:"c8y-sub-assets-grid",template:'<c8y-data-grid\n [title]="title"\n [loadingItemsLabel]="loadingItemsLabel"\n [columns]="columns"\n [pagination]="pagination"\n [actionControls]="actionControls"\n [selectable]="selectable"\n [bulkActionControls]="bulkActionControls"\n [serverSideDataCallback]="serverSideDataCallback"\n [infiniteScroll]="getInfiniteScrollMode"\n [showCounterWarning]="showCounterWarning"\n [refresh]="refresh"\n [displayOptions]="displayOptions"\n (onConfigChange)="configChange($event)"\n (itemsSelect)="itemsSelect.emit($event)"\n class="d-contents"\n>\n <ng-container *ngFor="let column of columns; trackBy: trackByName">\n <c8y-column [name]="column.name"></c8y-column>\n </ng-container>\n <div class="c8y-empty-state">\n <h1 c8yIcon="c8y-group-add" class="c8y-icon-duocolor"></h1>\n <div>\n <p>\n <strong>{{ \'No items to display.\' | translate }}</strong>\n </p>\n <small>{{ emptyStateText | translate }}</small>\n </div>\n </div>\n</c8y-data-grid>\n'}]}],C.ctorParameters=function(){return[{type:b},{type:c.BsModalService},{type:n.SmartGroupsService}]},C.propDecorators={parentGroup:[{type:t.Input,args:["parent-group"]}],refresh:[{type:t.Input}],title:[{type:t.Input}],emptyStateText:[{type:t.Input}],loadingItemsLabel:[{type:t.Input}],columns:[{type:t.Input}],_pagination:[{type:t.Input,args:["pagination"]}],_actionControls:[{type:t.Input,args:["actionControls"]}],selectable:[{type:t.Input}],baseQuery:[{type:t.Input}],_bulkActionControls:[{type:t.Input,args:["bulkActionControls"]}],filterable:[{type:t.Input}],sortable:[{type:t.Input}],onColumnsChange:[{type:t.Output}],itemsSelect:[{type:t.Output}],dataGrid:[{type:t.ViewChild,args:[s.DataGridComponent,{static:!0}]}],_displayOptions:[{type:t.Input,args:["displayOptions"]}]};var w=function(){function e(e){this.inventoryService=e,this.GROUP_FRAGMENT_TYPE="c8y_IsDeviceGroup"}return e.prototype.createGroupAndAssignDevices=function(e,t,n){return v(this,void 0,void 0,(function(){var s,r,i,o;return g(this,(function(a){switch(a.label){case 0:return r=e.name,i=e.description,o=this.getGroupMO(r,i,t),t?[4,this.inventoryService.childAssetsCreate(o,t)]:[3,2];case 1:return s=a.sent().data,[3,4];case 2:return[4,this.inventoryService.create(o)];case 3:s=a.sent().data,a.label=4;case 4:return n.length>0?[4,this.assignDevices(s.id,n)]:[3,6];case 5:a.sent(),a.label=6;case 6:return[2,s]}}))}))},e.prototype.getGroupMO=function(e,t,n){var s;return void 0===t&&(t=""),(s={type:this.getGroupType(n)})[this.GROUP_FRAGMENT_TYPE]={},s.name=e,s.c8y_Notes=t,s},e.prototype.getGroupType=function(e){return e?r.GroupFragment.subGroupType:r.GroupFragment.groupType},e.prototype.assignDevices=function(e,t){return v(this,void 0,void 0,(function(){var n,s=this;return g(this,(function(r){switch(r.label){case 0:return n=[],t.forEach((function(t){n.push(s.inventoryService.childAssetsAdd(t,e))})),[4,Promise.all(n)];case 1:return[2,r.sent()]}}))}))},e}();w.decorators=[{type:t.Injectable}],w.ctorParameters=function(){return[{type:n.InventoryService}]};var I=function(){function e(e,n,r,i,o){this.deviceGridService=e,this.fb=n,this.addGroupService=r,this.alert=i,this.subAssetsService=o,this.refresh=new t.EventEmitter,this.onDeviceQueryStringChange=new t.EventEmitter,this.onCancel=new t.EventEmitter,this.pendingStatus=!1,this.pagination={pageSize:20,currentPage:1},this.selected=[],this.canCreateGroup=!1,this.canAssignDevice=!1,this.ITEMS_SELECT_LIMIT=15,this.btnLabels={next:s.gettext("Next"),cancel:s.gettext("Cancel"),create:s.gettext("Create")}}return e.prototype.onEnterKeyDown=function(e){this.isGroupDetailsStep()&&!this.canAssignDevice||this.isAssignDeviceStep()?this.createGroup():this.stepper.next()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e,t=this;return g(this,(function(n){switch(n.label){case 0:return this.formGroupStepOne=this.fb.group({name:["",p.Validators.required],description:[""]}),this.subscription=this.onCancel.subscribe((function(){return t.resetStepper()})),this.canCreateGroup=this.subAssetsService.canCreateGroup(),e=this,[4,this.subAssetsService.canAssignDevice({id:this.currentGroupId})];case 1:return e.canAssignDevice=n.sent(),[2]}}))}))},e.prototype.ngAfterViewInit=function(){this.nameInput=this.nameInputRef.nativeElement,this.setFocusOnNameInput()},e.prototype.createGroup=function(){return v(this,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return!1===this.canCreateGroup?[2]:(this.pendingStatus=!0,[4,this.addGroupService.createGroupAndAssignDevices(this.formGroupStepOne.value,this.currentGroupId,this.selected)]);case 1:return e.sent(),this.pendingStatus=!1,this.resetStepper(),this.alert.success(s.gettext("Group created.")),this.refresh.emit(),this.onCancel.emit(),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e.prototype.resetStepper=function(){this.stepper.reset(),this.stepper.selectedIndex=1,this.selected=[]},e.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},e.prototype.isGroupDetailsStep=function(){return 0===this.stepper.selectedIndex},e.prototype.isAssignDeviceStep=function(){return 1===this.stepper.selectedIndex},e.prototype.setFocusOnNameInput=function(){this.nameInput&&(this.nameInput.focus(),this.nameInput.select())},e}();I.decorators=[{type:t.Component,args:[{selector:"c8y-add-group",template:'<c8y-title *ngIf="!currentGroupId">\n {{ \'Add group\' | translate }}\n</c8y-title>\n\n<div class="d-contents" *ngIf="!currentGroupId; else stepper">\n <ng-container [ngTemplateOutlet]="stepper"></ng-container>\n</div>\n\n<ng-template #stepper>\n <c8y-stepper\n class="flex-col flex-nowrap no-align-items fit-h c8y-stepper--no-btns"\n [disableDefaultIcons]="{ edit: true, done: false }"\n [customClasses]="[\'col-md-6\', \'col-md-offset-3\', \'p-t-16\', \'p-b-32\', \'flex-no-shrink\']"\n linear\n >\n <cdk-step [stepControl]="formGroupStepOne" [label]="\'New group\' | translate">\n <div class="p-16 p-t-0 flex-no-shrink separator-bottom col-xs-12">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'New group\' | translate }}\n </h4>\n </div>\n </div>\n </div>\n <div class="col-xs-12 flex-grow no-gutter">\n <div class="card-inner-scroll fit-h">\n <div class="card-block p-b-0">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <c8y-form-group>\n <div [formGroup]="formGroupStepOne">\n <c8y-form-group>\n <label translate>Name</label>\n <input\n class="form-control"\n type="text"\n formControlName="name"\n placeholder="{{ \'e.g. First floor\' | translate }} "\n #nameRef\n required\n />\n <c8y-messages>\n <c8y-message *ngIf="!formGroupStepOne.untouched && !nameRef.value" translate\n >This field is required.</c8y-message\n >\n </c8y-messages>\n </c8y-form-group>\n\n <c8y-form-group>\n <label translate>Description</label>\n <input\n class="form-control"\n type="text"\n formControlName="description"\n placeholder="{{ \'e.g. first floor devices\' | translate }}"\n />\n </c8y-form-group>\n </div>\n </c8y-form-group>\n <c8y-form-group>\n <div [formGroup]="formGroupStepOne"></div>\n </c8y-form-group>\n <div class="alert alert-info max-width-100" translate *ngIf="!canAssignDevice">\n You don\'t have permission to assign devices.\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <c8y-stepper-buttons\n class="d-block card-footer p-24 separator"\n (onCancel)="onCancel.emit()"\n (onCustom)="createGroup()"\n [disabled]="!canCreateGroup"\n [labels]="\n canAssignDevice\n ? { next: btnLabels.next, cancel: btnLabels.cancel }\n : { custom: btnLabels.create, cancel: btnLabels.cancel }\n "\n [showButtons]="\n canAssignDevice ? { next: true, cancel: true } : { custom: true, cancel: true }\n "\n ></c8y-stepper-buttons>\n </cdk-step>\n <cdk-step [label]="\'Assign devices\' | translate">\n <div class="p-16 p-t-0 flex-no-shrink separator-bottom col-xs-12">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'Assign devices\' | translate }}\n </h4>\n </div>\n </div>\n </div>\n <div class="col-xs-12 no-gutter flex-grow">\n <c8y-device-grid\n [title]="\'Select target devices\' | translate"\n [actionControls]="[]"\n [infiniteScroll]="\'auto\'"\n [selectable]="\'true\'"\n [pagination]="pagination"\n (itemsSelect)="onSelected($event)"\n [refresh]="refresh"\n class="d-contents"\n >\n <div class="c8y-empty-state">\n <h1 c8yIcon="search"></h1>\n <div>\n <p>\n <strong>{{ \'No matching devices.\' | translate }}</strong>\n </p>\n <small>{{ \'Refine your search terms\' | translate }}</small>\n </div>\n </div>\n </c8y-device-grid>\n </div>\n <c8y-stepper-buttons\n class="d-block card-footer p-24 separator"\n (onCancel)="onCancel.emit()"\n (onCustom)="createGroup()"\n [labels]="{ custom: btnLabels.create }"\n [disabled]="!canAssignDevice"\n [pending]="pendingStatus"\n ></c8y-stepper-buttons>\n </cdk-step>\n </c8y-stepper>\n</ng-template>\n'}]}],I.ctorParameters=function(){return[{type:o.DeviceGridService},{type:p.FormBuilder},{type:w},{type:s.AlertService},{type:b}]},I.propDecorators={currentGroupId:[{type:t.Input}],refresh:[{type:t.Input}],onDeviceQueryStringChange:[{type:t.Output}],onCancel:[{type:t.Output}],stepper:[{type:t.ViewChild,args:[s.C8yStepper,{static:!1}]}],nameInputRef:[{type:t.ViewChild,args:["nameRef",{static:!1}]}],onEnterKeyDown:[{type:t.HostListener,args:["document:keydown.enter",["$event"]]}],onEscapeKeyDown:[{type:t.HostListener,args:["document:keydown.escape",["$event"]]}]};var x=[{path:"add-group",component:I}],E=function(){};E.decorators=[{type:t.NgModule,args:[{declarations:[I],imports:[s.CoreModule,o.DeviceGridModule,p.FormsModule,p.ReactiveFormsModule],entryComponents:[I],exports:[I],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:x,multi:!0},w]}]}];var O=function(){function e(e,n){this.permissions=e,this.subAssetsService=n,this.refresh=new t.EventEmitter,this.showAddGroup=!1,this.filterable=!1,this.sortable=!0,this.shouldDisableAddGroup=!1}return e.prototype.ngOnInit=function(){this.permissions.hasRole("ROLE_INVENTORY_READ")||(this.sortable=!1),this.shouldDisableAddGroup=!this.subAssetsService.canCreateGroup()},e}();O.decorators=[{type:t.Component,args:[{selector:"c8y-groups-name",template:'<c8y-title>\n {{ \'Groups\' | translate }}\n</c8y-title>\n<c8y-action-bar-item [placement]="\'right\'">\n <button\n class="btn btn-link"\n title="{{ \'Add group\' | translate }}"\n (click)="showAddGroup = !showAddGroup"\n [disabled]="shouldDisableAddGroup"\n >\n <i c8yIcon="plus-circle" class="m-r-4"></i><span translate>Add group</span>\n </button>\n</c8y-action-bar-item>\n \x3c!-- TODO: uncomment when help is available \n <c8y-help src="/users-guide/device-management/#grouping-devices"></c8y-help> \n--\x3e\n\n<div [ngClass]="{ drawerOpen: showAddGroup }">\n <div class="bottom-drawer">\n <c8y-add-group\n [refresh]="refresh"\n (onCancel)="showAddGroup = false"\n *ngIf="showAddGroup"\n ></c8y-add-group>\n </div>\n</div>\n<c8y-sub-assets-grid\n [refresh]="refresh"\n [filterable]="filterable"\n [sortable]="sortable"\n class="content-fullpage d-flex d-col"\n></c8y-sub-assets-grid>\n'}]}],O.ctorParameters=function(){return[{type:s.Permissions},{type:b}]};var _=function(){function e(e,n,s){this.alert=e,this.subAssetsService=n,this.inventoryService=s,this.refresh=new t.EventEmitter,this.onCancel=new t.EventEmitter,this.onShowChildDevices=new t.EventEmitter,this.selectedDevice=new t.EventEmitter,this.pendingStatus=!1,this.pagination={pageSize:20,currentPage:1},this.selected=[],this.canAssignDevice=!1,this.actionControls=[],this.isSelectable=!0}return e.prototype.onEnterKeyDown=function(e){this.selected.length>0&&this.assignDevices()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.setNotIncludedInGroupQuery(),e=this,[4,this.subAssetsService.canAssignDevice({id:this.currentGroupId})];case 1:return e.canAssignDevice=t.sent(),[2]}}))}))},e.prototype.setNotIncludedInGroupQuery=function(){var e={__not:{__bygroupid:this.currentGroupId}};this.baseQuery=e},e.prototype.setActionControls=function(e){var t=this,n=[],r={type:"SELECT_CHILDREN",icon:"enter-bottom",text:s.gettext("Select children"),callback:function(e){return t.selectChildren(e)},showIf:function(e){return e.childDevices.references.length>0}};e&&n.push(r),this.actionControls=n,this.refresh.emit()},e.prototype.assignDevices=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:if(!1===this.canAssignDevice)return[2];this.pendingStatus=!0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.inventoryService.childAssetsBulkAdd(this.selected,this.currentGroupId)];case 2:return t.sent(),this.refresh.emit(),this.alert.success(s.gettext("Devices assigned to the group.")),[3,4];case 3:return e=t.sent(),this.alert.danger(s.gettext("Could not assign devices to the group"),e),[3,4];case 4:return this.pendingStatus=!1,this.selected=[],this.onCancel.emit(),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e.prototype.selectChildren=function(e){this.onShowChildDevices.emit(!0),this.selectedDevice.emit(e)},e}();_.decorators=[{type:t.Component,args:[{selector:"c8y-assign-devices",template:'<div class="card-block flex-no-shrink separator-bottom col-xs-12 large-padding p-t-24 p-b-24">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'Assign devices\' | translate }}\n </h4>\n </div>\n </div>\n</div>\n<c8y-device-grid\n [title]="\'Select target devices\' | translate"\n [actionControls]="actionControls"\n [infiniteScroll]="\'auto\'"\n [selectable]="isSelectable"\n [pagination]="pagination"\n (itemsSelect)="onSelected($event)"\n [refresh]="refresh"\n [baseQuery]="baseQuery"\n (onChildDevices)="setActionControls($event)"\n [showChildDevices]="{ show: true, value: false }"\n class="flex-grow col-xs-12 no-gutter"\n>\n <div class="c8y-empty-state">\n <h1 c8yIcon="search"></h1>\n <div>\n <p>\n <strong>{{ \'No matching devices.\' | translate }}</strong>\n </p>\n <small>{{ \'Refine your search terms\' | translate }}</small>\n </div>\n </div>\n</c8y-device-grid>\n\n<div class="text-center card-footer p-24 separator">\n <button\n (click)="onCancel.emit()"\n type="button"\n class="btn btn-default"\n title="{{ \'Cancel\' | translate }}"\n >\n <span>{{ \'Cancel\' | translate }}</span>\n </button>\n <button\n (click)="assignDevices()"\n type="button"\n class="btn btn-primary"\n [ngClass]="{ \'btn-pending\': pendingStatus }"\n title="{{ \'Assign\' | translate }}"\n [disabled]="selected.length === 0 || !canAssignDevice"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'}]}],_.ctorParameters=function(){return[{type:s.AlertService},{type:b},{type:n.InventoryService}]},_.propDecorators={currentGroupId:[{type:t.Input}],refresh:[{type:t.Input}],onCancel:[{type:t.Output}],onShowChildDevices:[{type:t.Output}],selectedDevice:[{type:t.Output}],onEnterKeyDown:[{type:t.HostListener,args:["document:keydown.enter",["$event"]]}],onEscapeKeyDown:[{type:t.HostListener,args:["document:keydown.escape",["$event"]]}]};var R=function(){function e(e,n,s){this.alert=e,this.subAssetsService=n,this.inventoryService=s,this.onCancel=new t.EventEmitter,this.refresh=new t.EventEmitter,this.selected=[],this.canAssignDevice=!1,this.pendingStatus=!1}return e.prototype.onEnterKeyDown=function(e){this.selected.length>0&&this.assignDevices()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.setNotIncludedInGroupQuery(),e=this,[4,this.subAssetsService.canAssignDevice({id:this.currentGroupId})];case 1:return e.canAssignDevice=t.sent(),[2]}}))}))},e.prototype.setNotIncludedInGroupQuery=function(){var e={__not:{__bygroupid:this.currentGroupId}};this.baseQuery=e},e.prototype.assignDevices=function(){return v(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:if(!1===this.canAssignDevice)return[2];this.pendingStatus=!0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.inventoryService.childAssetsBulkAdd(this.selected,this.currentGroupId)];case 2:return t.sent(),this.refresh.emit(),this.alert.success(s.gettext("Child devices assigned to the group.")),[3,4];case 3:return e=t.sent(),this.alert.danger(s.gettext("Could not assign child devices to the group"),e),[3,4];case 4:return this.pendingStatus=!1,this.selected=[],this.onCancel.emit(),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e}();R.decorators=[{type:t.Component,args:[{selector:"c8y-assign-child-devices",template:'<div class="card-block flex-no-shrink separator-bottom col-xs-12 large-padding p-t-24 p-b-24">\n <div class="row">\n <div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">\n <h4 class="text-center text-medium">\n {{ \'Assign child devices\' | translate }}\n </h4>\n </div>\n </div>\n</div>\n\n<div class="d-flex d-col no-align-items fit-h">\n <c8y-sub-assets-grid\n [title]="\'Select target child devices\' | translate"\n [emptyStateText]="\'All child devices are already assigned to the group\' | translate"\n [refresh]="refresh"\n [actionControls]="[]"\n [selectable]="true"\n [parent-group]="parentDevice"\n [baseQuery]="baseQuery"\n (itemsSelect)="onSelected($event)"\n class="d-contents"\n >\n </c8y-sub-assets-grid>\n</div>\n\n<div class="text-center card-footer p-24 separator">\n <button\n (click)="onCancel.emit()"\n type="button"\n class="btn btn-default"\n title="{{ \'Cancel\' | translate }}"\n >\n <span>{{ \'Cancel\' | translate }}</span>\n </button>\n <button\n (click)="assignDevices()"\n type="button"\n class="btn btn-primary"\n [ngClass]="{ \'btn-pending\': pendingStatus }"\n title="{{ \'Assign\' | translate }}"\n [disabled]="selected.length === 0 || !canAssignDevice"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'}]}],R.ctorParameters=function(){return[{type:s.AlertService},{type:b},{type:n.InventoryService}]},R.propDecorators={currentGroupId:[{type:t.Input}],parentDevice:[{type:t.Input}],onCancel:[{type:t.Output}],refresh:[{type:t.Input}],onEnterKeyDown:[{type:t.HostListener,args:["document:keydown.enter",["$event"]]}],onEscapeKeyDown:[{type:t.HostListener,args:["document:keydown.escape",["$event"]]}]};var N=[{context:s.ViewContext.Group,path:"subassets",priority:1e3,icon:"c8y-group-open",label:s.gettext("Subassets"),component:G},{path:"group",component:O}],k=function(){};k.decorators=[{type:t.NgModule,args:[{declarations:[G,C,f,O,S,A,D,_,R],imports:[s.CoreModule,o.DeviceGridModule,E,l.PopoverModule],entryComponents:[G,f,O,A,D],exports:[],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:N,multi:!0},b]}]}],e.AddGroupComponent=I,e.AddGroupModule=E,e.AddGroupService=w,e.AssetTypeCellRendererComponent=f,e.AssetTypeGridColumn=y,e.AssignChildDevicesComponent=R,e.AssignDevicesComponent=_,e.DeleteAssetsModalComponent=A,e.GroupInfoComponent=S,e.GroupsComponent=O,e.SubAssetsComponent=G,e.SubAssetsGridComponent=C,e.SubAssetsModule=k,e.SubAssetsService=b,e.UnassignModalComponent=D,e.ɵ0=N,e.ɵa=f,e.ɵb=A,e.ɵc=D,e.ɵd=E,e.ɵe=I,e.ɵf=w,Object.defineProperty(e,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=c8y-ngx-components-sub-assets.umd.min.js.map