Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/30/16 17:30:01 (9 years ago)
Author:
jlodewyc
Message:

#2582 Job Manager done. Start user management

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
     2var dataCollection = [];
     3//Possible task statusses
    24var taskStatus = {
    35    "Offline": "bar-off",
     
    1113}
    1214
     15
    1316function initSaveData(id, coll, name) {//initial data save
    1417    var temp = dataConversion(coll, name);
     
    1720    // console.log("#CREATION: " + id);
    1821}
     22//Saves updated info in dataCollection
    1923function saveData(id, coll, name) {
    2024    var temp = dataConversion(coll, name);
     
    2630        }
    2731    }
    28     //console.log("#SAVEDATA: " + id);
    2932    redrawGraph(id);
    3033}
     34//Returns data for line graph
     35//DISABLED FOR GANTT CHART
     36/*
    3137function getData(id) {
    3238    for (var i = 0; i < dataCollection.length; i++) {
     
    3541        }
    3642    }
    37 }
     43}*/
     44//Returns data needed for Pie chart
    3845function getDataPie(id) {
    3946    for (var i = 0; i < dataCollection.length; i++) {
     
    4350    }
    4451}
     52//Returns data needed for Gantt chart
    4553function getDataGantt(id) {
    4654    for (var i = 0; i < dataCollection.length; i++) {
     
    5058    }
    5159}
     60//Converts received data from server to data needed for the graphs
    5261function dataConversion(coll, name) {
    53     var line = null;//dataConversionLine(coll, name);
     62    //var line = dataConversionLine(coll, name);
    5463    var pie = dataConversionPie(coll);
    5564    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
    5868function dataConversionGantt(coll, nam) {
    5969    var tasks = [];
     
    93103    return [tasks, nam];
    94104}
    95 /*
     105/* DISABLED FOR GANTT CHART
    96106function dataConversionLine(coll, nam) {
    97107    var xarr = [];
     
    142152    return [data, layout];
    143153}*/
    144 
     154//Calculates data necessary for drawing  a pie chart for a single task.
    145155function dataConversionPie(coll) {
    146156    var waiting = 0;
     
    172182}
    173183
     184//Draws and redraws a graph from a single task
    174185function redrawGraph(val) {
    175186    document.getElementById("graph" + val).style.width = "100%";
     
    177188    document.getElementById("graph" + val).innerHTML = "";
    178189    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
    180192        setTimeout(function () {
    181193
     
    194206
    195207
    196         /* setTimeout(function () {
     208        /* DISABLED FOR GANTT CHART
     209        setTimeout(function () {
    197210            Plotly.newPlot('graph' + val, getData(val)[0], getData(val)[1]);
    198211        }, 100);*/
    199         // console.log("#REDRAWN LINE: " + val);
    200     } else {
     212    }
     213    else
     214    {//Redraws a pie chart
    201215        document.getElementById("legend" + val).style.display = "none";
    202216        setTimeout(function () {
    203217            Plotly.newPlot('graph' + val, getDataPie(val));
    204218        }, 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
    210225function redrawMain() {
    211226    document.getElementById("graphMain").innerHTML = "";
     
    215230    for (var i = 0; i < dataCollection.length; i++) {
    216231        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);
    218233
    219234        for (var v = 0; v < t.length; v++) {
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphHubber.js

    r13739 r13740  
    44  //  $.connection.hub.logging = true;
    55    var v = document.getElementById("userId").innerHTML;
    6     console.log(v);
    76    $.connection.hub.qs = { 'userid': v };
    87    $.connection.hub.start().done(function () {
    98        hubber.server.initConnection();
    10         // hubber.server.updateAll();
    119        redrawMain();
    1210    });
     11    //processes updates task info for each individual task
    1312    hubber.client.processData = function (id, data, name) {
    1413        var obj = JSON.parse(data);
    15        
    1614        editTaskData(id, obj);
    17         //console.log(name);
     15
    1816        saveData(id, obj.StateLog, name);
    1917        console.log("#UPDATED " + id);
    2018    }
     19    //processes updated job info
    2120    hubber.client.processJobData = function (calc, fin) {
    2221        editJobData(calc, fin);
    2322    }
     23    //Called when server is done with request
    2424    hubber.client.requestDone = function () {
    2525        if (document.getElementById("refreshtogg").checked) {
     
    3131        }
    3232    }
    33     //hubber.c
    3433})
    3534
     35//Toggles the refresh button. ON is refresh every 5 sec, OFF is no refresh
    3636function autoRefresh() {
    3737    if (document.getElementById("refreshtogg").checked)
     
    3939
    4040}
     41//Restarts an aborted, paused or failed task
    4142function restart(id) {
    4243    document.getElementById("restarterbtn" + id).disabled = true;
     
    4445    hubber.server.restartTask(id);
    4546}
     47//Writes the new job info to the page
    4648function editJobData(c, f) {
    4749    $("#jobcalculating").html("Calculating: " + c);
    4850    $("#jobfinished").html("Finished: " + f);
    4951}
    50 
     52//Writes updated task info to the page
    5153function editTaskData(id, task) {
    5254    //lastupdate
     
    6062    document.getElementById("restarter" + id).style.display = "none";
    6163    //state
    62     if (task.State == "0") {
     64    if (task.State == "0") {//OFFLINE
    6365        $("#statepar" + id).css({
    6466            'color': 'gray',
     
    6769        $("#statepar" + id).html("State: Offline");
    6870    }
    69     else if (task.State == "1") {
     71    else if (task.State == "1") {//WAITING
    7072        $("#statepar" + id).css({
    7173            'color': 'white',
     
    7476        $("#statepar" + id).html("State: Waiting");
    7577    }
    76     else if (task.State == "2") {
     78    else if (task.State == "2") {//TRANSFERRING
    7779        $("#statepar" + id).css({
    7880            'color': 'white',
     
    8284        $("#statepar" + id).html("State: Transferring");
    8385    }
    84     else if (task.State == "3") {
     86    else if (task.State == "3") {//CALCULATING
    8587        $("#statepar" + id).css({
    8688            'color': 'white',
     
    8991        $("#statepar" + id).html("State: Calculating");
    9092    }
    91     else if (task.State == "4") {
     93    else if (task.State == "4") {//PAUSED
    9294        $("#statepar" + id).css({
    9395            'color': 'white',
     
    9597        });
    9698        $("#statepar" + id).html("State: Paused");
     99        //Able to restart
    97100        document.getElementById("restarter" + id).style.display = "";
    98101        document.getElementById("restarterbtn" + id).disabled = false;
    99102        document.getElementById("restarterbtn" + id).value = "Restart task";
    100103    }
    101     else if (task.State == "5") {
     104    else if (task.State == "5") {//FINISHED
    102105        $("#statepar" + id).css({
    103106            'color': '#009900',
     
    109112        $("#lastupdpar" + id).html("Finished: " + datf.toUTCString());
    110113    }
    111     else if (task.State == "6") {
     114    else if (task.State == "6") {//ABORTED
    112115        $("#statepar" + id).css({
    113116            'color': '#e60000',
     
    116119        });
    117120        $("#statepar" + id).html("State: Aborted");
    118 
     121        //Able to restart
    119122        document.getElementById("restarter" + id).style.display = "";
    120123        document.getElementById("restarterbtn" + id).disabled = false;
    121124        document.getElementById("restarterbtn" + id).value = "Restart task";
    122125    }
    123     else if (task.State == "7") {
     126    else if (task.State == "7") {//FAILED
    124127        $("#statepar" + id).css({
    125128            'color': '#e60000',
     
    128131        });
    129132        $("#statepar" + id).html("State: Failed");
    130 
     133        //Able to restart
    131134        document.getElementById("restarter" + id).style.display = "";
    132135        document.getElementById("restarterbtn" + id).disabled = false;
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/hubber.js

    r13739 r13740  
    99        $("#progress").css("width", 0 + '%');
    1010        $('#progress').attr('aria-valuenow', 0);
     11        //Initial connection to server
    1112        hubber.server.handleMessage("Looking for connection...");
    12 
    1313    });
     14    //Processes progress update received from server
    1415    hubber.client.processMessage = function (message, value) {
    1516
     
    2223    };
    2324});
    24 
     25//Adds the current loaded job to Hive.
    2526function addtoHive() {
    2627
     
    3738    }
    3839}
     40//Toggles a tasks child distribution
    3941function toggleChild(arr, idchilds) {
    4042    console.log(arr + " toggled");
     
    4648    $('body').click();
    4749}
     50//Changes a tasks priority
    4851function changePriority(arr, prior, idprior) {
    4952    console.log(arr + " to priority " + prior);
     
    7073    document.getElementById("prior" + idprior).innerHTML += "<span class='caret'></span>";
    7174}
     75//Resets the priorities from a view
    7276function resetPrior(id) {
    7377    document.getElementById("prior" + id).className = "btn dropdown-toggle ";
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/d3-gantt-jobstatus.js

    r13733 r13740  
    33 * @version 2.1
    44
    5   * Rewritten for Hive Web Job Manager
     5  * Rewritten for Hive Web Job Manager by Jonas
    66 */
    77
     
    3333        return d.startDate + d.taskName + d.endDate;
    3434    };
    35 
     35    //Locks graph to specific timezone
     36    //3600000 = +1 hour
     37    var timeCorrector = 3600000 * (+1); //Currently: + 1
     38   
    3639    var rectTransform = function (d) {
    37         return "translate(" + x(d.startDate - 3600000) + "," + y(d.taskName) + ")";
     40        return "translate(" + x(d.startDate - timeCorrector) + "," + y(d.taskName) + ")";
    3841    };
    3942
     
    6669
    6770    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);
    6972        y = d3.scale.ordinal().domain(taskTypes).rangeRoundBands([0, height - margin.top - margin.bottom], .1);
    7073        if (new Date(timeDomainStart).toDateString() != new Date(timeDomainEnd).toDateString()) {
     
    126129       .attr("height", function (d) { return y.rangeBand(); })
    127130       .attr("width", function (d) {
    128            return (x(d.endDate - 3600000) - x(d.startDate - 3600000));
     131           return (x(d.endDate - timeCorrector) - x(d.startDate - timeCorrector));
    129132       })
    130133       .on('mouseover', tip.show)
     
    221224 .attr("height", function (d) { return y.rangeBand(); })
    222225 .attr("width", function (d) {
    223      return (x(d.endDate - 3600000) - x(d.startDate - 3600000));
     226     return (x(d.endDate - timeCorrector) - x(d.startDate - timeCorrector));
    224227 });
    225228
     
    228231 .attr("height", function (d) { return y.rangeBand(); })
    229232 .attr("width", function (d) {
    230      return (x(d.endDate - 3600000) - x(d.startDate - 3600000));
     233     return (x(d.endDate - timeCorrector) - x(d.startDate - timeCorrector));
    231234 });
    232235
Note: See TracChangeset for help on using the changeset viewer.