Use modal for creating a new container

pull/2/head
Michael Crosby 12 years ago
parent c3377073e3
commit c4b0a2257f

@ -0,0 +1,7 @@
DockerUI: Copyright (c) 2013 Michael Crosby. crosbymichael.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -195,8 +195,8 @@ function ImageController($scope, $routeParams, $location, Image) {
$scope.getHistory = function() {
Image.history({id: $routeParams.id}, function(d) {
$scope.history = d;
});
$scope.history = d;
});
};
$scope.updateTag = function() {
@ -209,7 +209,11 @@ function ImageController($scope, $routeParams, $location, Image) {
setFailedResponse($scope, e.data, '#response');
});
};
$scope.create = function() {
$('#create-modal').modal('show');
};
Image.get({id: $routeParams.id}, function(d) {
$scope.image = d;
}, function(e) {
@ -234,9 +238,12 @@ function StartContainerController($scope, $routeParams, $location, Container) {
};
$scope.commandPlaceholder = '["/bin/echo", "Hello world"]';
$scope.launchContainer = function() {
$scope.close = function() {
$('#create-modal').modal('hide');
};
$scope.create = function() {
$scope.response = '';
var cmds = null;
if ($scope.config.commands !== '') {
cmds = angular.fromJson($scope.config.commands);
@ -257,6 +264,7 @@ function StartContainerController($scope, $routeParams, $location, Container) {
if (d.Id) {
ctor.start({id: d.Id}, function(cd) {
console.log(cd);
$('#create-modal').modal('hide');
loc.path('/containers/' + d.Id + '/');
}, function(e) {
console.log(e);

@ -1,11 +1,19 @@
<div id="response" class="alert alert-{{ alertClass }}">
{{ response }}
{{ response }}
</div>
<div ng-include="template" ng-controller="StartContainerController"></div>
<div class="detail">
<h4>Image: {{ image.id }}</h4>
<div class="btn-group detail">
<button class="btn btn-success" ng-click="create()">Create</button>
</div>
<table class="table table-striped">
<tbody>
<tr>
@ -79,9 +87,6 @@
<hr />
<div ng-include="template" ng-controller="StartContainerController"></div>
<hr />
<div class="btn-remove">
<button class="btn btn-large btn-block btn-primary btn-danger" ng-click="remove()">Remove Image</button>

@ -1,26 +1,33 @@
<div>
{{ response }}
</div>
<form>
<fieldset>
<legend>Start container from Image</legend>
<div id="create-modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Create Container</h3>
</div>
<div class="modal-body">
<div>
{{ response }}
</div>
<form>
<fieldset>
<legend>Start container from Image</legend>
<label>Cmd:</label>
<input type="text" placeholder="{{ commandPlaceholder }}" ng-model="config.commands"/>
<small>Input commands as an array</small>
<label>Memory:</label>
<input type="number" ng-model="config.memory"/>
<label>Cmd:</label>
<input type="text" placeholder="{{ commandPlaceholder }}" ng-model="config.commands"/>
<small>Input commands as an array</small>
<label>Memory:</label>
<input type="number" ng-model="config.memory"/>
<label>Memory Swap:</label>
<input type="number" ng-model="config.memorySwap"/>
<label>Memory Swap:</label>
<input type="number" ng-model="config.memorySwap"/>
<label>Volumes From:</label>
<input type="text" ng-model="config.volumesFrom"/>
<br />
<input type="button" ng-click="launchContainer()" value="Launch" />
</fieldset>
</form>
<label>Volumes From:</label>
<input type="text" ng-model="config.volumesFrom"/>
</fieldset>
</form>
</div>
<div class="modal-footer">
<a href="" class="btn" ng-click="close()">Close</a>
<a href="" class="btn btn-primary" ng-click="create()">Create</a>
</div>
</div>

@ -1,3 +1,3 @@
<div class="footer center well">
<p><small>Docker API Version: <strong>{{ apiVersion }}</strong> UI Version: <strong>{{ uiVersion }}</strong> <a href="http://crosbymichael.com">crosbymichael</a></small></p>
<p><small>Docker API Version: <strong>{{ apiVersion }}</strong> UI Version: <strong>{{ uiVersion }}</strong> <a style="float:right" href="http://crosbymichael.com">crosbymichael</a></small></p>
</div>

Loading…
Cancel
Save