Debian Codegraph @

sources/visualization_interfaces/DrawGantt-SVG/multisite.html

raw
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Drawgantt Multisite NG</title>
5 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6 <style>
7 body {
8 margin: 0px;
9 }
10 .gantt {
11 left: 0px;
12 z-index: 0;
13 }
14 .spacer {
15 width: 100%;
16 }
17 #spacer_top {
18 height: 40px;
19 }
20 #spacer_bottom {
21 height: 35px;
22 }
23 .ruler {
24 position: fixed;
25 left: 0px;
26 z-index: 1;
27 }
28 #ruler_top {
29 top: 5px;
30 }
31 #ruler_bottom {
32 bottom: 5px;
33 }
34 #infobox {
35 position: absolute;
36 top: 0px;
37 left: 0px;
38 width: auto;
39 height: auto;
40 z-index: 2;
41 background: white;
42 border: 1px solid;
43 border-radius: 8px;
44 font-size: 60%;
45 }
46 #debug {
47 position: fixed;
48 background: white;
49 top: 0px;
50 right: 0px;
51 z-index: 3;
52 font-size: 70%;
53 }
54 </style>
55 <script>
56 var infobox;
57 var debug;
58 var gantts = [];
59 var url = ["https://intranet.grid5000.fr/oar/", "/drawgantt-svg/test/drawgantt-svg.php?width=" + (window.innerWidth - 50)];
60 // push the reference of the SVG object to the SVG doc
61 // object reference is used to get the SVG doc coordinates in the HTML document (see getBoundingClientRect) in the SVG js
62 // (the other option using svg.screenY - html.mozInnerScreenY is not portable)
63 function setObjectRef(id) {
64 var obj = document.getElementById(id);
65 var svg = obj.contentDocument;
66 svg.object_ref = obj;
67 }
68 function mouseMove(event) {
69 infoboxMove(event.clientX,event.clientY,"html");
70 }
71 function infoboxDisplay(array) {
72 if (infobox == null) {
73 infobox = document.getElementById("infobox");
74 }
75 for (i in array) {
76 infobox.appendChild(document.createTextNode(array[i]));
77 infobox.appendChild(document.createElement('br'));
78 }
79 infobox.style.visibility = "visible";
80 }
81 function infoboxHide() {
82 if (infobox == null) {
83 infobox = document.getElementById("infobox");
84 }
85 while (infobox.hasChildNodes()) {
86 infobox.removeChild(infobox.lastChild);
87 }
88 infobox.style.visibility = "hidden";
89 }
90 function infoboxMove(x,y,str) {
91 if (infobox == null) {
92 infobox = document.getElementById("infobox");
93 }
94 infobox.style.left = Math.min((x + 15 + window.scrollX), (window.scrollX + window.innerWidth - infobox.clientWidth)) + "px";
95 infobox.style.top = Math.min((y + 15 + window.scrollY), (window.scrollY + window.innerHeight - infobox.clientHeight)) + "px";
96 if (debug == null) {
97 var debug = document.getElementById("debug");
98 }
99 debug.innerHTML = "position: " + x + "," + y + "(" + str + ")";
100 }
101 function highlightOthers(obj, hl_element_class, bool) {
102 for (var k in gantts) {
103 if (gantts[k].contentWindow != null) {
104 gantts[k].contentWindow.highlight(obj, hl_element_class, bool);
105 }
106 }
107 }
108 function createGanttObject(id,className, url) {
109 var obj = document.createElement('object');
110 obj.id = id;
111 obj.classList.add(className);
112 obj.type = "image/svg+xml"
113 obj.data = url;
114 obj.innerHTML = url;
115 obj.addEventListener("load", function() { setObjectRef(id); }, false);
116 return obj;
117 }
118 function createGanttObjectHosts(site, cluster) {
119 var obj = createGanttObject(site + "+" + cluster, "gantt", url[0] + site + url[1] + "&display=no_ruler&resource_base=host&filter=cluster='" + cluster + "'");
120 gantts[site + "+" + cluster] = obj;
121 return obj;
122 }
123 function createGanttObjectVlans(site) {
124 var obj = createGanttObject(site + "+vlans", "gantt", url[0] + site + url[1] + "&display=no_ruler&resource_base=host&config=vlan&filter=type like 'kavlan%'");
125 gantts[site + "+vlans"] = obj;
126 return obj;
127 }
128 function createGanttObjectSubnets(site) {
129 var obj = createGanttObject(site + "+subnets", "gantt", url[0] + site + url[1] + "&display=no_ruler&resource_base=host&config=subnet&filter=type like 'subnet'");
130 gantts[site + "+subnets"] = obj;
131 return obj;
132 }
133 function createGanttObjectRuler(site, id) {
134 var obj = createGanttObject(id, "ruler", url[0] + site + url[1] + "&display=mobile_ruler_only&resource_base=host");
135 return obj;
136 }
137 function init() {
138 var obj;
139 var div = document.getElementById("gantts");
140
141 div.appendChild(createGanttObjectRuler("Rennes","ruler_top"));
142
143 div.appendChild(createGanttObjectHosts("Nancy", "graphite"));
144 div.appendChild(createGanttObjectHosts("Lyon", "hercule"));
145 div.appendChild(createGanttObjectHosts("Grenoble", "edel"));
146 div.appendChild(createGanttObjectHosts("Rennes", "parasilo"));
147 div.appendChild(createGanttObjectHosts("Rennes", "paravance"));
148 div.appendChild(createGanttObjectVlans("Rennes"));
149 div.appendChild(createGanttObjectSubnets("Rennes"));
150
151 div.appendChild(createGanttObjectRuler("Rennes","ruler_bottom"));
152 }
153 </script>
154 </head>
155 <body onmousemove="mouseMove(event)" onload="init()">
156 <div id="infobox"></div>
157 <div id="debug"></div>
158 <div id="spacer_top" class="spacer"></div>
159 <div id="gantts"> </div>
160 <div id="spacer_bottom" class="spacer"></div>
161 </body>
162 </html>