1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +02:00

feat(container-details): update container-restart-policy component (#2273)

This commit is contained in:
Anthony Lapenna 2018-09-15 09:53:35 +08:00 committed by GitHub
parent b24891a6bc
commit 77913543b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 55 deletions

View file

@ -1,36 +1,26 @@
angular
.module('portainer.docker')
.controller('ContainerRestartPolicyController', [
function ContainerRestartPolicyController() {
var ctrl = this;
.module('portainer.docker')
.controller('ContainerRestartPolicyController', [function ContainerRestartPolicyController() {
var ctrl = this;
this.state = {
editMode :false,
editModel :{}
};
this.state = {
editModel : {}
};
ctrl.toggleEdit = toggleEdit;
ctrl.save = save;
ctrl.save = save;
function toggleEdit() {
ctrl.state.editMode = true;
ctrl.state.editModel = {
name: ctrl.name,
maximumRetryCount: ctrl.maximumRetryCount
};
}
function save() {
if (ctrl.state.editModel.name === ctrl.name &&
ctrl.state.editModel.maximumRetryCount === ctrl.maximumRetryCount) {
ctrl.state.editMode = false;
return;
}
ctrl.updateRestartPolicy(ctrl.state.editModel)
.then(function onUpdateSucceed() {
ctrl.state.editMode = false;
});
}
function save() {
if (ctrl.state.editModel.name === ctrl.name && ctrl.state.editModel.maximumRetryCount === ctrl.maximumRetryCount) {
return;
}
]);
ctrl.updateRestartPolicy(ctrl.state.editModel);
}
this.$onInit = function() {
ctrl.state.editModel = {
name: ctrl.name,
maximumRetryCount: ctrl.maximumRetryCount
};
};
}
]);