mirror of https://github.com/portainer/portainer
feat(app): push pull container details commit
parent
7b9998bdde
commit
527c52b715
|
@ -5,7 +5,6 @@ angular.module('portainer.docker')
|
||||||
endpointId: EndpointProvider.endpointID
|
endpointId: EndpointProvider.endpointID
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// commitContainer: {method: 'POST', params: {container: '@id', repo: '@repo', tag: '@tag'}, ignoreLoadingBar: true}
|
|
||||||
commitContainer: {method: 'POST', params: {container: '@id', repo: '@repo'}, ignoreLoadingBar: true}
|
commitContainer: {method: 'POST', params: {container: '@id', repo: '@repo'}, ignoreLoadingBar: true}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -169,7 +169,7 @@
|
||||||
<!-- !tag-note -->
|
<!-- !tag-note -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<button type="button" class="btn btn-primary btn-sm" ng-disabled="!config.Image" ng-click="commit()">Create</button>
|
<button type="button" class="btn btn-primary btn-sm" ng-disabled="!config.RegistryModel.Image || config.commitInProgress" ng-click="commit()">Create</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -2,13 +2,14 @@ import moment from 'moment';
|
||||||
import { PorImageRegistryModel } from 'Docker/models/porImageRegistry';
|
import { PorImageRegistryModel } from 'Docker/models/porImageRegistry';
|
||||||
|
|
||||||
angular.module('portainer.docker')
|
angular.module('portainer.docker')
|
||||||
.controller('ContainerController', ['$q', '$scope', '$state','$transition$', '$filter', 'Commit', 'ContainerHelper', 'ContainerService', 'ImageHelper', 'NetworkService', 'Notifications', 'ModalService', 'ResourceControlService', 'RegistryService', 'ImageService', 'HttpRequestHelper', 'Authentication',
|
.controller('ContainerController', ['$q', '$scope', '$state','$transition$', '$filter', '$async', 'Commit', 'ContainerHelper', 'ContainerService', 'ImageHelper', 'NetworkService', 'Notifications', 'ModalService', 'ResourceControlService', 'RegistryService', 'ImageService', 'HttpRequestHelper', 'Authentication',
|
||||||
function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, ContainerService, ImageHelper, NetworkService, Notifications, ModalService, ResourceControlService, RegistryService, ImageService, HttpRequestHelper, Authentication) {
|
function ($q, $scope, $state, $transition$, $filter, $async, Commit, ContainerHelper, ContainerService, ImageHelper, NetworkService, Notifications, ModalService, ResourceControlService, RegistryService, ImageService, HttpRequestHelper, Authentication) {
|
||||||
$scope.activityTime = 0;
|
$scope.activityTime = 0;
|
||||||
$scope.portBindings = [];
|
$scope.portBindings = [];
|
||||||
|
|
||||||
$scope.config = {
|
$scope.config = {
|
||||||
RegistryModel: new PorImageRegistryModel()
|
RegistryModel: new PorImageRegistryModel(),
|
||||||
|
commitInProgress: false
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.state = {
|
$scope.state = {
|
||||||
|
@ -149,19 +150,23 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO CHANGE
|
async function commitContainerAsync() {
|
||||||
$scope.commit = function () {
|
$scope.config.commitInProgress = true;
|
||||||
const image = $scope.config.Image;
|
const registryModel = $scope.config.RegistryModel;
|
||||||
$scope.config.Image = '';
|
const imageConfig = ImageHelper.createImageConfigForContainer(registryModel);
|
||||||
Commit.commitContainer({id: $transition$.params().id, repo: image}, function () {
|
try {
|
||||||
update();
|
await Commit.commitContainer({id: $transition$.params().id, repo: imageConfig.fromImage}).$promise;
|
||||||
Notifications.success('Image created', $transition$.params().id);
|
Notifications.success('Image created', $transition$.params().id);
|
||||||
}, function (e) {
|
$state.reload();
|
||||||
update();
|
} catch (err) {
|
||||||
Notifications.error('Failure', e, 'Unable to create image');
|
Notifications.error('Failure', err, 'Unable to create image');
|
||||||
});
|
$scope.config.commitInProgress = false;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.commit = function () {
|
||||||
|
return $async(commitContainerAsync);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.confirmRemove = function () {
|
$scope.confirmRemove = function () {
|
||||||
var title = 'You are about to remove a container.';
|
var title = 'You are about to remove a container.';
|
||||||
|
|
Loading…
Reference in New Issue