MCPcopy
hub / github.com/dockersamples/docker-swarm-visualizer / restart

Function restart

src/vis-logical/index.js:86–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86function restart(){
87 if(node){
88 node.on('mousedown',null);
89 node.on('mouseup',null);
90 }
91
92 link = svg.selectAll('.link').data(LINKS);
93 node = svg.selectAll('.service').data(NODES);
94
95 link.enter().insert('line', '.service')
96 .attr('class', 'link');
97
98 link.exit().remove();
99
100 var nodeEnter = node.enter().append('g').call(force.drag);
101
102 nodeEnter
103 .append('circle')
104 .attr('r',NODE_MIN_RADIUS);
105
106 nodeEnter.insert('g')
107 .classed('docker-image',true)
108 .html((d) => {
109 console.log(d);
110 //var image = d.image_name.split(':')[0] || [];
111 var image = d.image.split(':')[0] || [];
112 if(image.indexOf('haproxy') > -1){
113 return icons.haproxy;
114 }
115 else if(image.indexOf('results-demo') > -1){
116 return icons.angular;
117 }
118 else if(image.indexOf('voting-demo') > -1){
119 return icons.python;
120 }
121
122 var [namespace,imageName] = image.split('/');
123
124 if(!imageName){
125 imageName = namespace;
126 namespace = 'library';
127 }
128
129 if(namespace === 'tutum') return icons.tutum;
130
131 return icons[imageName] || (namespace === 'tutum' ? icons.tutum : icons.docker);
132 })
133 .select('svg')
134 .attr('width',30)
135 .attr('height',30)
136
137 var nodeEnterText = nodeEnter.append('text');
138
139 nodeEnterText
140 .append('tspan')
141 .classed('name',true)
142 .attr('dy', '.35em')
143

Callers 3

addFunction · 0.85
updateFunction · 0.85
removeFunction · 0.85

Calls 2

capitalizeFunction · 0.90
startMethod · 0.80

Tested by

no test coverage detected