create works
This commit is contained in:
		@@ -40,10 +40,13 @@ var Docker = function() {
 | 
			
		||||
                nodes[c.Id].author = c.Author;
 | 
			
		||||
                nodes[c.Id].os = c.Os+"/"+c.Architecture;
 | 
			
		||||
                nodes[c.Id].parent = c.Parent;
 | 
			
		||||
                nodes[c.Id].env = c.Config.Env;
 | 
			
		||||
                nodes[c.Id].env = c.Config.Env || [];
 | 
			
		||||
                nodes[c.Id].cmd = c.Config.Cmd;
 | 
			
		||||
                nodes[c.Id].entrypoint = c.Config.Entrypoint;
 | 
			
		||||
                nodes[c.Id].ports = c.Config.ExposedPorts;
 | 
			
		||||
                nodes[c.Id].ports = [];
 | 
			
		||||
                if (c.Config.ExposedPorts)
 | 
			
		||||
                    for (p in c.Config.ExposedPorts)
 | 
			
		||||
                        nodes[c.Id].ports.push(p);
 | 
			
		||||
                nodes[c.Id].volumes = c.Config.Volumes;
 | 
			
		||||
                if (c.Parent) {
 | 
			
		||||
                    if (!nodes[c.Parent]) nodes[c.Parent] = {};
 | 
			
		||||
@@ -52,6 +55,15 @@ var Docker = function() {
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        this.tags = function() {
 | 
			
		||||
            var res = [];
 | 
			
		||||
            for (n in nodes) if (nodes[n].tags) res = res.concat(nodes[n].tags);
 | 
			
		||||
            return res;
 | 
			
		||||
        }
 | 
			
		||||
        this.get = function(tag) {
 | 
			
		||||
            for (n in nodes) if (nodes[n].tags && nodes[n].tags.indexOf(tag)>-1) return nodes[n];
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        this.cleanup = function(id, instance) {
 | 
			
		||||
            if (!nodes[id]) return
 | 
			
		||||
            nodes[id].env.forEach(function(e) {
 | 
			
		||||
@@ -79,7 +91,8 @@ var Docker = function() {
 | 
			
		||||
            Restarting: {color: "lightblue", action1: "start", action2: "remove", bash: false},
 | 
			
		||||
            Paused:     {color: "grey", action1: "unpause", action2: null, bash: false},
 | 
			
		||||
            Running:    {color: "lightgreen", action1: "pause", action2: "stop", bash: true},
 | 
			
		||||
            Preview:    {color: "lightgrey"}
 | 
			
		||||
            Preview:    {color: "orangered"},
 | 
			
		||||
            Prepared:   {color: "lightgrey"}
 | 
			
		||||
        });
 | 
			
		||||
        var containers = [];
 | 
			
		||||
        var nodes = [];
 | 
			
		||||
@@ -143,7 +156,7 @@ var Docker = function() {
 | 
			
		||||
        function graphVolumesInside(n) {
 | 
			
		||||
            var res = "";
 | 
			
		||||
            if (n.volumes) n.volumes.forEach(function(v) {
 | 
			
		||||
                res += '"'+v.id+'" [label="'+v.inside+'",shape=box];\n';
 | 
			
		||||
                res += '"'+v.id+v.inside+'" [label="'+v.inside+'",shape=box];\n';
 | 
			
		||||
            });
 | 
			
		||||
            return res;
 | 
			
		||||
        }
 | 
			
		||||
@@ -159,8 +172,8 @@ var Docker = function() {
 | 
			
		||||
            var res = "";
 | 
			
		||||
            if (n.volumes) n.volumes.forEach(function(v) {
 | 
			
		||||
                if (v.host)
 | 
			
		||||
                    res += '"'+v.id+'" -> "'+v.outside+'" [label="mounted from"]\n';
 | 
			
		||||
                res += '"'+n.name+'" -> "'+v.id+'" [label="volume/'+v.rw+'"]\n';
 | 
			
		||||
                    res += '"'+v.id+v.inside+'" -> "'+v.outside+'" [label="mounted from"]\n';
 | 
			
		||||
                res += '"'+n.name+'" -> "'+v.id+v.inside+'" [label="volume/'+v.rw+'"]\n';
 | 
			
		||||
            });
 | 
			
		||||
            if (n.volumesfrom) n.volumesfrom.forEach(function(o) {
 | 
			
		||||
                res += '"'+n.name+'" -> "'+nodes[o].name+'" [label="volumes from"]\n';
 | 
			
		||||
@@ -208,7 +221,8 @@ var Docker = function() {
 | 
			
		||||
            return this.graph(this.subnet(name, nodes), nodes);
 | 
			
		||||
        }
 | 
			
		||||
        this.configuration = function(name) {
 | 
			
		||||
            var ns = this.subnet(name);
 | 
			
		||||
            var ns = name;
 | 
			
		||||
            if (typeof name == 'string') ns = this.subnet(name);
 | 
			
		||||
            var creates = [];
 | 
			
		||||
            for (n in ns) {
 | 
			
		||||
                var instance = {
 | 
			
		||||
@@ -280,6 +294,10 @@ var Docker = function() {
 | 
			
		||||
            }
 | 
			
		||||
            return res;
 | 
			
		||||
        }
 | 
			
		||||
        this.names = function(more) {
 | 
			
		||||
            if (more) return Object.keys(nodes).concat(Object.keys(more))
 | 
			
		||||
            else return Object.keys(nodes);
 | 
			
		||||
        }
 | 
			
		||||
        function setup() {
 | 
			
		||||
            delete nodes; nodes = [];
 | 
			
		||||
            containers.forEach(function(c, i) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user