mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
Move startContainer to its own submodule.
This commit is contained in:
parent
3a28cb9889
commit
57fef1c958
5 changed files with 49 additions and 47 deletions
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('dockerui', ['ngRoute', 'dockerui.services', 'dockerui.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images', 'image'])
|
angular.module('dockerui', ['ngRoute', 'dockerui.services', 'dockerui.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images', 'image', 'startContainer'])
|
||||||
.config(['$routeProvider', function ($routeProvider) {
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
$routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'});
|
$routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'});
|
||||||
$routeProvider.when('/containers/', {templateUrl: 'app/components/containers/containers.html', controller: 'ContainersController'});
|
$routeProvider.when('/containers/', {templateUrl: 'app/components/containers/containers.html', controller: 'ContainersController'});
|
||||||
|
|
47
app/components/startContainer/startContainerController.js
Normal file
47
app/components/startContainer/startContainerController.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
angular.module('startContainer', [])
|
||||||
|
.controller('StartContainerController', ['$scope', '$routeParams', '$location', 'Container', 'Messages',
|
||||||
|
function($scope, $routeParams, $location, Container, Messages) {
|
||||||
|
$scope.template = 'app/components/startContainer/startcontainer.html';
|
||||||
|
$scope.config = {
|
||||||
|
name: '',
|
||||||
|
memory: 0,
|
||||||
|
memorySwap: 0,
|
||||||
|
cpuShares: 1024,
|
||||||
|
env: '',
|
||||||
|
commands: '',
|
||||||
|
volumesFrom: ''
|
||||||
|
};
|
||||||
|
$scope.commandPlaceholder = '["/bin/echo", "Hello world"]';
|
||||||
|
|
||||||
|
$scope.create = function() {
|
||||||
|
var cmds = null;
|
||||||
|
if ($scope.config.commands !== '') {
|
||||||
|
cmds = angular.fromJson($scope.config.commands);
|
||||||
|
}
|
||||||
|
var id = $routeParams.id;
|
||||||
|
var ctor = Container;
|
||||||
|
var loc = $location;
|
||||||
|
var s = $scope;
|
||||||
|
|
||||||
|
Container.create({
|
||||||
|
Image: id,
|
||||||
|
name: $scope.config.name,
|
||||||
|
Memory: $scope.config.memory,
|
||||||
|
MemorySwap: $scope.config.memorySwap,
|
||||||
|
CpuShares: $scope.config.cpuShares,
|
||||||
|
Cmd: cmds,
|
||||||
|
VolumesFrom: $scope.config.volumesFrom
|
||||||
|
}, function(d) {
|
||||||
|
if (d.Id) {
|
||||||
|
ctor.start({id: d.Id}, function(cd) {
|
||||||
|
$('#create-modal').modal('hide');
|
||||||
|
loc.path('/containers/' + d.Id + '/');
|
||||||
|
}, function(e) {
|
||||||
|
failedRequestHandler(e, Messages);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, function(e) {
|
||||||
|
failedRequestHandler(e, Messages);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}]);
|
|
@ -67,52 +67,6 @@ function SettingsController($scope, System, Docker, Settings, Messages) {
|
||||||
System.get({}, function(d) { $scope.info = d; });
|
System.get({}, function(d) { $scope.info = d; });
|
||||||
}
|
}
|
||||||
|
|
||||||
function StartContainerController($scope, $routeParams, $location, Container, Messages) {
|
|
||||||
$scope.template = 'partials/startcontainer.html';
|
|
||||||
$scope.config = {
|
|
||||||
name: '',
|
|
||||||
memory: 0,
|
|
||||||
memorySwap: 0,
|
|
||||||
cpuShares: 1024,
|
|
||||||
env: '',
|
|
||||||
commands: '',
|
|
||||||
volumesFrom: ''
|
|
||||||
};
|
|
||||||
$scope.commandPlaceholder = '["/bin/echo", "Hello world"]';
|
|
||||||
|
|
||||||
$scope.create = function() {
|
|
||||||
var cmds = null;
|
|
||||||
if ($scope.config.commands !== '') {
|
|
||||||
cmds = angular.fromJson($scope.config.commands);
|
|
||||||
}
|
|
||||||
var id = $routeParams.id;
|
|
||||||
var ctor = Container;
|
|
||||||
var loc = $location;
|
|
||||||
var s = $scope;
|
|
||||||
|
|
||||||
Container.create({
|
|
||||||
Image: id,
|
|
||||||
name: $scope.config.name,
|
|
||||||
Memory: $scope.config.memory,
|
|
||||||
MemorySwap: $scope.config.memorySwap,
|
|
||||||
CpuShares: $scope.config.cpuShares,
|
|
||||||
Cmd: cmds,
|
|
||||||
VolumesFrom: $scope.config.volumesFrom
|
|
||||||
}, function(d) {
|
|
||||||
if (d.Id) {
|
|
||||||
ctor.start({id: d.Id}, function(cd) {
|
|
||||||
$('#create-modal').modal('hide');
|
|
||||||
loc.path('/containers/' + d.Id + '/');
|
|
||||||
}, function(e) {
|
|
||||||
failedRequestHandler(e, Messages);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, function(e) {
|
|
||||||
failedRequestHandler(e, Messages);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function BuilderController($scope, Dockerfile, Messages) {
|
function BuilderController($scope, Dockerfile, Messages) {
|
||||||
$scope.template = 'partials/builder.html';
|
$scope.template = 'partials/builder.html';
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
<script src="app/components/dashboard/dashboardController.js"></script>
|
<script src="app/components/dashboard/dashboardController.js"></script>
|
||||||
<script src="app/components/container/containerController.js"></script>
|
<script src="app/components/container/containerController.js"></script>
|
||||||
<script src="app/components/containers/containersController.js"></script>
|
<script src="app/components/containers/containersController.js"></script>
|
||||||
|
<script src="app/components/startContainer/startContainerController.js"></script>
|
||||||
<script src="app/components/image/imageController.js"></script>
|
<script src="app/components/image/imageController.js"></script>
|
||||||
<script src="app/components/images/imagesController.js"></script>
|
<script src="app/components/images/imagesController.js"></script>
|
||||||
<script src="app/viewmodel.js"></script>
|
<script src="app/viewmodel.js"></script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue