mirror of https://github.com/portainer/portainer
Update post in service with correct id
parent
d4c556752f
commit
92e81a76dc
|
@ -49,16 +49,22 @@ function SettingsController() {
|
|||
}
|
||||
|
||||
function ContainerController($scope, $routeParams, Container) {
|
||||
$('#response').hide();
|
||||
|
||||
$scope.start = function(){
|
||||
Container.start({id: $routeParams.id}, function(d) {
|
||||
$scope.response = d;
|
||||
$('#response').show();
|
||||
setTimeout($('#response').hide, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.stop = function() {
|
||||
|
||||
Container.stop({id: $routeParams.id}, function(d) {
|
||||
$scope.response = d;
|
||||
$('#response').show();
|
||||
setTimeout($('#response').hide, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -85,11 +91,26 @@ function ContainerController($scope, $routeParams, Container) {
|
|||
$scope.getChanges();
|
||||
}
|
||||
|
||||
function ContainersController($scope, Container) {
|
||||
Container.query({}, function(d) {
|
||||
$scope.containers = d;
|
||||
});
|
||||
}
|
||||
function ContainersController($scope, Container, Settings) {
|
||||
$scope.displayAll = Settings.displayAll;
|
||||
$scope.predicate = '-Created';
|
||||
var update = function(data) {
|
||||
Container.query(data, function(d) {
|
||||
$scope.containers = d;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleGetAll = function() {
|
||||
Settings.displayAll = $scope.displayAll;
|
||||
var u = update;
|
||||
var data = {all: 0};
|
||||
if ($scope.displayAll) {
|
||||
data.all = 1;
|
||||
}
|
||||
u(data);
|
||||
};
|
||||
update({all: $scope.displayAll ? 1 : 0});
|
||||
}
|
||||
|
||||
function ImagesController($scope, Image) {
|
||||
|
||||
|
@ -101,7 +122,7 @@ function ImagesController($scope, Image) {
|
|||
|
||||
function ImageController($scope, $routeParams, Image) {
|
||||
$scope.history = [];
|
||||
$scope.tag = {tag: '', repo: '', force: false};
|
||||
$scope.tag = {repo: '', force: false};
|
||||
$scope.remove = function() {
|
||||
if (confirm("Are you sure you want to delete this image?")) {
|
||||
Image.remove({id: $routeParams.id}, function(d) {
|
||||
|
@ -118,7 +139,7 @@ function ImageController($scope, $routeParams, Image) {
|
|||
|
||||
$scope.updateTag = function() {
|
||||
var tag = $scope.tag;
|
||||
Image.tag({id: $routeParams.id, tag: tag.tag, repo: tag.repo, force: tag.force ? 1 : 0}, function(d) {
|
||||
Image.tag({id: $routeParams.id, repo: tag.repo, force: tag.force ? 1 : 0}, function(d) {
|
||||
$scope.response = d;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -21,6 +21,8 @@ angular.module('dockerui.filters', [])
|
|||
return function(text) {
|
||||
if (text === 'Ghost') {
|
||||
return 'important';
|
||||
} else if (text.indexOf('Exit') != -1 && text !== 'Exit 0') {
|
||||
return 'warning';
|
||||
}
|
||||
return 'success';
|
||||
};
|
||||
|
|
|
@ -7,13 +7,13 @@ angular.module('dockerui.services', ['ngResource'])
|
|||
return $resource(DOCKER_ENDPOINT + '/containers/:id/:action', {}, {
|
||||
query: {method: 'GET', params:{ all: 0, action: 'json'}, isArray: true},
|
||||
get :{method: 'GET', params: { action:'json'}},
|
||||
start: {method: 'POST', params: { action: 'start'}},
|
||||
stop: {method: 'POST', params: {t: 5, action: 'stop'}},
|
||||
restart: {method: 'POST', params: {t: 5, action: 'restart' }},
|
||||
kill :{method: 'POST', params: {action:'kill'}},
|
||||
start: {method: 'POST', params: {id: '@id', action: 'start'}},
|
||||
stop: {method: 'POST', params: {id: '@id', t: 5, action: 'stop'}},
|
||||
restart: {method: 'POST', params: {id: '@id', t: 5, action: 'restart' }},
|
||||
kill :{method: 'POST', params: {id: '@id', action:'kill'}},
|
||||
changes :{method: 'GET', params: {action:'changes'}, isArray: true},
|
||||
create :{method: 'POST', params: {action:'create'}},
|
||||
remove :{method: 'DELETE', params: {v:0}}
|
||||
remove :{method: 'DELETE', params: {id: '@id', v:0}}
|
||||
});
|
||||
})
|
||||
.factory('Image', function($resource, DOCKER_ENDPOINT) {
|
||||
|
@ -25,9 +25,14 @@ angular.module('dockerui.services', ['ngResource'])
|
|||
search :{method: 'GET', params: { action:'search'}},
|
||||
history :{method: 'GET', params: { action:'history'}, isArray: true},
|
||||
create :{method: 'POST', params: {action:'create'}},
|
||||
insert :{method: 'POST', params: {action:'insert'}},
|
||||
push :{method: 'POST', params: {action:'push'}},
|
||||
tag :{method: 'POST', params: {action:'tag'}},
|
||||
delete :{method: 'DELETE'}
|
||||
insert :{method: 'POST', params: {id: '@id', action:'insert'}},
|
||||
push :{method: 'POST', params: {id: '@id', action:'push'}},
|
||||
tag :{method: 'POST', params: {id: '@id', action:'tag'}},
|
||||
delete :{id: '@id', method: 'DELETE'}
|
||||
});
|
||||
})
|
||||
.factory('Settings', function() {
|
||||
return {
|
||||
displayAll: false
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<div class="detail">
|
||||
<div id="response" class="alert alert-block">
|
||||
|
||||
</div>
|
||||
|
||||
<h4>Container: {{ container.Id }}</h4>
|
||||
|
||||
<div class="btn-group detail">
|
||||
|
@ -26,7 +30,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Image:</td>
|
||||
<td><a href="#">{{ container.Image }}</a></td>
|
||||
<td><a href="/#/images/{{ container.Image }}/">{{ container.Image }}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Running:</td>
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
|
||||
<h2>Containers:</h2>
|
||||
|
||||
<div style="float:right;">
|
||||
<input type="checkbox" ng-model="displayAll" ng-click="toggleGetAll()"/> Display All
|
||||
</div>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -12,11 +15,11 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="container in containers">
|
||||
<tr ng-repeat="container in containers|orderBy:predicate">
|
||||
<td><a href="/#/containers/{{ container.Id }}/">{{ container.Id|truncate:10}}</a></td>
|
||||
<td>{{ container.Image }}</td>
|
||||
<td>{{ container.Command }}</td>
|
||||
<td>{{ container.Created }}</td>
|
||||
<td><a href="/#/images/{{ container.Image }}/">{{ container.Image }}</a></td>
|
||||
<td>{{ container.Command|truncate:40 }}</td>
|
||||
<td>{{ container.Created|getdate }}</td>
|
||||
<td><span class="label label-{{ container.Status|statusbadge }}">{{ container.Status }}</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -61,11 +61,9 @@
|
|||
<div class="row-fluid">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>Add Tag</legend>
|
||||
<label>Tag:</label>
|
||||
<input type="text" placeholder="Tag..." ng-model="tag.tag" />
|
||||
<legend>Tag to Repo</legend>
|
||||
<label>Repo:</label>
|
||||
<input type="text" placeholder="Repo..." ng-model="tag.repo" />
|
||||
<input type="text" placeholder="Repo..." ng-model="tag.repo" required>
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" ng-model="tag.force"/> Force?
|
||||
</label>
|
||||
|
|
Loading…
Reference in New Issue