mirror of https://github.com/portainer/portainer
Improve messages
parent
0e41aec7f9
commit
7ae0b17573
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div ng-include="template" ng-controller="MastheadController"></div>
|
<div ng-include="template" ng-controller="MastheadController"></div>
|
||||||
<div ng-include="template" ng-controller="MessageController"></div>
|
|
||||||
|
|
||||||
<div id="view" ng-view></div>
|
<div id="view" ng-view></div>
|
||||||
|
|
||||||
|
|
|
@ -51,23 +51,6 @@ function DashboardController($scope, Container) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function MessageController($scope, Messages) {
|
|
||||||
$scope.template = 'partials/messages.html';
|
|
||||||
$scope.messages = [];
|
|
||||||
$scope.$watch('messages.length', function(o, n) {
|
|
||||||
$('#message-display').show();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on(Messages.event, function(e, msg) {
|
|
||||||
$scope.messages.push(msg);
|
|
||||||
var s = $scope;
|
|
||||||
setTimeout(function() {
|
|
||||||
$('#message-display').hide('slow');
|
|
||||||
s.messages = [];
|
|
||||||
}, 20000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function StatusBarController($scope, Settings) {
|
function StatusBarController($scope, Settings) {
|
||||||
$scope.template = 'partials/statusbar.html';
|
$scope.template = 'partials/statusbar.html';
|
||||||
|
|
||||||
|
@ -109,7 +92,7 @@ function ContainerController($scope, $routeParams, $location, Container, Message
|
||||||
|
|
||||||
$scope.stop = function() {
|
$scope.stop = function() {
|
||||||
Container.stop({id: $routeParams.id}, function(d) {
|
Container.stop({id: $routeParams.id}, function(d) {
|
||||||
Messages.success("Container stopped", $routeParams.id);
|
Messages.send("Container stopped", $routeParams.id);
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
Messages.error("Failure", "Container failed to stop." + e.data);
|
Messages.error("Failure", "Container failed to stop." + e.data);
|
||||||
});
|
});
|
||||||
|
@ -117,7 +100,7 @@ function ContainerController($scope, $routeParams, $location, Container, Message
|
||||||
|
|
||||||
$scope.kill = function() {
|
$scope.kill = function() {
|
||||||
Container.kill({id: $routeParams.id}, function(d) {
|
Container.kill({id: $routeParams.id}, function(d) {
|
||||||
Messages.success("Container killed", $routeParams.id);
|
Messages.send("Container killed", $routeParams.id);
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
Messages.error("Failure", "Container failed to die." + e.data);
|
Messages.error("Failure", "Container failed to die." + e.data);
|
||||||
});
|
});
|
||||||
|
@ -125,7 +108,7 @@ function ContainerController($scope, $routeParams, $location, Container, Message
|
||||||
|
|
||||||
$scope.remove = function() {
|
$scope.remove = function() {
|
||||||
Container.remove({id: $routeParams.id}, function(d) {
|
Container.remove({id: $routeParams.id}, function(d) {
|
||||||
Messages.success("Container removed", $routeParams.id);
|
Messages.send("Container removed", $routeParams.id);
|
||||||
}, function(e){
|
}, function(e){
|
||||||
Messages.error("Failure", "Container failed to remove." + e.data);
|
Messages.error("Failure", "Container failed to remove." + e.data);
|
||||||
});
|
});
|
||||||
|
@ -169,7 +152,7 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var batch = function(items, action) {
|
var batch = function(items, action, msg) {
|
||||||
ViewSpinner.spin();
|
ViewSpinner.spin();
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
var complete = function() {
|
var complete = function() {
|
||||||
|
@ -182,7 +165,7 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
||||||
if (c.Checked) {
|
if (c.Checked) {
|
||||||
counter = counter + 1;
|
counter = counter + 1;
|
||||||
action({id: c.Id}, function(d) {
|
action({id: c.Id}, function(d) {
|
||||||
Messages.error("Container Removed", c.Id);
|
Messages.send("Container " + msg, c.Id);
|
||||||
var index = $scope.containers.indexOf(c);
|
var index = $scope.containers.indexOf(c);
|
||||||
$scope.containers.splice(index, 1);
|
$scope.containers.splice(index, 1);
|
||||||
complete();
|
complete();
|
||||||
|
@ -211,19 +194,19 @@ function ContainersController($scope, Container, Settings, Messages, ViewSpinner
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.startAction = function() {
|
$scope.startAction = function() {
|
||||||
batch($scope.containers, Container.start);
|
batch($scope.containers, Container.start, "Started");
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.stopAction = function() {
|
$scope.stopAction = function() {
|
||||||
batch($scope.containers, Container.stop);
|
batch($scope.containers, Container.stop, "Stopped");
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.killAction = function() {
|
$scope.killAction = function() {
|
||||||
batch($scope.containers, Container.kill);
|
batch($scope.containers, Container.kill, "Killed");
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.removeAction = function() {
|
$scope.removeAction = function() {
|
||||||
batch($scope.containers, Container.remove);
|
batch($scope.containers, Container.remove, "Removed");
|
||||||
};
|
};
|
||||||
|
|
||||||
update({all: $scope.displayAll ? 1 : 0});
|
update({all: $scope.displayAll ? 1 : 0});
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid center">
|
||||||
<!--<div class="sidebar span4">
|
<!--<div class="sidebar span4">
|
||||||
<div ng-include="template" ng-controller="SideBarController"></div>
|
<div ng-include="template" ng-controller="SideBarController"></div>
|
||||||
</div>-->
|
</div>-->
|
||||||
|
<div class="span12">
|
||||||
|
<div class="jumbotron">
|
||||||
|
<h1>DockerUI</h1>
|
||||||
|
<p class="lead">The Linux container engine</p>
|
||||||
|
<a class="btn btn-large btn-success" href="http://docker.io">Learn more.</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div class="span6">
|
<div class="span6">
|
||||||
<h3>Running Containers</h3>
|
<h3>Running Containers</h3>
|
||||||
|
@ -20,11 +28,4 @@
|
||||||
<div id="chart-legend"></div>
|
<div id="chart-legend"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="span12">
|
|
||||||
<div class="jumbotron">
|
|
||||||
<h1>DockerUI</h1>
|
|
||||||
<p class="lead">The Linux container engine</p>
|
|
||||||
<a class="btn btn-large btn-success" href="http://docker.io">Learn more.</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<div class="alert alert-error" id="error-message" style="display:none">
|
|
||||||
{{ error }}
|
|
||||||
</div>
|
|
||||||
|
|
Loading…
Reference in New Issue