@c8y/ngx-components 1010.0.20 → 1010.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/c8y-ngx-components-sub-assets.umd.js +2 -9
- package/bundles/c8y-ngx-components-sub-assets.umd.js.map +1 -1
- package/bundles/c8y-ngx-components-sub-assets.umd.min.js +1 -1
- package/bundles/c8y-ngx-components-sub-assets.umd.min.js.map +1 -1
- package/esm2015/sub-assets/sub-assets.component.js +3 -10
- package/esm5/sub-assets/sub-assets.component.js +3 -11
- package/fesm2015/c8y-ngx-components-sub-assets.js +2 -8
- package/fesm2015/c8y-ngx-components-sub-assets.js.map +1 -1
- package/fesm5/c8y-ngx-components-sub-assets.js +2 -9
- package/fesm5/c8y-ngx-components-sub-assets.js.map +1 -1
- package/package.json +2 -2
- package/sub-assets/c8y-ngx-components-sub-assets.metadata.json +1 -1
- package/sub-assets/sub-assets.component.d.ts +2 -4
|
@@ -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)}var v=function(){return(v=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function g(e,t,n,s){var r,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i<3?r(o):i>3?r(t,n,o):r(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function f(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 m(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 y(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 b=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.ctorParameters=function(){return[{type:s.CellRendererContext},{type:r.DeviceGroupService}]},e=g([t.Component({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'})],e)}(),S=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=b,n.sortable=!0,n.sortingConfig={pathSortingConfigs:[{path:"c8y_IsDeviceGroup"}]},n}return h(t,e),t}(o.BaseDeviceGridColumn),G=function(e){function c(t,n,s,r,i,o,c,u,l,p){var d=e.call(this,n,t)||this;return d.translateService=t,d.inventoryService=n,d.appState=s,d.user=r,d.assetNodeService=i,d.deviceGroupService=o,d.smartGroupsService=c,d.smartRulesService=u,d.alertService=l,d.permissionsService=p,d.uiOnlyCountersUpdate=new a.BehaviorSubject(null),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(c,e),c.prototype.getDefaultColumns=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),[new S({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]},c.prototype.getDefaultPagination=function(){return{pageSize:this.getConfig().pagination.pageSize,currentPage:1}},c.prototype.getDefaultActionControls=function(){return[]},c.prototype.unassignAsset=function(e,t){return f(this,void 0,void 0,(function(){var n,r,i;return m(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 devices.")),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]}}))}))},c.prototype.isDevice=function(e){return!e.hasOwnProperty(this.IS_DEVICE_GROUP_FRAGMENT)&&!e.hasOwnProperty(this.IS_DYNAMIC_GROUP_FRAGMENT)},c.prototype.deleteAsset=function(e,t,n){return void 0===n&&(n={}),f(this,void 0,void 0,(function(){return m(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]}}))}))},c.prototype.shouldShowWithDeviceUserCheckbox=function(e){var t=e.owner,n=e.c8y_IsDevice,s=e.owner&&this.isDeviceUser(t);return Boolean(n&&s)},c.prototype.getDefaultBulkActionControls=function(){return[]},c.prototype.getData=function(e,t,n,s){return void 0===s&&(s={}),f(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){return!n?(r=this.buildCombinedRootQueryFilter(e,t),[2,this.assetNodeService.getRootNodes(v({},t,{query:r}))]):(i=v({},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])}))}))},c.prototype.getCount=function(e,t,n,s){return void 0===s&&(s={}),f(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){return r={pageSize:1,withChildren:!1},i=n?v({},this.getAssetsFilters(e,t,s),r):v({query:this.buildCombinedRootQueryFilter(e,t)},r),[2,this.getAssetsStatistics(n,i)]}))}))},c.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)},c.prototype.canEditGroup=function(e){var t=this.appState.currentUser.value,n=this.user.hasAnyRole(t,["ROLE_INVENTORY_ADMIN"]),s=e.owner===t.userName;return n||s},c.prototype.canEditSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_UPDATE","ROLE_SMARTGROUP_ADMIN"])},c.prototype.canDeleteSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_ADMIN","ROLE_INVENTORY_ADMIN"])},c.prototype.isSmartGroup=function(e){return this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)},c.prototype.isUsingInventoryRoles=function(){var e=this.appState.currentUser.value;return!this.user.hasAnyRole(e,["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_READ","ROLE_INVENTORY_CREATE"])},c.prototype.getAssetsStatistics=function(e,t){return f(this,void 0,void 0,(function(){return m(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]}}))}))},c.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)},c.prototype.deleteGroup=function(e,t){return void 0===t&&(t={}),f(this,void 0,void 0,(function(){var n,r;return m(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]}}))}))},c.prototype.deleteDevice=function(e,t){return void 0===t&&(t={}),f(this,void 0,void 0,(function(){var n,r,i,o;return m(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]}}))}))},c.prototype.deactivateSmartrulesForAsset=function(e,t){return f(this,void 0,void 0,(function(){var n,r,i,o,a,c=this;return m(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]}}))}))},c.prototype.isDeviceUser=function(e){return e.match(/^device_/)},c.prototype.deleteDeviceWithUser=function(e,t){return f(this,void 0,void 0,(function(){var n;return m(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]}}))}))},c.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}},c.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}]},c=g([t.Injectable()],c)}(o.DeviceGridService),C=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(){this.canEdit=this.smartGroupsService.isSmartGroupV2(this.group)?this.subAssetsService.canEditSmartGroup():this.subAssetsService.canEditGroup(this.group),this.groupIcon=this.deviceGroupService.icon(this.group),this.smartGroupFilter=this.group.c8y_DeviceQueryString,this.setHintMsg()},e.prototype.isSmartGroup=function(){return this.subAssetsService.isSmartGroup(this.group)},e.prototype.update=function(e){return f(this,void 0,void 0,(function(){var t;return m(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 f(this,void 0,void 0,(function(){var t,n,s;return m(this,(function(r){switch(r.label){case 0:return t=this.group.id,n=v({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 f(this,void 0,void 0,(function(){var t,n,r,i,o,a;return m(this,(function(c){switch(c.label){case 0:return t=this.group.id,n=e.c8y_DeviceQueryString,r=v({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 f(this,void 0,void 0,(function(){var t,n;return m(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.ctorParameters=function(){return[{type:n.InventoryService},{type:G},{type:r.DeviceGroupService},{type:n.SmartGroupsService},{type:s.AlertService},{type:i.TranslateService},{type:s.ModalService}]},g([t.Input()],e.prototype,"group",void 0),g([t.Output()],e.prototype,"onGroupChange",void 0),e=g([t.Component({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'})],e)}(),D=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.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(){var e=this;this.appState.state$.subscribe((function(t){e.showGroupInfo="cockpit"===t.app.name||"devicemanagement"===t.app.name})),this.displayOptions={striped:!0,bordered:!1,gridHeader:!0,filter:!this.isSmartGroup()}},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.ctorParameters=function(){return[{type:c.ActivatedRoute},{type:s.AppStateService},{type:r.DeviceGroupService},{type:G}]},e=g([t.Component({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 >\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 >\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 }" *ngIf="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 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'})],e)}(),A=function(){function e(e){this.translateService=e,this.showWithCascadeCheckbox=!0,this.showWithDeviceUserCheckbox=!1,this.closeSubject=new a.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 f(this,void 0,void 0,(function(){return m(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.ctorParameters=function(){return[{type:i.TranslateService}]},g([t.Input()],e.prototype,"showWithCascadeCheckbox",void 0),g([t.Input()],e.prototype,"showWithDeviceUserCheckbox",void 0),g([t.Input()],e.prototype,"asset",void 0),g([t.ViewChild("modalRef",{static:!1})],e.prototype,"modalRef",void 0),e=g([t.Component({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'})],e)}(),w=function(){function e(e){this.translateService=e,this.closeSubject=new a.Subject,this.labels={ok:s.gettext("Unassign"),cancel:s.gettext("Cancel")},this.title=s.gettext("Unassign devices"),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 f(this,void 0,void 0,(function(){return m(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.ctorParameters=function(){return[{type:i.TranslateService}]},g([t.Input()],e.prototype,"asset",void 0),g([t.ViewChild("modalRef",{static:!1})],e.prototype,"modalRef",void 0),e=g([t.Component({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'})],e)}(),I=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.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:!0,configurable:!0}),Object.defineProperty(e.prototype,"_pagination",{set:function(e){this.pagination=e||this.subAssetsGridService.getDefaultPagination()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_actionControls",{set:function(e){this.actionControls=e||this.subAssetsGridService.getDefaultActionControls()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_bulkActionControls",{set:function(e){this.bulkActionControls=e||this.subAssetsGridService.getDefaultBulkActionControls()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRootGroup",{get:function(){return!this.parentGroup},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"getInfiniteScrollMode",{get:function(){return this.isRootGroup&&this.subAssetsGridService.isUsingInventoryRoles()?"auto":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_displayOptions",{set:function(e){this.displayOptions=v({},this.displayOptions,e)},enumerable:!0,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 f(this,void 0,void 0,(function(){var e,t,n,r,i=this;return m(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(w,{initialState:s}).content.closeSubject.subscribe((function(s){return f(n,void 0,void 0,(function(){return m(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 f(this,void 0,void 0,(function(){var n,s=this;return m(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 f(s,void 0,void 0,(function(){return m(this,(function(s){switch(s.label){case 0:return n?(this.subAssetsGridService.uiOnlyCountersUpdate.next("DECREASE"),[4,this.subAssetsGridService.deleteAsset(e,t,n)]):[3,2];case 1:s.sent(),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 f(this,void 0,void 0,(function(){var t,n,s,r,i,o,a;return m(this,(function(c){switch(c.label){case 0:return(t=[]).push(this.subAssetsGridService.getData(e.columns,e.pagination,this.parentGroup,this.baseQuery)),(s=this.subAssetsGridService.uiOnlyCountersUpdate.value)?(n=this.uiOnlyCountersUpdate(s),this.subAssetsGridService.uiOnlyCountersUpdate.next(null)):(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 r=y.apply(void 0,[c.sent(),3]),i=r[0],o=r[1],a=r[2],n||(n={size:o,filteredSize:a}),this.onColumnsChange.emit(e.columns),[2,v({res:i.res,data:i.data,paging:i.paging},n)]}}))}))},e.prototype.configChange=function(e){this.subAssetsGridService.saveConfig(e)},e.prototype.uiOnlyCountersUpdate=function(e){var t,n=this.dataGrid.filteringLabelsParams.allItemsCount,s=this.dataGrid.filteringLabelsParams.filteredItemsCount;return"DECREASE"===e&&(t={size:n-1,filteredSize:s-1}),"INCREASE"===e&&(t={size:n+1,filteredSize:s+1}),t},e.ctorParameters=function(){return[{type:G},{type:u.BsModalService},{type:n.SmartGroupsService}]},g([t.Input("parent-group")],e.prototype,"parentGroup",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.Input()],e.prototype,"title",void 0),g([t.Input()],e.prototype,"emptyStateText",void 0),g([t.Input()],e.prototype,"loadingItemsLabel",void 0),g([t.Input()],e.prototype,"columns",null),g([t.Input("pagination")],e.prototype,"_pagination",null),g([t.Input("actionControls")],e.prototype,"_actionControls",null),g([t.Input()],e.prototype,"selectable",void 0),g([t.Input()],e.prototype,"baseQuery",void 0),g([t.Input("bulkActionControls")],e.prototype,"_bulkActionControls",null),g([t.Input()],e.prototype,"filterable",void 0),g([t.Input()],e.prototype,"sortable",void 0),g([t.Output()],e.prototype,"onColumnsChange",void 0),g([t.Output()],e.prototype,"itemsSelect",void 0),g([t.ViewChild(s.DataGridComponent,{static:!0})],e.prototype,"dataGrid",void 0),g([t.Input("displayOptions")],e.prototype,"_displayOptions",null),e=g([t.Component({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'})],e)}(),x=function(){function e(e){this.inventoryService=e,this.GROUP_FRAGMENT_TYPE="c8y_IsDeviceGroup"}return e.prototype.createGroupAndAssignDevices=function(e,t,n){return f(this,void 0,void 0,(function(){var s,r,i,o;return m(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.description=t,s},e.prototype.getGroupType=function(e){return e?r.GroupFragment.subGroupType:r.GroupFragment.groupType},e.prototype.assignDevices=function(e,t){return f(this,void 0,void 0,(function(){var n,s=this;return m(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.ctorParameters=function(){return[{type:n.InventoryService}]},e=g([t.Injectable()],e)}(),E=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.ITEMS_SELECT_LIMIT=15,this.btnLabels={next:s.gettext("Next"),cancel:s.gettext("Cancel"),create:s.gettext("Create")}}return e.prototype.onEnterKeyDown=function(e){1===this.stepper.selectedIndex&&this.createGroup(),this.stepper.next()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.onBackspaceKeyDown=function(e){var t=this;this.stepper.previous(),setTimeout((function(){t.setFocusOnNameInput()}))},e.prototype.ngOnInit=function(){var e=this;this.formGroupStepOne=this.fb.group({name:["",p.Validators.required],description:[""]}),this.subscription=this.onCancel.subscribe((function(){return e.resetStepper()}))},e.prototype.ngAfterViewInit=function(){this.nameInput=this.nameInputRef.nativeElement,this.setFocusOnNameInput()},e.prototype.createGroup=function(){return f(this,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return this.pendingStatus=!0,this.subAssetsService.uiOnlyCountersUpdate.next("INCREASE"),[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.setFocusOnNameInput=function(){this.nameInput&&(this.nameInput.focus(),this.nameInput.select())},e.ctorParameters=function(){return[{type:o.DeviceGridService},{type:p.FormBuilder},{type:x},{type:s.AlertService},{type:G}]},g([t.Input()],e.prototype,"currentGroupId",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.Output()],e.prototype,"onDeviceQueryStringChange",void 0),g([t.Output()],e.prototype,"onCancel",void 0),g([t.ViewChild(s.C8yStepper,{static:!1})],e.prototype,"stepper",void 0),g([t.ViewChild("nameRef",{static:!1})],e.prototype,"nameInputRef",void 0),g([t.HostListener("document:keydown.enter",["$event"])],e.prototype,"onEnterKeyDown",null),g([t.HostListener("document:keydown.escape",["$event"])],e.prototype,"onEscapeKeyDown",null),g([t.HostListener("document:keydown.backspace",["$event"])],e.prototype,"onBackspaceKeyDown",null),e=g([t.Component({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>\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 [labels]="{ next: btnLabels.next, cancel: btnLabels.cancel }"\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 [itemsSelectLimit]="ITEMS_SELECT_LIMIT"\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 [pending]="pendingStatus"\n ></c8y-stepper-buttons>\n </cdk-step>\n </c8y-stepper>\n</ng-template>\n'})],e)}(),O=[{path:"add-group",component:E}],_=function(){function e(){}return e=g([t.NgModule({declarations:[E],imports:[s.CoreModule,o.DeviceGridModule,p.FormsModule,p.ReactiveFormsModule],entryComponents:[E],exports:[E],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:O,multi:!0},x]})],e)}(),R=function(){function e(e){this.permissions=e,this.refresh=new t.EventEmitter,this.showAddGroup=!1,this.filterable=!1,this.sortable=!0}return e.prototype.ngOnInit=function(){this.permissions.hasRole("ROLE_INVENTORY_READ")||(this.sortable=!1)},e.ctorParameters=function(){return[{type:s.Permissions}]},e=g([t.Component({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 >\n <i c8yIcon="plus-circle"></i> <span translate>Add group</span>\n </button>\n</c8y-action-bar-item>\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'})],e)}(),k=function(){function e(e){this.inventoryService=e}return e.prototype.assignDevices=function(e,t){return f(this,void 0,void 0,(function(){var n,s=this;return m(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.ctorParameters=function(){return[{type:n.InventoryService}]},e=g([t.Injectable()],e)}(),N=function(){function e(e,s){this.assignDevicesService=e,this.alert=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,this.itemsSelectLimit=15,this.queriesUtil=new n.QueriesUtil}return e.prototype.onEnterKeyDown=function(e){this.selected.length>0&&this.assignDevices()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){this.setNotIncludedInGroupQuery()},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 f(this,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return this.pendingStatus=!0,[4,this.assignDevicesService.assignDevices(this.currentGroupId,this.selected)];case 1:return e.sent(),this.pendingStatus=!1,this.selected=[],this.onCancel.emit(),this.refresh.emit(),this.alert.success(s.gettext("Devices assigned to the group.")),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e.prototype.selectChildren=function(e){this.onShowChildDevices.emit(!0),this.selectedDevice.emit(e)},e.ctorParameters=function(){return[{type:k},{type:s.AlertService}]},g([t.Input()],e.prototype,"currentGroupId",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.Output()],e.prototype,"onCancel",void 0),g([t.Output()],e.prototype,"onShowChildDevices",void 0),g([t.Output()],e.prototype,"selectedDevice",void 0),g([t.HostListener("document:keydown.enter",["$event"])],e.prototype,"onEnterKeyDown",null),g([t.HostListener("document:keydown.escape",["$event"])],e.prototype,"onEscapeKeyDown",null),e=g([t.Component({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 [itemsSelectLimit]="itemsSelectLimit"\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 (click)="onCancel.emit()" type="button" class="btn btn-default" title="{{\'Cancel\' | translate}}">\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"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'})],e)}(),P=function(){function e(e,n,s,r){this.alert=e,this.subAssetsService=n,this.inventoryService=s,this.assignDevicesService=r,this.onCancel=new t.EventEmitter,this.refresh=new t.EventEmitter,this.selected=[],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 f(this,void 0,void 0,(function(){return m(this,(function(e){return this.setNotIncludedInGroupQuery(),[2]}))}))},e.prototype.setNotIncludedInGroupQuery=function(){var e={__not:{__bygroupid:this.currentGroupId}};this.baseQuery=e},e.prototype.assignDevices=function(){return f(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:this.pendingStatus=!0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.assignDevicesService.assignDevices(this.currentGroupId,this.selected)];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.ctorParameters=function(){return[{type:s.AlertService},{type:G},{type:n.InventoryService},{type:k}]},g([t.Input()],e.prototype,"currentGroupId",void 0),g([t.Input()],e.prototype,"parentDevice",void 0),g([t.Output()],e.prototype,"onCancel",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.HostListener("document:keydown.enter",["$event"])],e.prototype,"onEnterKeyDown",null),g([t.HostListener("document:keydown.escape",["$event"])],e.prototype,"onEscapeKeyDown",null),e=g([t.Component({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"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'})],e)}(),M=[{context:s.ViewContext.Group,path:"subassets",priority:1e3,icon:"c8y-group-open",label:s.gettext("Subassets"),component:D},{path:"group",component:R}],U=function(){function e(){}return e=g([t.NgModule({declarations:[D,I,b,R,C,A,w,N,P],imports:[s.CoreModule,o.DeviceGridModule,_,l.PopoverModule],entryComponents:[D,b,R,A,w],exports:[],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:M,multi:!0},G,k]})],e)}();e.AddGroupComponent=E,e.AddGroupModule=_,e.AddGroupService=x,e.AssetTypeCellRendererComponent=b,e.AssetTypeGridColumn=S,e.AssignChildDevicesComponent=P,e.AssignDevicesComponent=N,e.DeleteAssetsModalComponent=A,e.GroupInfoComponent=C,e.GroupsComponent=R,e.SubAssetsComponent=D,e.SubAssetsGridComponent=I,e.SubAssetsModule=U,e.SubAssetsService=G,e.UnassignModalComponent=w,e.ɵ0=M,e.ɵa=b,e.ɵb=A,e.ɵc=w,e.ɵd=k,e.ɵe=_,e.ɵf=E,e.ɵg=x,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)}var v=function(){return(v=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function g(e,t,n,s){var r,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i<3?r(o):i>3?r(t,n,o):r(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function f(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 m(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 y(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 b=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.ctorParameters=function(){return[{type:s.CellRendererContext},{type:r.DeviceGroupService}]},e=g([t.Component({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'})],e)}(),S=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=b,n.sortable=!0,n.sortingConfig={pathSortingConfigs:[{path:"c8y_IsDeviceGroup"}]},n}return h(t,e),t}(o.BaseDeviceGridColumn),G=function(e){function c(t,n,s,r,i,o,c,u,l,p){var d=e.call(this,n,t)||this;return d.translateService=t,d.inventoryService=n,d.appState=s,d.user=r,d.assetNodeService=i,d.deviceGroupService=o,d.smartGroupsService=c,d.smartRulesService=u,d.alertService=l,d.permissionsService=p,d.uiOnlyCountersUpdate=new a.BehaviorSubject(null),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(c,e),c.prototype.getDefaultColumns=function(e,t){return void 0===e&&(e=!0),void 0===t&&(t=!0),[new S({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]},c.prototype.getDefaultPagination=function(){return{pageSize:this.getConfig().pagination.pageSize,currentPage:1}},c.prototype.getDefaultActionControls=function(){return[]},c.prototype.unassignAsset=function(e,t){return f(this,void 0,void 0,(function(){var n,r,i;return m(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 devices.")),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]}}))}))},c.prototype.isDevice=function(e){return!e.hasOwnProperty(this.IS_DEVICE_GROUP_FRAGMENT)&&!e.hasOwnProperty(this.IS_DYNAMIC_GROUP_FRAGMENT)},c.prototype.deleteAsset=function(e,t,n){return void 0===n&&(n={}),f(this,void 0,void 0,(function(){return m(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]}}))}))},c.prototype.shouldShowWithDeviceUserCheckbox=function(e){var t=e.owner,n=e.c8y_IsDevice,s=e.owner&&this.isDeviceUser(t);return Boolean(n&&s)},c.prototype.getDefaultBulkActionControls=function(){return[]},c.prototype.getData=function(e,t,n,s){return void 0===s&&(s={}),f(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){return!n?(r=this.buildCombinedRootQueryFilter(e,t),[2,this.assetNodeService.getRootNodes(v({},t,{query:r}))]):(i=v({},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])}))}))},c.prototype.getCount=function(e,t,n,s){return void 0===s&&(s={}),f(this,void 0,void 0,(function(){var r,i;return m(this,(function(o){return r={pageSize:1,withChildren:!1},i=n?v({},this.getAssetsFilters(e,t,s),r):v({query:this.buildCombinedRootQueryFilter(e,t)},r),[2,this.getAssetsStatistics(n,i)]}))}))},c.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)},c.prototype.canEditGroup=function(e){var t=this.appState.currentUser.value,n=this.user.hasAnyRole(t,["ROLE_INVENTORY_ADMIN"]),s=e.owner===t.userName;return n||s},c.prototype.canEditSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_UPDATE","ROLE_SMARTGROUP_ADMIN"])},c.prototype.canDeleteSmartGroup=function(){return this.permissionsService.hasAnyRole(["ROLE_SMARTGROUP_ADMIN","ROLE_INVENTORY_ADMIN"])},c.prototype.isSmartGroup=function(e){return this.smartGroupsService.isSmartGroup(e)||this.smartGroupsService.isSmartGroupV2(e)},c.prototype.isUsingInventoryRoles=function(){var e=this.appState.currentUser.value;return!this.user.hasAnyRole(e,["ROLE_INVENTORY_ADMIN","ROLE_INVENTORY_READ","ROLE_INVENTORY_CREATE"])},c.prototype.getAssetsStatistics=function(e,t){return f(this,void 0,void 0,(function(){return m(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]}}))}))},c.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)},c.prototype.deleteGroup=function(e,t){return void 0===t&&(t={}),f(this,void 0,void 0,(function(){var n,r;return m(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]}}))}))},c.prototype.deleteDevice=function(e,t){return void 0===t&&(t={}),f(this,void 0,void 0,(function(){var n,r,i,o;return m(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]}}))}))},c.prototype.deactivateSmartrulesForAsset=function(e,t){return f(this,void 0,void 0,(function(){var n,r,i,o,a,c=this;return m(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]}}))}))},c.prototype.isDeviceUser=function(e){return e.match(/^device_/)},c.prototype.deleteDeviceWithUser=function(e,t){return f(this,void 0,void 0,(function(){var n;return m(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]}}))}))},c.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}},c.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}]},c=g([t.Injectable()],c)}(o.DeviceGridService),C=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(){this.canEdit=this.smartGroupsService.isSmartGroupV2(this.group)?this.subAssetsService.canEditSmartGroup():this.subAssetsService.canEditGroup(this.group),this.groupIcon=this.deviceGroupService.icon(this.group),this.smartGroupFilter=this.group.c8y_DeviceQueryString,this.setHintMsg()},e.prototype.isSmartGroup=function(){return this.subAssetsService.isSmartGroup(this.group)},e.prototype.update=function(e){return f(this,void 0,void 0,(function(){var t;return m(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 f(this,void 0,void 0,(function(){var t,n,s;return m(this,(function(r){switch(r.label){case 0:return t=this.group.id,n=v({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 f(this,void 0,void 0,(function(){var t,n,r,i,o,a;return m(this,(function(c){switch(c.label){case 0:return t=this.group.id,n=e.c8y_DeviceQueryString,r=v({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 f(this,void 0,void 0,(function(){var t,n;return m(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.ctorParameters=function(){return[{type:n.InventoryService},{type:G},{type:r.DeviceGroupService},{type:n.SmartGroupsService},{type:s.AlertService},{type:i.TranslateService},{type:s.ModalService}]},g([t.Input()],e.prototype,"group",void 0),g([t.Output()],e.prototype,"onGroupChange",void 0),e=g([t.Component({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'})],e)}(),D=function(){function e(e,n,s){var r=this;this.route=e,this.deviceGroupService=n,this.subAssetsService=s,this.toggle=!1,this.showAddGroup=!1,this.showAssignDevices=!1,this.showAssignChildDevices=!1,this.refresh=new t.EventEmitter,this.filterable=!0,this.dataSub=this.route.parent.data.subscribe((function(e){var t=e.contextData;r.title=t.name,r.currentGroupId=t.id,r.group=t,r.filterable=!r.deviceGroupService.isDynamicGroup(t)}))}return e.prototype.ngOnInit=function(){this.displayOptions={striped:!0,bordered:!1,gridHeader:!0,filter:!this.isSmartGroup()}},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.ctorParameters=function(){return[{type:c.ActivatedRoute},{type:r.DeviceGroupService},{type:G}]},e=g([t.Component({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 >\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 >\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 [group]="group" (onGroupChange)="groupChange($event)"></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 }" *ngIf="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 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'})],e)}(),A=function(){function e(e){this.translateService=e,this.showWithCascadeCheckbox=!0,this.showWithDeviceUserCheckbox=!1,this.closeSubject=new a.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 f(this,void 0,void 0,(function(){return m(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.ctorParameters=function(){return[{type:i.TranslateService}]},g([t.Input()],e.prototype,"showWithCascadeCheckbox",void 0),g([t.Input()],e.prototype,"showWithDeviceUserCheckbox",void 0),g([t.Input()],e.prototype,"asset",void 0),g([t.ViewChild("modalRef",{static:!1})],e.prototype,"modalRef",void 0),e=g([t.Component({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'})],e)}(),w=function(){function e(e){this.translateService=e,this.closeSubject=new a.Subject,this.labels={ok:s.gettext("Unassign"),cancel:s.gettext("Cancel")},this.title=s.gettext("Unassign devices"),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 f(this,void 0,void 0,(function(){return m(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.ctorParameters=function(){return[{type:i.TranslateService}]},g([t.Input()],e.prototype,"asset",void 0),g([t.ViewChild("modalRef",{static:!1})],e.prototype,"modalRef",void 0),e=g([t.Component({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'})],e)}(),I=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.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:!0,configurable:!0}),Object.defineProperty(e.prototype,"_pagination",{set:function(e){this.pagination=e||this.subAssetsGridService.getDefaultPagination()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_actionControls",{set:function(e){this.actionControls=e||this.subAssetsGridService.getDefaultActionControls()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_bulkActionControls",{set:function(e){this.bulkActionControls=e||this.subAssetsGridService.getDefaultBulkActionControls()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRootGroup",{get:function(){return!this.parentGroup},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"getInfiniteScrollMode",{get:function(){return this.isRootGroup&&this.subAssetsGridService.isUsingInventoryRoles()?"auto":void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_displayOptions",{set:function(e){this.displayOptions=v({},this.displayOptions,e)},enumerable:!0,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 f(this,void 0,void 0,(function(){var e,t,n,r,i=this;return m(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(w,{initialState:s}).content.closeSubject.subscribe((function(s){return f(n,void 0,void 0,(function(){return m(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 f(this,void 0,void 0,(function(){var n,s=this;return m(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 f(s,void 0,void 0,(function(){return m(this,(function(s){switch(s.label){case 0:return n?(this.subAssetsGridService.uiOnlyCountersUpdate.next("DECREASE"),[4,this.subAssetsGridService.deleteAsset(e,t,n)]):[3,2];case 1:s.sent(),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 f(this,void 0,void 0,(function(){var t,n,s,r,i,o,a;return m(this,(function(c){switch(c.label){case 0:return(t=[]).push(this.subAssetsGridService.getData(e.columns,e.pagination,this.parentGroup,this.baseQuery)),(s=this.subAssetsGridService.uiOnlyCountersUpdate.value)?(n=this.uiOnlyCountersUpdate(s),this.subAssetsGridService.uiOnlyCountersUpdate.next(null)):(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 r=y.apply(void 0,[c.sent(),3]),i=r[0],o=r[1],a=r[2],n||(n={size:o,filteredSize:a}),this.onColumnsChange.emit(e.columns),[2,v({res:i.res,data:i.data,paging:i.paging},n)]}}))}))},e.prototype.configChange=function(e){this.subAssetsGridService.saveConfig(e)},e.prototype.uiOnlyCountersUpdate=function(e){var t,n=this.dataGrid.filteringLabelsParams.allItemsCount,s=this.dataGrid.filteringLabelsParams.filteredItemsCount;return"DECREASE"===e&&(t={size:n-1,filteredSize:s-1}),"INCREASE"===e&&(t={size:n+1,filteredSize:s+1}),t},e.ctorParameters=function(){return[{type:G},{type:u.BsModalService},{type:n.SmartGroupsService}]},g([t.Input("parent-group")],e.prototype,"parentGroup",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.Input()],e.prototype,"title",void 0),g([t.Input()],e.prototype,"emptyStateText",void 0),g([t.Input()],e.prototype,"loadingItemsLabel",void 0),g([t.Input()],e.prototype,"columns",null),g([t.Input("pagination")],e.prototype,"_pagination",null),g([t.Input("actionControls")],e.prototype,"_actionControls",null),g([t.Input()],e.prototype,"selectable",void 0),g([t.Input()],e.prototype,"baseQuery",void 0),g([t.Input("bulkActionControls")],e.prototype,"_bulkActionControls",null),g([t.Input()],e.prototype,"filterable",void 0),g([t.Input()],e.prototype,"sortable",void 0),g([t.Output()],e.prototype,"onColumnsChange",void 0),g([t.Output()],e.prototype,"itemsSelect",void 0),g([t.ViewChild(s.DataGridComponent,{static:!0})],e.prototype,"dataGrid",void 0),g([t.Input("displayOptions")],e.prototype,"_displayOptions",null),e=g([t.Component({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'})],e)}(),x=function(){function e(e){this.inventoryService=e,this.GROUP_FRAGMENT_TYPE="c8y_IsDeviceGroup"}return e.prototype.createGroupAndAssignDevices=function(e,t,n){return f(this,void 0,void 0,(function(){var s,r,i,o;return m(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.description=t,s},e.prototype.getGroupType=function(e){return e?r.GroupFragment.subGroupType:r.GroupFragment.groupType},e.prototype.assignDevices=function(e,t){return f(this,void 0,void 0,(function(){var n,s=this;return m(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.ctorParameters=function(){return[{type:n.InventoryService}]},e=g([t.Injectable()],e)}(),E=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.ITEMS_SELECT_LIMIT=15,this.btnLabels={next:s.gettext("Next"),cancel:s.gettext("Cancel"),create:s.gettext("Create")}}return e.prototype.onEnterKeyDown=function(e){1===this.stepper.selectedIndex&&this.createGroup(),this.stepper.next()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.onBackspaceKeyDown=function(e){var t=this;this.stepper.previous(),setTimeout((function(){t.setFocusOnNameInput()}))},e.prototype.ngOnInit=function(){var e=this;this.formGroupStepOne=this.fb.group({name:["",p.Validators.required],description:[""]}),this.subscription=this.onCancel.subscribe((function(){return e.resetStepper()}))},e.prototype.ngAfterViewInit=function(){this.nameInput=this.nameInputRef.nativeElement,this.setFocusOnNameInput()},e.prototype.createGroup=function(){return f(this,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return this.pendingStatus=!0,this.subAssetsService.uiOnlyCountersUpdate.next("INCREASE"),[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.setFocusOnNameInput=function(){this.nameInput&&(this.nameInput.focus(),this.nameInput.select())},e.ctorParameters=function(){return[{type:o.DeviceGridService},{type:p.FormBuilder},{type:x},{type:s.AlertService},{type:G}]},g([t.Input()],e.prototype,"currentGroupId",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.Output()],e.prototype,"onDeviceQueryStringChange",void 0),g([t.Output()],e.prototype,"onCancel",void 0),g([t.ViewChild(s.C8yStepper,{static:!1})],e.prototype,"stepper",void 0),g([t.ViewChild("nameRef",{static:!1})],e.prototype,"nameInputRef",void 0),g([t.HostListener("document:keydown.enter",["$event"])],e.prototype,"onEnterKeyDown",null),g([t.HostListener("document:keydown.escape",["$event"])],e.prototype,"onEscapeKeyDown",null),g([t.HostListener("document:keydown.backspace",["$event"])],e.prototype,"onBackspaceKeyDown",null),e=g([t.Component({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>\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 [labels]="{ next: btnLabels.next, cancel: btnLabels.cancel }"\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 [itemsSelectLimit]="ITEMS_SELECT_LIMIT"\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 [pending]="pendingStatus"\n ></c8y-stepper-buttons>\n </cdk-step>\n </c8y-stepper>\n</ng-template>\n'})],e)}(),O=[{path:"add-group",component:E}],_=function(){function e(){}return e=g([t.NgModule({declarations:[E],imports:[s.CoreModule,o.DeviceGridModule,p.FormsModule,p.ReactiveFormsModule],entryComponents:[E],exports:[E],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:O,multi:!0},x]})],e)}(),R=function(){function e(e){this.permissions=e,this.refresh=new t.EventEmitter,this.showAddGroup=!1,this.filterable=!1,this.sortable=!0}return e.prototype.ngOnInit=function(){this.permissions.hasRole("ROLE_INVENTORY_READ")||(this.sortable=!1)},e.ctorParameters=function(){return[{type:s.Permissions}]},e=g([t.Component({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 >\n <i c8yIcon="plus-circle"></i> <span translate>Add group</span>\n </button>\n</c8y-action-bar-item>\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'})],e)}(),N=function(){function e(e){this.inventoryService=e}return e.prototype.assignDevices=function(e,t){return f(this,void 0,void 0,(function(){var n,s=this;return m(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.ctorParameters=function(){return[{type:n.InventoryService}]},e=g([t.Injectable()],e)}(),k=function(){function e(e,s){this.assignDevicesService=e,this.alert=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,this.itemsSelectLimit=15,this.queriesUtil=new n.QueriesUtil}return e.prototype.onEnterKeyDown=function(e){this.selected.length>0&&this.assignDevices()},e.prototype.onEscapeKeyDown=function(e){this.onCancel.emit()},e.prototype.ngOnInit=function(){this.setNotIncludedInGroupQuery()},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 f(this,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return this.pendingStatus=!0,[4,this.assignDevicesService.assignDevices(this.currentGroupId,this.selected)];case 1:return e.sent(),this.pendingStatus=!1,this.selected=[],this.onCancel.emit(),this.refresh.emit(),this.alert.success(s.gettext("Devices assigned to the group.")),[2]}}))}))},e.prototype.onSelected=function(e){this.selected=e},e.prototype.selectChildren=function(e){this.onShowChildDevices.emit(!0),this.selectedDevice.emit(e)},e.ctorParameters=function(){return[{type:N},{type:s.AlertService}]},g([t.Input()],e.prototype,"currentGroupId",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.Output()],e.prototype,"onCancel",void 0),g([t.Output()],e.prototype,"onShowChildDevices",void 0),g([t.Output()],e.prototype,"selectedDevice",void 0),g([t.HostListener("document:keydown.enter",["$event"])],e.prototype,"onEnterKeyDown",null),g([t.HostListener("document:keydown.escape",["$event"])],e.prototype,"onEscapeKeyDown",null),e=g([t.Component({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 [itemsSelectLimit]="itemsSelectLimit"\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 (click)="onCancel.emit()" type="button" class="btn btn-default" title="{{\'Cancel\' | translate}}">\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"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'})],e)}(),P=function(){function e(e,n,s,r){this.alert=e,this.subAssetsService=n,this.inventoryService=s,this.assignDevicesService=r,this.onCancel=new t.EventEmitter,this.refresh=new t.EventEmitter,this.selected=[],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 f(this,void 0,void 0,(function(){return m(this,(function(e){return this.setNotIncludedInGroupQuery(),[2]}))}))},e.prototype.setNotIncludedInGroupQuery=function(){var e={__not:{__bygroupid:this.currentGroupId}};this.baseQuery=e},e.prototype.assignDevices=function(){return f(this,void 0,void 0,(function(){var e;return m(this,(function(t){switch(t.label){case 0:this.pendingStatus=!0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.assignDevicesService.assignDevices(this.currentGroupId,this.selected)];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.ctorParameters=function(){return[{type:s.AlertService},{type:G},{type:n.InventoryService},{type:N}]},g([t.Input()],e.prototype,"currentGroupId",void 0),g([t.Input()],e.prototype,"parentDevice",void 0),g([t.Output()],e.prototype,"onCancel",void 0),g([t.Input()],e.prototype,"refresh",void 0),g([t.HostListener("document:keydown.enter",["$event"])],e.prototype,"onEnterKeyDown",null),g([t.HostListener("document:keydown.escape",["$event"])],e.prototype,"onEscapeKeyDown",null),e=g([t.Component({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"\n >\n <span>{{ \'Assign\' | translate }}</span>\n </button>\n</div>\n'})],e)}(),M=[{context:s.ViewContext.Group,path:"subassets",priority:1e3,icon:"c8y-group-open",label:s.gettext("Subassets"),component:D},{path:"group",component:R}],U=function(){function e(){}return e=g([t.NgModule({declarations:[D,I,b,R,C,A,w,k,P],imports:[s.CoreModule,o.DeviceGridModule,_,l.PopoverModule],entryComponents:[D,b,R,A,w],exports:[],providers:[{provide:s.HOOK_ONCE_ROUTE,useValue:M,multi:!0},G,N]})],e)}();e.AddGroupComponent=E,e.AddGroupModule=_,e.AddGroupService=x,e.AssetTypeCellRendererComponent=b,e.AssetTypeGridColumn=S,e.AssignChildDevicesComponent=P,e.AssignDevicesComponent=k,e.DeleteAssetsModalComponent=A,e.GroupInfoComponent=C,e.GroupsComponent=R,e.SubAssetsComponent=D,e.SubAssetsGridComponent=I,e.SubAssetsModule=U,e.SubAssetsService=G,e.UnassignModalComponent=w,e.ɵ0=M,e.ɵa=b,e.ɵb=A,e.ɵc=w,e.ɵd=N,e.ɵe=_,e.ɵf=E,e.ɵg=x,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
16
16
|
//# sourceMappingURL=c8y-ngx-components-sub-assets.umd.min.js.map
|