angular.module("c8y.parts.storageLimitEmail").controller("storageLimitCtrl",["$scope","$http","c8yTitle","c8yStorageLimitation","c8yUserGroup","c8yBase","c8yAlert","gettext",function(a,e,t,i,r,n,o,l){a.updateStorageLimitEmailInfo=function(){var e,t=0;a.data.emailWarningEnabled&&(e=a.data.selectedUserGroup,t=a.data.threshold),i.saveStorageLimitationEmailData({"group.name":e,"threshold.level":t}).then(function(){a.data.selectedUserGroup=e,a.data.threshold=0===t?void 0:t,o.success(l("Notification email settings updated."))})},a.invalid=_.partial(n.invalid,a,"storageLimitForm"),a.validationHints=n.validationHints,a.errorList={required:l("This field is required."),max:l("The threshold cannot be bigger than 100%."),min:l("The threshold cannot be smaller than 1%.")},a.userGroups=[],r.list().then(function(e){_.forEach(e,function(e){a.userGroups.push(e.name)})}),t.changeTitle({title:l("Storage quota")}),i.getStorageLimitationEmailData().then(function(e){var e=e.data,t=!!e["threshold.level"]&&"0"!==e["threshold.level"];a.data={emailWarningEnabled:t,selectedUserGroup:e["group.name"],threshold:+e["threshold.level"]}},function(){a.data={emailWarningEnabled:!1}})}]);