mirror of
https://github.com/dobin/lxd-webgui
synced 2025-10-05 23:52:43 +02:00
implemented snapshot restore
This commit is contained in:
@@ -214,12 +214,34 @@ angular.module('myApp.container', ['ngRoute'])
|
||||
$scope.container = container.data.metadata;
|
||||
|
||||
$scope.restore = function(snapshot) {
|
||||
alert("Not yet implemented");
|
||||
var modalInstance = $uibModal.open({
|
||||
animation: $scope.animationsEnabled,
|
||||
templateUrl: 'modules/container/modalSnapshotRestore.html',
|
||||
controller: 'containerSnapshotRestoreModalCtrl',
|
||||
size: 'md',
|
||||
resolve: {
|
||||
container: function () {
|
||||
return $scope.container;
|
||||
},
|
||||
snapshot: function() {
|
||||
return snapshot;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
modalInstance.result.then(function (snapshotData) {
|
||||
ContainerServices.restoreSnapshot($scope.container.name, snapshot.name).then(function(data) {
|
||||
|
||||
});
|
||||
}, function () {
|
||||
// Nothing
|
||||
});
|
||||
}
|
||||
|
||||
$scope.delete = function(snapshot) {
|
||||
alert("Not yet implemented");
|
||||
|
||||
}
|
||||
|
||||
$scope.createSnapshot = function() {
|
||||
var modalInstance = $uibModal.open({
|
||||
animation: $scope.animationsEnabled,
|
||||
@@ -265,4 +287,18 @@ angular.module('myApp.container', ['ngRoute'])
|
||||
};
|
||||
})
|
||||
|
||||
.controller('containerSnapshotRestoreModalCtrl', function ($scope, $routeParams, $filter, $location, $uibModalInstance,
|
||||
container, snapshot, ContainerServices) {
|
||||
$scope.container = container;
|
||||
$scope.snapshot = snapshot;
|
||||
|
||||
$scope.ok = function () {
|
||||
$uibModalInstance.close();
|
||||
};
|
||||
|
||||
$scope.cancel = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
})
|
||||
|
||||
;
|
||||
|
@@ -134,7 +134,13 @@ angular.module('myApp.container')
|
||||
|
||||
obj.createSnapshot = function(containerName, snapshotData) {
|
||||
return $http.post(SettingServices.getLxdApiUrl() + '/containers/' + containerName + '/snapshots', snapshotData);
|
||||
}
|
||||
|
||||
obj.restoreSnapshot = function(containerName, snapshotName) {
|
||||
var data = {
|
||||
restore: snapshotName,
|
||||
}
|
||||
return $http.put(SettingServices.getLxdApiUrl() + '/containers/' + containerName, data);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
14
modules/container/modalSnapshotRestore.html
Normal file
14
modules/container/modalSnapshotRestore.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Restore snapshot</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Snapshot Name: {{snapshot.name}}
|
||||
<p>
|
||||
Snapshot Stateful: {{snapshot.stateful}}
|
||||
<p>
|
||||
Container name: {{container.name}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" type="button" ng-click="ok()">Restore</button>
|
||||
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
|
||||
</div>
|
Reference in New Issue
Block a user