diff --git a/app/app.js b/app/app.js
index 658de03d1..e707b41b9 100644
--- a/app/app.js
+++ b/app/app.js
@@ -10,6 +10,7 @@ angular.module('uifordocker', [
'dashboard',
'container',
'containers',
+ 'docker',
'images',
'image',
'pullImage',
@@ -56,6 +57,11 @@ angular.module('uifordocker', [
templateUrl: 'app/components/containerLogs/containerlogs.html',
controller: 'ContainerLogsController'
})
+ .state('docker', {
+ url: '/docker/',
+ templateUrl: 'app/components/docker/docker.html',
+ controller: 'DockerController'
+ })
.state('images', {
url: '/images/',
templateUrl: 'app/components/images/images.html',
@@ -113,4 +119,5 @@ angular.module('uifordocker', [
// You need to set this to the api endpoint without the port i.e. http://192.168.1.9
.constant('DOCKER_ENDPOINT', 'dockerapi')
.constant('DOCKER_PORT', '') // Docker port, leave as an empty string if no port is requred. If you have a port, prefix it with a ':' i.e. :4243
- .constant('UI_VERSION', 'v1.0.2');
+ .constant('CONFIG_ENDPOINT', '/config')
+ .constant('UI_VERSION', 'v1.0.3');
diff --git a/app/components/dashboard/master-ctrl.js b/app/components/dashboard/master-ctrl.js
index 7bba9bb1f..330952b41 100644
--- a/app/components/dashboard/master-ctrl.js
+++ b/app/components/dashboard/master-ctrl.js
@@ -1,5 +1,5 @@
angular.module('dashboard')
-.controller('MasterCtrl', ['$scope', '$cookieStore', 'Settings', function ($scope, $cookieStore, Settings) {
+.controller('MasterCtrl', ['$scope', '$cookieStore', 'Settings', 'Config', function ($scope, $cookieStore, Settings, Config) {
/**
* Sidebar Toggle & Cookie Control
*/
@@ -9,6 +9,8 @@ angular.module('dashboard')
return window.innerWidth;
};
+ $scope.config = Config.get();
+
$scope.$watch($scope.getWidth, function(newValue, oldValue) {
if (newValue >= mobileView) {
if (angular.isDefined($cookieStore.get('toggle'))) {
diff --git a/app/components/docker/docker.html b/app/components/docker/docker.html
new file mode 100644
index 000000000..c26680f28
--- /dev/null
+++ b/app/components/docker/docker.html
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+ Docker
+
+
+
+
+
+
+
+
+ {{ docker.Version }}
+
+
+
+
+
+
+
+
+
+
+ {{ docker.ApiVersion }}
+
+
+
+
+
+
+
+
+
+
+ {{ docker.GoVersion }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Containers |
+ {{ info.Containers }} |
+
+
+ Images |
+ {{ info.Images }} |
+
+
+ Debug |
+ {{ info.Debug }} |
+
+
+ CPUs |
+ {{ info.NCPU }} |
+
+
+ Total Memory |
+ {{ info.MemTotal|humansize }} |
+
+
+ Operating System |
+ {{ info.OperatingSystem }} |
+
+
+ Kernel Version |
+ {{ info.KernelVersion }} |
+
+
+ ID |
+ {{ info.ID }} |
+
+
+ Labels |
+ {{ info.Labels }} |
+
+
+ File Descriptors |
+ {{ info.NFd }} |
+
+
+ Goroutines |
+ {{ info.NGoroutines }} |
+
+
+ Storage Driver |
+ {{ info.Driver }} |
+
+
+ Storage Driver Status |
+
+
+ {{ val[0] }}: {{ val[1] }}
+
+ |
+
+
+ Execution Driver |
+ {{ info.ExecutionDriver }} |
+
+
+ IPv4 Forwarding |
+ {{ info.IPv4Forwarding }} |
+
+
+ Index Server Address |
+ {{ info.IndexServerAddress }} |
+
+
+ Init Path |
+ {{ info.InitPath }} |
+
+
+ Docker Root Directory |
+ {{ info.DockerRootDir }} |
+
+
+ Init SHA1 |
+ {{ info.InitSha1 }} |
+
+
+ Memory Limit |
+ {{ info.MemoryLimit }} |
+
+
+ Swap Limit |
+ {{ info.SwapLimit }} |
+
+
+
+
+
+
+
diff --git a/app/components/docker/dockerController.js b/app/components/docker/dockerController.js
new file mode 100644
index 000000000..f20233aae
--- /dev/null
+++ b/app/components/docker/dockerController.js
@@ -0,0 +1,19 @@
+angular.module('docker', [])
+.controller('DockerController', ['$scope', 'Info', 'Version', 'Settings',
+function ($scope, Info, Version, Settings) {
+
+ $scope.info = {};
+ $scope.docker = {};
+
+ $scope.order = function(sortType) {
+ $scope.sortReverse = ($scope.sortType === sortType) ? !$scope.sortReverse : false;
+ $scope.sortType = sortType;
+ };
+
+ Version.get({}, function (d) {
+ $scope.docker = d;
+ });
+ Info.get({}, function (d) {
+ $scope.info = d;
+ });
+}]);
diff --git a/app/shared/services.js b/app/shared/services.js
index 6cf38bfe5..5a16cb192 100644
--- a/app/shared/services.js
+++ b/app/shared/services.js
@@ -142,6 +142,9 @@ angular.module('dockerui.services', ['ngResource', 'ngSanitize'])
remove: {method: 'DELETE'}
});
}])
+ .factory('Config', ['$resource', 'CONFIG_ENDPOINT', function($resource, CONFIG_ENDPOINT) {
+ return $resource(CONFIG_ENDPOINT);
+ }])
.factory('Settings', ['DOCKER_ENDPOINT', 'DOCKER_PORT', 'UI_VERSION', function SettingsFactory(DOCKER_ENDPOINT, DOCKER_PORT, UI_VERSION) {
'use strict';
var url = DOCKER_ENDPOINT;
@@ -150,11 +153,11 @@ angular.module('dockerui.services', ['ngResource', 'ngSanitize'])
}
var firstLoad = (localStorage.getItem('firstLoad') || 'true') === 'true';
return {
- displayAll: false,
- endpoint: DOCKER_ENDPOINT,
- uiVersion: UI_VERSION,
- url: url,
- firstLoad: firstLoad
+ displayAll: false,
+ endpoint: DOCKER_ENDPOINT,
+ uiVersion: UI_VERSION,
+ url: url,
+ firstLoad: firstLoad
};
}])
.factory('ViewSpinner', function ViewSpinnerFactory() {
diff --git a/bower.json b/bower.json
index cf7653cf9..91fd79d08 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "uifordocker",
- "version": "1.0.2",
+ "version": "1.0.3",
"homepage": "https://github.com/kevana/ui-for-docker",
"authors": [
"Michael Crosby ",
diff --git a/dockerui.go b/dockerui.go
index 600df1cc5..fd20836b7 100644
--- a/dockerui.go
+++ b/dockerui.go
@@ -1,4 +1,4 @@
-package main // import "github.com/cloudinovasi/cloudinovasi-ui"
+package main // import "github.com/cloudinovasi/ui-for-docker"
import (
"flag"
@@ -8,6 +8,7 @@ import (
"net/http"
"net/http/httputil"
"net/url"
+ "encoding/json"
"os"
"strings"
"github.com/gorilla/csrf"
@@ -20,6 +21,7 @@ var (
endpoint = flag.String("e", "/var/run/docker.sock", "Dockerd endpoint")
addr = flag.String("p", ":9000", "Address and port to serve UI For Docker")
assets = flag.String("a", ".", "Path to the assets")
+ swarm = flag.Bool("s", false, "Swarm mode")
authKey []byte
authKeyFile = "authKey.dat"
)
@@ -28,6 +30,10 @@ type UnixHandler struct {
path string
}
+type Config struct {
+ Swarm bool `json:"swarm"`
+}
+
func (h *UnixHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
conn, err := net.Dial("unix", h.path)
if err != nil {
@@ -60,6 +66,10 @@ func copyHeader(dst, src http.Header) {
}
}
+func configurationHandler(w http.ResponseWriter, r *http.Request, c Config) {
+ json.NewEncoder(w).Encode(c)
+}
+
func createTcpHandler(e string) http.Handler {
u, err := url.Parse(e)
if err != nil {
@@ -72,7 +82,7 @@ func createUnixHandler(e string) http.Handler {
return &UnixHandler{e}
}
-func createHandler(dir string, e string) http.Handler {
+func createHandler(dir string, e string, s bool) http.Handler {
var (
mux = http.NewServeMux()
fileHandler = http.FileServer(http.Dir(dir))
@@ -110,8 +120,15 @@ func createHandler(dir string, e string) http.Handler {
csrf.Secure(false),
)
+ configuration := Config{
+ Swarm: s,
+ }
+
mux.Handle("/dockerapi/", http.StripPrefix("/dockerapi", h))
mux.Handle("/", fileHandler)
+ mux.HandleFunc("/config", func(w http.ResponseWriter, r *http.Request) {
+ configurationHandler(w, r, configuration)
+ })
return CSRF(csrfWrapper(mux))
}
@@ -125,7 +142,7 @@ func csrfWrapper(h http.Handler) http.Handler {
func main() {
flag.Parse()
- handler := createHandler(*assets, *endpoint)
+ handler := createHandler(*assets, *endpoint, *swarm)
if err := http.ListenAndServe(*addr, handler); err != nil {
log.Fatal(err)
}
diff --git a/gruntFile.js b/gruntFile.js
index 840ed3c6c..fd6c06e01 100644
--- a/gruntFile.js
+++ b/gruntFile.js
@@ -37,7 +37,7 @@ module.exports = function (grunt) {
]);
grunt.registerTask('test-watch', ['karma:watch']);
grunt.registerTask('run', ['if:binaryNotExist', 'build', 'shell:buildImage', 'shell:run']);
- grunt.registerTask('runSwarm', ['if:binaryNotExist', 'build', 'shell:buildImage', 'shell:runSwarm', 'watch:buildSwarm']);
+ grunt.registerTask('run-swarm', ['if:binaryNotExist', 'build', 'shell:buildImage', 'shell:runSwarm', 'watch:buildSwarm']);
grunt.registerTask('run-dev', ['if:binaryNotExist', 'shell:buildImage', 'shell:run', 'watch:build']);
grunt.registerTask('clear', ['clean:app']);
@@ -267,7 +267,7 @@ module.exports = function (grunt) {
command: [
'docker stop ui-for-docker',
'docker rm ui-for-docker',
- 'docker run --net=host -d --name ui-for-docker ui-for-docker -e http://10.0.7.11:4000'
+ 'docker run --privileged -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock --name ui-for-docker ui-for-docker -s'
].join(';')
},
cleanImages: {
diff --git a/index.html b/index.html
index 159c75c91..a42f292a7 100644
--- a/index.html
+++ b/index.html
@@ -52,9 +52,12 @@
-
+