angular.module("c8y.ui").directive("c8yRdbDump",function(){return e.$inject=["$scope","c8yAlert","c8yBase","c8yDeviceControl","c8yDevices","gettext","gettextCatalog"],{restrict:"E",templateUrl:":::PLUGIN_PATH:::/ui/views/rdbDump.html",controller:e,scope:{deviceId:"="}};function e(t,n,e,i,c,r,s){var o="c8y_UploadRDB";function a(){c.detail(t.deviceId).then(e.getResData).then(function(e){t.device=e,t.cfg=e&&e.c8y_RDBDump})}t.supportsOperation=function(){return c.supportsOperation(t.device,o)},t.retrieveRDB=function(){var e={description:r("Retrieve RDB snapshot"),c8y_UploadRDB:{}};(e=e).deviceId=t.deviceId,i.createWithNotifications(e).then(function(e){return e.created.then(function(){n.success(r("RDB snapshot will be retrieved."))}),e}).then(function(e){e.created.then(function(){t.retrievingRDB=!0}),e.completed.then(function(e){e.status===i.status.SUCCESSFUL?(n.success(r("RDB snapshot saved to files repository.")),a()):e.status===i.status.FAILED&&(e.failureReason?n.danger(s.getString('Failed to retrieve RDB snapshot: "{{failureReason | translate}}".',e)):n.danger(r("Failed to retrieve RDB snapshot."))),t.retrievingRDB=!1})})},t.$watch("deviceId",function(){a()}),a()}});