diff --git a/app/docker/views/volumes/edit/volume.html b/app/docker/views/volumes/edit/volume.html index 97b7fa697..056f4837f 100644 --- a/app/docker/views/volumes/edit/volume.html +++ b/app/docker/views/volumes/edit/volume.html @@ -52,6 +52,13 @@ +
+
+ + +
+
+
+ + + +
+
+ +
+ +
+
+
+
+ +
+
+
+
+ diff --git a/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.js b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.js new file mode 100644 index 000000000..ad8fc4e0d --- /dev/null +++ b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.js @@ -0,0 +1,7 @@ +angular.module('portainer.docker').component('storidgeSnapshotCreation', { + templateUrl: 'app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.html', + controller: 'StoridgeSnapshotCreationController', + bindings: { + volumeId: '<' + } +}); diff --git a/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js new file mode 100644 index 000000000..5cc8c9686 --- /dev/null +++ b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js @@ -0,0 +1,26 @@ +angular.module('portainer.docker') +.controller('StoridgeSnapshotCreationController', ['StoridgeSnapshotService', 'Notifications', +function (StoridgeSnapshotService, Notifications) { + var ctrl = this; + + this.formValues = {}; + this.state = { + actionInProgress: false + }; + + this.createSnapshot = function () { + ctrl.state.actionInProgress = true; + StoridgeSnapshotService.create(ctrl.volumeId, ctrl.formValues.Comment) + .then(function success() { + Notifications.success('Success', 'Snapshot successfully created'); + $state.reload(); + }) + .catch(function error(err) { + Notifications.error('Failure', err, 'Unable to create snapshot'); + }) + .finally(function final() { + ctrl.state.actionInProgress = false; + }); + }; + +}]); diff --git a/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfoController.js b/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfoController.js index 401c1eeda..01daf39a8 100644 --- a/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfoController.js +++ b/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfoController.js @@ -98,7 +98,4 @@ function ($state, StoridgeVolumeService, Notifications) { }); }; - this.$onInit = function() { - }; - }]); diff --git a/app/extensions/storidge/services/snapshotService.js b/app/extensions/storidge/services/snapshotService.js index c260829f5..77921b86a 100644 --- a/app/extensions/storidge/services/snapshotService.js +++ b/app/extensions/storidge/services/snapshotService.js @@ -41,9 +41,9 @@ angular.module('extension.storidge') return deferred.promise; } - function create(volumeId) { + function create(volumeId, comment) { var deferred = $q.defer(); - Storidge.createSnapshot({id: volumeId}).$promise + Storidge.createSnapshot({id: volumeId, comment: comment}).$promise .then(function success(data) { deferred.resolve(data); })