Skip to content

Commit 4502f88

Browse files
committed
click on container to see more data (currently only in manager where visualizer is installed)
1 parent 7b1b92b commit 4502f88

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/data-provider.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ let physicalStructProvider = ([initialNodes, initialContainers]) => {
6666
var cloned = Object.assign({},container);
6767
let NodeID = cloned.NodeID;
6868
_.find(root,(cluster) => {
69-
var node = _.find(cluster.children,{ ID:NodeID });
69+
var node = _.find(cluster.children,{ ID:NodeID });
7070
if(!node) return;
7171
var dt = new Date(cloned.UpdatedAt);
7272
var color = stringToColor(cloned.ServiceID);
7373
let tagName = cloned.Spec.ContainerSpec.Image.split(':')[1];
7474
let dateStamp = dt.getDate()+"/"+(dt.getMonth()+1)+" "+ dt.getHours()+":"+dt.getMinutes();
7575
let startState=cloned.Status.State;
76-
let containerlink = window.location.href+ "apis/containers/"+cloned.Status.ContainerStatus.ContainerID + "/json";
76+
7777

7878

7979

@@ -86,10 +86,13 @@ let physicalStructProvider = ([initialNodes, initialContainers]) => {
8686
"<br/> state : "+startState +
8787
"</div>";
8888

89-
89+
if (node.Spec.Role=='manager') {
90+
let containerlink = window.location.href+ "apis/containers/"+cloned.Status.ContainerStatus.ContainerID + "/json";
91+
cloned.link = containerlink;
92+
}
9093
cloned.tag = imageTag;
9194
cloned.state = startState;
92-
cloned.link = containerlink;
95+
9396
node.children.push(cloned);
9497
return true;
9598
});

src/vis-physical/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,13 @@ container
122122
.attr('tag',(d) => _.kebabCase(d.tag)).html((d) => d.tag)
123123
.attr('data-state',(d) => _.kebabCase(d.state))
124124

125-
var mylink=container[0][0].__data__.link;
125+
126126
container.on('mouseenter',null);
127127
container.on('mouseleave',null);
128128
container.on('click', function(){
129-
130-
showContainer(d3.select(this)[0][0].__data__.link)
129+
if (d3.select(this)[0][0].__data__.link){
130+
showContainer(d3.select(this)[0][0].__data__.link)
131+
}
131132
});
132133

133134

0 commit comments

Comments
 (0)