(()=>{function e(i,t,n,o,r,a,e,u,l){function s(){i.refreshLoading=!0,r.list({pageSize:1e3}).then(function(e){i.retentions=e,i.paging=e.paging},g).finally(function(){i.refreshLoading=!1})}function c(e){i.retentions=_.concat(i.retentions,e),i.paging=e.paging}function g(e){403===e.status?n.info(l("You need these roles to access retention rules: Retention rule Read/Admin")):n.danger(u.getString(e.data.message),e.data)}function d(e){var t=_.partial(n.success,l("Retention rule deleted."));return r.remove(e).then(_.partial(f,e)).then(t)}function f(e){_.remove(i.retentions,e)}function p(e){i.retentions.push(e)}function h(e){var t=_.find(i.retentions,{id:e.id});_.merge(t,e)}function y(e){return!1!==e.editable}e.changeTitle({title:l("Retention rules")}),s(),i.list=s,i.createModal=function(){return a.editRetentionRule().then(p)},i.updateModal=function(e){return y(e)?a.editRetentionRule(e).then(h):t.resolve()},i.removeWithConfirmation=function(e){return o({title:l("Delete retention rule"),body:l("You are about to delete this retention rule. Do you want to proceed?"),labels:{ok:l("Delete")},status:"danger"}).then(_.partial(d,e))},i.isEditable=y,i.refreshLoading=!1,i.loadNext=function(){i.paging.loading=!0,i.paging.next().then(c).finally(function(){i.paging.loading=!1})},i.filterByProperties=function(n){return void 0===i.vm.searchString||["type","fragmentType","dataType","source","maximumAge"].reduce(function(e,t){return e||-1!==n[t].toString().toLowerCase().indexOf(i.vm.searchString.toLowerCase())},!1)}}e.$inject=["$scope","$q","c8yAlert","c8yModal","c8yRetentions","c8yUiUtil","c8yTitle","gettextCatalog","gettext"],angular.module("c8y.parts.retentionRules").controller("c8yRetentionRulesListCtrl",e)})();