diff --git a/app/components/container/container.html b/app/components/container/container.html index 5d9b16401..1d2746dd0 100644 --- a/app/components/container/container.html +++ b/app/components/container/container.html @@ -40,6 +40,10 @@ ng-click="unpause()" ng-show="container.State.Running && container.State.Paused">Unpause + diff --git a/app/components/container/containerController.js b/app/components/container/containerController.js index e79ea8c77..8739f58fd 100644 --- a/app/components/container/containerController.js +++ b/app/components/container/containerController.js @@ -1,6 +1,6 @@ angular.module('container', []) -.controller('ContainerController', ['$scope', '$routeParams', '$location', 'Container', 'Messages', 'ViewSpinner', -function($scope, $routeParams, $location, Container, Messages, ViewSpinner) { +.controller('ContainerController', ['$scope', '$routeParams', '$location', 'Container', 'ContainerCommit', 'Messages', 'ViewSpinner', +function($scope, $routeParams, $location, Container, ContainerCommit, Messages, ViewSpinner) { $scope.changes = []; $scope.edit = false; @@ -58,6 +58,16 @@ function($scope, $routeParams, $location, Container, Messages, ViewSpinner) { }); }; + $scope.commit = function() { + ViewSpinner.spin(); + ContainerCommit.commit({id: $routeParams.id, repo: $scope.container.Config.Image}, function(d) { + update(); + Messages.send("Container commited", $routeParams.id); + }, function(e) { + update(); + Messages.error("Failure", "Container failed to commit." + e.data); + }); + }; $scope.pause = function() { ViewSpinner.spin(); Container.pause({id: $routeParams.id}, function(d) { diff --git a/app/shared/services.js b/app/shared/services.js index 5ed45934b..ad5f0de52 100644 --- a/app/shared/services.js +++ b/app/shared/services.js @@ -20,6 +20,23 @@ angular.module('dockerui.services', ['ngResource']) rename: {method: 'POST', params: {id: '@id', action: 'rename'}, isArray: false} }); }) + .factory('ContainerCommit', function ($resource, $http, Settings) { + 'use strict'; + return { + commit: function (params, callback) { + $http({ + method: 'POST', + url: Settings.url + '/commit', + params: { + 'container': params.id, + 'repo': params.repo + } + }).success(callback).error(function (data, status, headers, config) { + console.log(error, data); + }); + } + }; + }) .factory('ContainerLogs', function ($resource, $http, Settings) { 'use strict'; return {