(()=>{function e(e,r){i.$inject=["$scope","$uibModalInstance","gettextCatalog"];var t="/device/:deviceId";function i(e,t,n){var n={type:"object",properties:{frequency:{type:"number",title:n.getString("Frequency (in seconds)"),required:!0},duration:{type:"number",title:n.getString("Duration (minutes)"),required:!0}}},a={frequency:10,duration:10};e.schema=n,e.params=a,e.getMeasurements=function(){t.close(a)},e.dismiss=t.dismiss}function o(e){var t=e.c8yDeviceControl,n=e.c8yAlert,a=e.gettextCatalog,s=e.messages;t.createWithNotifications(e.operation).then(function(e){e.created.then(function(){n.success(s.createdMessage)}),e.completed.then(function(e){e.status===t.status.SUCCESSFUL?n.success(s.successfulMessage):e.status===t.status.FAILED&&(e.failureReason?n.danger(a.getString(s.failureMessageWithReason,e)):n.danger(s.failureMessage))})})}e.addUrlAction({path:t,text:r("Get measurements"),actionBar:!0,priority:5e3,showIf:["$routeParams","c8yBase","c8yDevices",function(e,t,n){e=e.deviceId;return n.detailCached(e).then(t.getResData).then(function(e){return n.supportsOperation(e,"c8y_MeasurementRequestOperation")})}],showIfPermissions:{adminMOs:[":deviceId"]},action:["$routeParams","c8yDeviceControl","c8yAlert","gettextCatalog",function(e,t,n,a){o({c8yDeviceControl:t,c8yAlert:n,gettextCatalog:a,operation:{deviceId:e.deviceId,description:r("Get measurements"),c8y_MeasurementRequestOperation:{requestName:"LOG"}},messages:{createdMessage:r("Getting measurements from device…"),successfulMessage:r("Got measurements from device."),failureMessage:r("Could not get measurements from device."),failureMessageWithReason:r('Could not get measurements from device: "{{failureReason | translate}}".')}})}]}),e.addUrlAction({path:t,text:r("Initiate measurement poll"),actionBar:!0,priority:5e3,showIf:["$routeParams","c8yDevices","c8yBase",function(e,t,n){e=e.deviceId;return t.detailCached(e).then(n.getResData).then(function(e){return t.supportsOperation(e,"c8y_MeasurementPollFrequencyOperation")})}],showIfPermissions:{adminMOs:[":deviceId"]},action:["c8yDeviceControl","c8yAlert","gettextCatalog","c8yModal","$routeParams",function(t,n,a,e,s){return e({templateUrl:":::PLUGIN_PATH:::/pollFrequencyOperationSettings.html",controller:i}).then(function(e){return{deviceId:s.deviceId,description:r("Initiate measurement poll"),c8y_MeasurementPollFrequencyOperation:{frequency:e.frequency,duration:e.duration}}}).then(function(e){return o({c8yDeviceControl:t,c8yAlert:n,gettextCatalog:a,operation:e,messages:{createdMessage:r("Initiating measurement poll…"),successfulMessage:r("Initiated measurement poll."),failureMessage:r("Could not initiate measurement poll."),failureMessageWithReason:r('Could not initiate measurement poll: "{{failureReason | translate}}".')}})})}]})}e.$inject=["c8yActionsProvider","gettext"],angular.module("c8y.tixiDeviceControl",[]).config(e)})();