- Timestamp:
- 03/30/16 17:30:01 (9 years ago)
- Location:
- branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js
- Files:
-
- 5 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphDataCollector.js
r13735 r13740 1 var dataCollection = []; 1 //Keeps all the data for the job. Used to communicate through SignalR 2 var dataCollection = []; 3 //Possible task statusses 2 4 var taskStatus = { 3 5 "Offline": "bar-off", … … 11 13 } 12 14 15 13 16 function initSaveData(id, coll, name) {//initial data save 14 17 var temp = dataConversion(coll, name); … … 17 20 // console.log("#CREATION: " + id); 18 21 } 22 //Saves updated info in dataCollection 19 23 function saveData(id, coll, name) { 20 24 var temp = dataConversion(coll, name); … … 26 30 } 27 31 } 28 //console.log("#SAVEDATA: " + id);29 32 redrawGraph(id); 30 33 } 34 //Returns data for line graph 35 //DISABLED FOR GANTT CHART 36 /* 31 37 function getData(id) { 32 38 for (var i = 0; i < dataCollection.length; i++) { … … 35 41 } 36 42 } 37 } 43 }*/ 44 //Returns data needed for Pie chart 38 45 function getDataPie(id) { 39 46 for (var i = 0; i < dataCollection.length; i++) { … … 43 50 } 44 51 } 52 //Returns data needed for Gantt chart 45 53 function getDataGantt(id) { 46 54 for (var i = 0; i < dataCollection.length; i++) { … … 50 58 } 51 59 } 60 //Converts received data from server to data needed for the graphs 52 61 function dataConversion(coll, name) { 53 var line = null;//dataConversionLine(coll, name);62 //var line = dataConversionLine(coll, name); 54 63 var pie = dataConversionPie(coll); 55 64 var gantt = dataConversionGantt(coll, name); 56 return [line, pie, gantt]; 57 } 65 return [null, pie, gantt]; 66 } 67 //Creates all data needed for drawing a single Gantt chart for one task 58 68 function dataConversionGantt(coll, nam) { 59 69 var tasks = []; … … 93 103 return [tasks, nam]; 94 104 } 95 /* 105 /* DISABLED FOR GANTT CHART 96 106 function dataConversionLine(coll, nam) { 97 107 var xarr = []; … … 142 152 return [data, layout]; 143 153 }*/ 144 154 //Calculates data necessary for drawing a pie chart for a single task. 145 155 function dataConversionPie(coll) { 146 156 var waiting = 0; … … 172 182 } 173 183 184 //Draws and redraws a graph from a single task 174 185 function redrawGraph(val) { 175 186 document.getElementById("graph" + val).style.width = "100%"; … … 177 188 document.getElementById("graph" + val).innerHTML = ""; 178 189 document.getElementById("graph" + val).style.marginLeft = "0px"; 179 if (document.getElementById("graphtoggle" + val).checked) { 190 if (document.getElementById("graphtoggle" + val).checked) 191 {//Redraws a Gantt chart 180 192 setTimeout(function () { 181 193 … … 194 206 195 207 196 /* setTimeout(function () { 208 /* DISABLED FOR GANTT CHART 209 setTimeout(function () { 197 210 Plotly.newPlot('graph' + val, getData(val)[0], getData(val)[1]); 198 211 }, 100);*/ 199 // console.log("#REDRAWN LINE: " + val); 200 } else { 212 } 213 else 214 {//Redraws a pie chart 201 215 document.getElementById("legend" + val).style.display = "none"; 202 216 setTimeout(function () { 203 217 Plotly.newPlot('graph' + val, getDataPie(val)); 204 218 }, 100); 205 //console.log("#REDRAWN PIE: " + val); 206 } 207 208 209 } 219 } 220 221 222 } 223 //Draws and redraws the main Gantt chart. Taking info from the single task charts 224 //And combining these into one big chart 210 225 function redrawMain() { 211 226 document.getElementById("graphMain").innerHTML = ""; … … 215 230 for (var i = 0; i < dataCollection.length; i++) { 216 231 var t = dataCollection[i][3][0].slice(); 217 var name = t[0].taskName.substring(0, 5) + " | " + i + ":";232 var name = t[0].taskName.substring(0, 5) + " | " + (i+1); 218 233 219 234 for (var v = 0; v < t.length; v++) { -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphHubber.js
r13739 r13740 4 4 // $.connection.hub.logging = true; 5 5 var v = document.getElementById("userId").innerHTML; 6 console.log(v);7 6 $.connection.hub.qs = { 'userid': v }; 8 7 $.connection.hub.start().done(function () { 9 8 hubber.server.initConnection(); 10 // hubber.server.updateAll();11 9 redrawMain(); 12 10 }); 11 //processes updates task info for each individual task 13 12 hubber.client.processData = function (id, data, name) { 14 13 var obj = JSON.parse(data); 15 16 14 editTaskData(id, obj); 17 //console.log(name); 15 18 16 saveData(id, obj.StateLog, name); 19 17 console.log("#UPDATED " + id); 20 18 } 19 //processes updated job info 21 20 hubber.client.processJobData = function (calc, fin) { 22 21 editJobData(calc, fin); 23 22 } 23 //Called when server is done with request 24 24 hubber.client.requestDone = function () { 25 25 if (document.getElementById("refreshtogg").checked) { … … 31 31 } 32 32 } 33 //hubber.c34 33 }) 35 34 35 //Toggles the refresh button. ON is refresh every 5 sec, OFF is no refresh 36 36 function autoRefresh() { 37 37 if (document.getElementById("refreshtogg").checked) … … 39 39 40 40 } 41 //Restarts an aborted, paused or failed task 41 42 function restart(id) { 42 43 document.getElementById("restarterbtn" + id).disabled = true; … … 44 45 hubber.server.restartTask(id); 45 46 } 47 //Writes the new job info to the page 46 48 function editJobData(c, f) { 47 49 $("#jobcalculating").html("Calculating: " + c); 48 50 $("#jobfinished").html("Finished: " + f); 49 51 } 50 52 //Writes updated task info to the page 51 53 function editTaskData(id, task) { 52 54 //lastupdate … … 60 62 document.getElementById("restarter" + id).style.display = "none"; 61 63 //state 62 if (task.State == "0") { 64 if (task.State == "0") {//OFFLINE 63 65 $("#statepar" + id).css({ 64 66 'color': 'gray', … … 67 69 $("#statepar" + id).html("State: Offline"); 68 70 } 69 else if (task.State == "1") { 71 else if (task.State == "1") {//WAITING 70 72 $("#statepar" + id).css({ 71 73 'color': 'white', … … 74 76 $("#statepar" + id).html("State: Waiting"); 75 77 } 76 else if (task.State == "2") { 78 else if (task.State == "2") {//TRANSFERRING 77 79 $("#statepar" + id).css({ 78 80 'color': 'white', … … 82 84 $("#statepar" + id).html("State: Transferring"); 83 85 } 84 else if (task.State == "3") { 86 else if (task.State == "3") {//CALCULATING 85 87 $("#statepar" + id).css({ 86 88 'color': 'white', … … 89 91 $("#statepar" + id).html("State: Calculating"); 90 92 } 91 else if (task.State == "4") { 93 else if (task.State == "4") {//PAUSED 92 94 $("#statepar" + id).css({ 93 95 'color': 'white', … … 95 97 }); 96 98 $("#statepar" + id).html("State: Paused"); 99 //Able to restart 97 100 document.getElementById("restarter" + id).style.display = ""; 98 101 document.getElementById("restarterbtn" + id).disabled = false; 99 102 document.getElementById("restarterbtn" + id).value = "Restart task"; 100 103 } 101 else if (task.State == "5") { 104 else if (task.State == "5") {//FINISHED 102 105 $("#statepar" + id).css({ 103 106 'color': '#009900', … … 109 112 $("#lastupdpar" + id).html("Finished: " + datf.toUTCString()); 110 113 } 111 else if (task.State == "6") { 114 else if (task.State == "6") {//ABORTED 112 115 $("#statepar" + id).css({ 113 116 'color': '#e60000', … … 116 119 }); 117 120 $("#statepar" + id).html("State: Aborted"); 118 121 //Able to restart 119 122 document.getElementById("restarter" + id).style.display = ""; 120 123 document.getElementById("restarterbtn" + id).disabled = false; 121 124 document.getElementById("restarterbtn" + id).value = "Restart task"; 122 125 } 123 else if (task.State == "7") { 126 else if (task.State == "7") {//FAILED 124 127 $("#statepar" + id).css({ 125 128 'color': '#e60000', … … 128 131 }); 129 132 $("#statepar" + id).html("State: Failed"); 130 133 //Able to restart 131 134 document.getElementById("restarter" + id).style.display = ""; 132 135 document.getElementById("restarterbtn" + id).disabled = false; -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/hubber.js
r13739 r13740 9 9 $("#progress").css("width", 0 + '%'); 10 10 $('#progress').attr('aria-valuenow', 0); 11 //Initial connection to server 11 12 hubber.server.handleMessage("Looking for connection..."); 12 13 13 }); 14 //Processes progress update received from server 14 15 hubber.client.processMessage = function (message, value) { 15 16 … … 22 23 }; 23 24 }); 24 25 //Adds the current loaded job to Hive. 25 26 function addtoHive() { 26 27 … … 37 38 } 38 39 } 40 //Toggles a tasks child distribution 39 41 function toggleChild(arr, idchilds) { 40 42 console.log(arr + " toggled"); … … 46 48 $('body').click(); 47 49 } 50 //Changes a tasks priority 48 51 function changePriority(arr, prior, idprior) { 49 52 console.log(arr + " to priority " + prior); … … 70 73 document.getElementById("prior" + idprior).innerHTML += "<span class='caret'></span>"; 71 74 } 75 //Resets the priorities from a view 72 76 function resetPrior(id) { 73 77 document.getElementById("prior" + id).className = "btn dropdown-toggle "; -
branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/d3-gantt-jobstatus.js
r13733 r13740 3 3 * @version 2.1 4 4 5 * Rewritten for Hive Web Job Manager 5 * Rewritten for Hive Web Job Manager by Jonas 6 6 */ 7 7 … … 33 33 return d.startDate + d.taskName + d.endDate; 34 34 }; 35 35 //Locks graph to specific timezone 36 //3600000 = +1 hour 37 var timeCorrector = 3600000 * (+1); //Currently: + 1 38 36 39 var rectTransform = function (d) { 37 return "translate(" + x(d.startDate - 3600000) + "," + y(d.taskName) + ")";40 return "translate(" + x(d.startDate - timeCorrector) + "," + y(d.taskName) + ")"; 38 41 }; 39 42 … … 66 69 67 70 var initAxis = function () { 68 x = d3.time.scale().domain([timeDomainStart - 3600000, timeDomainEnd - 3600000]).range([0, width]).clamp(true);71 x = d3.time.scale().domain([timeDomainStart - timeCorrector, timeDomainEnd - timeCorrector]).range([0, width]).clamp(true); 69 72 y = d3.scale.ordinal().domain(taskTypes).rangeRoundBands([0, height - margin.top - margin.bottom], .1); 70 73 if (new Date(timeDomainStart).toDateString() != new Date(timeDomainEnd).toDateString()) { … … 126 129 .attr("height", function (d) { return y.rangeBand(); }) 127 130 .attr("width", function (d) { 128 return (x(d.endDate - 3600000) - x(d.startDate - 3600000));131 return (x(d.endDate - timeCorrector) - x(d.startDate - timeCorrector)); 129 132 }) 130 133 .on('mouseover', tip.show) … … 221 224 .attr("height", function (d) { return y.rangeBand(); }) 222 225 .attr("width", function (d) { 223 return (x(d.endDate - 3600000) - x(d.startDate - 3600000));226 return (x(d.endDate - timeCorrector) - x(d.startDate - timeCorrector)); 224 227 }); 225 228 … … 228 231 .attr("height", function (d) { return y.rangeBand(); }) 229 232 .attr("width", function (d) { 230 return (x(d.endDate - 3600000) - x(d.startDate - 3600000));233 return (x(d.endDate - timeCorrector) - x(d.startDate - timeCorrector)); 231 234 }); 232 235
Note: See TracChangeset
for help on using the changeset viewer.