mirror of https://github.com/portainer/portainer
Move images to its own submodule.
parent
ce8d349daf
commit
3072a05c5a
|
@ -1,11 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('dockerui', ['ngRoute', 'dockerui.services', 'dockerui.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers'])
|
||||
angular.module('dockerui', ['ngRoute', 'dockerui.services', 'dockerui.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images'])
|
||||
.config(['$routeProvider', function ($routeProvider) {
|
||||
$routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'});
|
||||
$routeProvider.when('/containers/', {templateUrl: 'app/components/containers/containers.html', controller: 'ContainersController'});
|
||||
$routeProvider.when('/containers/:id/', {templateUrl: 'app/components/container/container.html', controller: 'ContainerController'});
|
||||
$routeProvider.when('/images/', {templateUrl: 'partials/images.html', controller: 'ImagesController'});
|
||||
$routeProvider.when('/images/', {templateUrl: 'app/components/images/images.html', controller: 'ImagesController'});
|
||||
$routeProvider.when('/images/:id/', {templateUrl: 'partials/image.html', controller: 'ImageController'});
|
||||
$routeProvider.when('/settings', {templateUrl: 'partials/settings.html', controller: 'SettingsController'});
|
||||
$routeProvider.otherwise({redirectTo: '/'});
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
angular.module('images', [])
|
||||
.controller('ImagesController', ['$scope', 'Image', 'ViewSpinner', 'Messages',
|
||||
function($scope, Image, ViewSpinner, Messages) {
|
||||
$scope.toggle = false;
|
||||
$scope.predicate = '-Created';
|
||||
|
||||
$scope.showBuilder = function() {
|
||||
$('#build-modal').modal('show');
|
||||
};
|
||||
|
||||
$scope.removeAction = function() {
|
||||
ViewSpinner.spin();
|
||||
var counter = 0;
|
||||
var complete = function() {
|
||||
counter = counter - 1;
|
||||
if (counter === 0) {
|
||||
ViewSpinner.stop();
|
||||
}
|
||||
};
|
||||
angular.forEach($scope.images, function(i) {
|
||||
if (i.Checked) {
|
||||
counter = counter + 1;
|
||||
Image.remove({id: i.Id}, function(d) {
|
||||
angular.forEach(d, function(resource) {
|
||||
Messages.send("Image deleted", resource.Deleted);
|
||||
});
|
||||
var index = $scope.images.indexOf(i);
|
||||
$scope.images.splice(index, 1);
|
||||
complete();
|
||||
}, function(e) {
|
||||
Messages.error("Failure", e.data);
|
||||
complete();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleSelectAll = function() {
|
||||
angular.forEach($scope.images, function(i) {
|
||||
i.Checked = $scope.toggle;
|
||||
});
|
||||
};
|
||||
|
||||
ViewSpinner.spin();
|
||||
Image.query({}, function(d) {
|
||||
$scope.images = d.map(function(item) { return new ImageViewModel(item); });
|
||||
ViewSpinner.stop();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e.data);
|
||||
ViewSpinner.stop();
|
||||
});
|
||||
}]);
|
|
@ -67,58 +67,6 @@ function SettingsController($scope, System, Docker, Settings, Messages) {
|
|||
System.get({}, function(d) { $scope.info = d; });
|
||||
}
|
||||
|
||||
// Controller for the list of images
|
||||
function ImagesController($scope, Image, ViewSpinner, Messages) {
|
||||
$scope.toggle = false;
|
||||
$scope.predicate = '-Created';
|
||||
|
||||
$scope.showBuilder = function() {
|
||||
$('#build-modal').modal('show');
|
||||
};
|
||||
|
||||
$scope.removeAction = function() {
|
||||
ViewSpinner.spin();
|
||||
var counter = 0;
|
||||
var complete = function() {
|
||||
counter = counter - 1;
|
||||
if (counter === 0) {
|
||||
ViewSpinner.stop();
|
||||
}
|
||||
};
|
||||
angular.forEach($scope.images, function(i) {
|
||||
if (i.Checked) {
|
||||
counter = counter + 1;
|
||||
Image.remove({id: i.Id}, function(d) {
|
||||
angular.forEach(d, function(resource) {
|
||||
Messages.send("Image deleted", resource.Deleted);
|
||||
});
|
||||
var index = $scope.images.indexOf(i);
|
||||
$scope.images.splice(index, 1);
|
||||
complete();
|
||||
}, function(e) {
|
||||
Messages.error("Failure", e.data);
|
||||
complete();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleSelectAll = function() {
|
||||
angular.forEach($scope.images, function(i) {
|
||||
i.Checked = $scope.toggle;
|
||||
});
|
||||
};
|
||||
|
||||
ViewSpinner.spin();
|
||||
Image.query({}, function(d) {
|
||||
$scope.images = d.map(function(item) { return new ImageViewModel(item); });
|
||||
ViewSpinner.stop();
|
||||
}, function (e) {
|
||||
Messages.error("Failure", e.data);
|
||||
ViewSpinner.stop();
|
||||
});
|
||||
}
|
||||
|
||||
// Controller for a single image and actions on that image
|
||||
function ImageController($scope, $q, $routeParams, $location, Image, Container, Messages) {
|
||||
$scope.history = [];
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<script src="app/components/dashboard/dashboardController.js"></script>
|
||||
<script src="app/components/container/containerController.js"></script>
|
||||
<script src="app/components/containers/containersController.js"></script>
|
||||
<script src="app/components/images/imagesController.js"></script>
|
||||
<script src="app/viewmodel.js"></script>
|
||||
|
||||
<!-- Fav and touch icons -->
|
||||
|
|
Loading…
Reference in New Issue