Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/Graphs/GraphHubber.js @ 13714

Last change on this file since 13714 was 13714, checked in by jlodewyc, 8 years ago

#2582 Implement graphs(Pie and line per task) + live job overview with SignalR

File size: 2.4 KB
Line 
1var hubber = $.connection.jobUpdaterHub;
2
3$(function () {
4    //$.connection.hub.logging = true;
5    $.connection.hub.start().done(function () {
6        hubber.server.initConnection();
7        hubber.server.updateAll();
8       
9    });
10    hubber.client.processData = function (id, data) {
11        var obj = JSON.parse(data);
12        editTaskData(id, obj);
13        saveData(id, obj.StateLog);
14    }
15    hubber.client.requestDone = function(){
16        setTimeout(function () {
17            hubber.server.updateAll();
18        }, 5000);
19    }
20    //hubber.c
21})
22
23function editTaskData(id, task) {
24    console.log(task);
25    //lastupdate
26    var dat = new Date(task.LastHeartbeat);
27    $("#lastupdpar" + id).html("Last update: " + dat.toUTCString());
28    //state
29    if (task.State == "1") {
30        $("#statepar" + id).css({
31            'color': 'white',
32            'font-weight': 'normal'
33        });
34        $("#statepar" + id).html("State: Waiting");
35    }
36    else if (task.State == "2") {
37        $("#statepar" + id).css({
38            'color': 'white',
39            'font-weight': 'normal'
40        });
41        $("#statepar" + id).html("State: Transferring");
42    }
43    else if (task.State == "3") {
44        $("#statepar" + id).css({
45            'color': 'white',
46            'font-weight': 'normal'
47        });
48        $("#statepar" + id).html("State: Calculating");
49    }
50    else if (task.State == "5") {
51        $("#statepar" + id).css({
52            'color': '#009900',
53            'font-weight': '900'
54        });
55        $("#statepar" + id).html("State: Finished");
56        console.log(task.DateFinished);
57        var datf = new Date(task.StateLog[task.StateLog.length -1].DateTime);
58        $("#lastupdpar" + id).html("Finished: " + datf.toUTCString());
59    }
60    else if (task.State == "7") {
61        $("#statepar" + id).css({
62            'color': '#df2020',
63            'font-weight': '900'
64        });
65        $("#statepar" + id).html("State: Failed");
66    }
67   
68    //execution time
69    $("#executionpar" + id).html(task.ExecutionTime + " executed");
70    //state changes
71    $("#statechangespar" + id).html("Statelogs: "+task.StateLog.length);
72    //graph title
73    var dat1 = new Date(task.StateLog[0].DateTime);
74    var dat2 = new Date(task.StateLog[task.StateLog.length - 1].DateTime);
75    $("#graphtitle" + id).html(
76        "From " + dat1.toUTCString() +
77        "<br/> to " + dat2.toUTCString()
78        );
79}
Note: See TracBrowser for help on using the repository browser.