1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

refactor(app): move storidge to new 'integrations' module (#2905)

* refactor(app): move storidge to new 'integrations' module

* style(storidge): revert TODO note removal
This commit is contained in:
xAt0mZ 2019-06-11 23:13:18 +02:00 committed by GitHub
parent 67de71a18f
commit 144e0ae07e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 32 additions and 29 deletions

View file

@ -0,0 +1,23 @@
<rd-widget>
<rd-widget-header icon="fa-plus" title-text="Create snapshot">
</rd-widget-header>
<rd-widget-body>
<form class="form-horizontal">
<div class="form-group">
<label for="description" class="col-sm-3 col-lg-2 control-label text-left">Description</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="description" ng-model="$ctrl.formValues.Description">
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button type="button" class="btn btn-primary btn-sm" ng-disabled="$ctrl.state.actionInProgress"
ng-click="$ctrl.createSnapshot()" button-spinner="$ctrl.state.actionInProgress">
<span ng-hide="$ctrl.state.actionInProgress">Create snapshot</span>
<span ng-show="$ctrl.state.actionInProgress">Creating snapshot...</span>
</button>
</div>
</div>
</form>
</rd-widget-body>
</rd-widget>

View file

@ -0,0 +1,7 @@
angular.module('portainer.docker').component('storidgeSnapshotCreation', {
templateUrl: './storidgeSnapshotCreation.html',
controller: 'StoridgeSnapshotCreationController',
bindings: {
volumeId: '<'
}
});

View file

@ -0,0 +1,26 @@
angular.module('portainer.docker')
.controller('StoridgeSnapshotCreationController', ['StoridgeSnapshotService', 'Notifications', '$state',
function (StoridgeSnapshotService, Notifications, $state) {
var ctrl = this;
this.formValues = {};
this.state = {
actionInProgress: false
};
this.createSnapshot = function () {
ctrl.state.actionInProgress = true;
StoridgeSnapshotService.create(ctrl.volumeId, ctrl.formValues.Description)
.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;
});
};
}]);