diff --git a/README.md b/README.md index 4f197cf88..4f69b1753 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ DockerUI is a web interface to interact with the Remote API. The goal is to pro ###Goals * Little to no dependencies - I really want to keep this project a pure html/js app. You can drop the docker binary on your server run so I want to be able to drop these html files on your server and go. +* Consistency - The web UI should be consistent with the commands found on the CLI. ###Installation Open js/app.js and change the DOCKER_ENDPOINT constant to your docker ip and port. Then host the site like any other html/js application. @@ -24,8 +25,6 @@ DockerUI currently supports the v1.1 Remote API ###Todo: -I work fast so it will not be long before these changes are impelmented. - * Multiple endpoints * Full repository support * Search diff --git a/css/app.css b/css/app.css index 2205e2507..590c5d1d7 100644 --- a/css/app.css +++ b/css/app.css @@ -87,3 +87,12 @@ .container-bottom { height: 50px; } + + .footer { + max-height:6px; + } + + #response { + width: 80%; + margin: 0 auto; + } diff --git a/index.html b/index.html index 2f44e2d3c..21aa7214c 100644 --- a/index.html +++ b/index.html @@ -28,16 +28,12 @@
+
-
-
- -
-
- +
+
+
diff --git a/js/app.js b/js/app.js index 3d58e29f6..386179a67 100644 --- a/js/app.js +++ b/js/app.js @@ -12,4 +12,5 @@ angular.module('dockerui', ['dockerui.services', 'dockerui.filters']) }]) // This is your docker url that the api will use to make requests .constant('DOCKER_ENDPOINT', 'http://192.168.1.9:4243\:4243') - .constant('DOCKER_API_VERSION', '/v1.1'); + .constant('UI_VERSION', 'v0.1') + .constant('DOCKER_API_VERSION', 'v1.1'); diff --git a/js/controllers.js b/js/controllers.js index 88b12db02..2f8e427df 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -37,6 +37,13 @@ function DashboardController($scope, Container) { } +function StatusBarController($scope, Settings) { + $scope.template = 'partials/statusbar.html'; + + $scope.uiVersion = Settings.uiVersion; + $scope.apiVersion = Settings.version; +} + function SideBarController($scope, Container, Settings) { $scope.template = 'partials/sidebar.html'; $scope.containers = []; @@ -65,7 +72,7 @@ function SettingsController($scope, Auth, System, Docker, Settings) { Auth.update( {username: $scope.auth.username, email: $scope.auth.email, password: $scope.auth.password}, function(d) { console.log(d); - setSuccessfulResponse($scope, 'Auto information updated.', '#response'); + setSuccessfulResponse($scope, 'Auth information updated.', '#response'); }, function(e) { console.log(e); setFailedResponse($scope, e.data, '#response'); @@ -133,6 +140,10 @@ function ContainerController($scope, $routeParams, $location, Container) { $scope.changes = []; + $scope.hasContent = function(data) { + return data !== null && data !== undefined && data.length > 1; + }; + $scope.getChanges = function() { Container.changes({id: $routeParams.id}, function(d) { $scope.changes = d; @@ -143,7 +154,10 @@ function ContainerController($scope, $routeParams, $location, Container) { $scope.container = d; }, function(e) { console.log(e); - $location.path('/containers/'); + setFailedResponse($scope, e.data, '#response'); + if (e.status === 404) { + $('.detail').hide(); + } }); $scope.getChanges(); @@ -175,9 +189,14 @@ function ContainersController($scope, Container, Settings) { function ImagesController($scope, Image) { $scope.predicate = '-Created'; + $('#response').hide(); + $scope.alertClass = 'block'; Image.query({}, function(d) { $scope.images = d; + }, function (e) { + console.log(e); + setFailedResponse($scope, e.data, '#response'); }); } @@ -221,7 +240,10 @@ function ImageController($scope, $routeParams, $location, Image) { $scope.image = d; }, function(e) { console.log(e); - $location.path('/images/'); + setFailedResponse($scope, e.data, '#response'); + if (e.status === 404) { + $('.detail').hide(); + } }); $scope.getHistory(); @@ -229,17 +251,21 @@ function ImageController($scope, $routeParams, $location, Image) { function StartContainerController($scope, $routeParams, $location, Container) { $scope.template = 'partials/startcontainer.html'; - $scope.memory = 0; - $scope.memorySwap = 0; - $scope.env = ''; - $scope.dns = ''; - $scope.volumesFrom = ''; - $scope.commands = ''; + $scope.config = { + memory: 0, + memorySwap: 0, + env: '', + commands: '', + volumesFrom: '' + }; + $scope.commandPlaceholder = '["/bin/echo", "Hello world"]'; $scope.launchContainer = function() { + $scope.response = ''; + var cmds = null; - if ($scope.commands !== '') { - cmds = $scope.commands.split('\n'); + if ($scope.config.commands !== '') { + cmds = angular.fromJson($scope.config.commands); } var id = $routeParams.id; var ctor = Container; @@ -248,10 +274,10 @@ function StartContainerController($scope, $routeParams, $location, Container) { Container.create({ Image: id, - Memory: $scope.memory, - MemorySwap: $scope.memorySwap, + Memory: $scope.config.memory, + MemorySwap: $scope.config.memorySwap, Cmd: cmds, - VolumesFrom: $scope.volumesFrom + VolumesFrom: $scope.config.volumesFrom }, function(d) { console.log(d); if (d.Id) { diff --git a/js/services.js b/js/services.js index 3b44cfdb4..72aa79f4e 100644 --- a/js/services.js +++ b/js/services.js @@ -27,7 +27,7 @@ angular.module('dockerui.services', ['ngResource']) create :{method: 'POST', params: {action:'create'}}, insert :{method: 'POST', params: {id: '@id', action:'insert'}}, push :{method: 'POST', params: {id: '@id', action:'push'}}, - tag :{method: 'POST', params: {id: '@id', action:'tag'}}, + tag :{method: 'POST', params: {id: '@id', action:'tag', force: 0, repo: '@repo'}}, delete :{id: '@id', method: 'DELETE'} }); }) @@ -53,11 +53,12 @@ angular.module('dockerui.services', ['ngResource']) get: {method: 'GET'} }); }) - .factory('Settings', function(DOCKER_ENDPOINT, DOCKER_API_VERSION) { + .factory('Settings', function(DOCKER_ENDPOINT, DOCKER_API_VERSION, UI_VERSION) { return { displayAll: false, endpoint: DOCKER_ENDPOINT, version: DOCKER_API_VERSION, - url: DOCKER_ENDPOINT + DOCKER_API_VERSION + url: DOCKER_ENDPOINT + '/' + DOCKER_API_VERSION, + uiVersion: UI_VERSION }; }); diff --git a/partials/container.html b/partials/container.html index df0d0e84d..ec230cbc4 100644 --- a/partials/container.html +++ b/partials/container.html @@ -1,8 +1,9 @@ -
-
+
{{ response }} -
+
+
+

Container: {{ container.Id }}

@@ -51,7 +52,7 @@
    -
  • +
  • {{ change.Path }} {{ change.Kind }}
diff --git a/partials/image.html b/partials/image.html index 05f7b021a..5692d5235 100644 --- a/partials/image.html +++ b/partials/image.html @@ -1,9 +1,9 @@ -
- -
+
{{ response }} -
+
+
+

Image: {{ image.id }}

@@ -64,15 +64,15 @@
-
+
- Tag to Repo - - + Tag image + + - +
diff --git a/partials/images.html b/partials/images.html index 0840f3938..e6549e9a1 100644 --- a/partials/images.html +++ b/partials/images.html @@ -1,6 +1,10 @@

Images:

+
+ {{ response }} +
+
diff --git a/partials/startcontainer.html b/partials/startcontainer.html index 98a81f608..0cef79c27 100644 --- a/partials/startcontainer.html +++ b/partials/startcontainer.html @@ -9,17 +9,16 @@ Start container from Image - - Place each command on a new line - + + Input commands as an array - + - + - +
diff --git a/partials/statusbar.html b/partials/statusbar.html new file mode 100644 index 000000000..d4abfe6ff --- /dev/null +++ b/partials/statusbar.html @@ -0,0 +1,3 @@ +