Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/wwwroot/js/Scripts/hubber.js @ 13712

Last change on this file since 13712 was 13712, checked in by jlodewyc, 9 years ago

#2582 Distribution childs and priority done. Display current jobs and start graphs

File size: 2.9 KB
Line 
1var hubber = $.connection.progressHub;
2
3$(function () {
4    $.connection.hub.logging = true;
5    $.connection.hub.start().done(function () {
6        $("#progress").css("width", 0 + '%');
7        $('#progress').attr('aria-valuenow', 0);
8        hubber.server.handleMessage("Looking for connection...");
9
10    });
11    hubber.client.processMessage = function (message, value) {
12        /* if(value > 0){
13             $("#progress").css("width", value + '%');
14             $('#progress').attr('aria-valuenow', value);
15         }
16         else {
17             var v = $('#progress').attr('aria-valuenow') + (-value);
18             $("#progress").css("width", v + '%');
19             $('#progress').attr('aria-valuenow', v);
20         }*/
21        if (value > $('#progress').attr('aria-valuenow')) {
22            $("#progress").css("width", value + '%');
23            $('#progress').attr('aria-valuenow', value);
24            $("#progress").html(value + '%');
25            $("#result").html(message);
26        }
27    };
28});
29
30function addtoHive() {
31
32    var jobname = prompt("Please enter a job name", "Job");
33    if (jobname && jobname != "" && jobname != null) {
34        hubber.server.changeName(jobname);
35        document.getElementById("fakehiveadd").style.display = "none";
36        document.getElementById("progdiv").style.display = "";
37        document.getElementById("result").style.display = "";
38        document.getElementById("realhiveadd").click();
39    }
40}
41function toggleChild(arr, idchilds) {
42    console.log(arr + " toggled");
43    hubber.server.toggleChild(arr);
44    if ($("#childs" + idchilds).css("display") == "none")
45        $("#childs" + idchilds).css("display", "");
46    else
47        $("#childs" + idchilds).css("display", "none");
48}
49function changePriority(arr, prior, idprior) {
50    console.log(arr + " to priority " + prior);
51    hubber.server.changePriority(arr, prior);
52    resetPrior(idprior);
53    switch (prior) {
54        case 0:
55            document.getElementById("prior" + idprior).className += "btn-default";
56            document.getElementById("prior" + idprior).innerHTML = "Low"
57            break;
58        case 1:
59            document.getElementById("prior" + idprior).className += "btn-info";
60            document.getElementById("prior" + idprior).innerHTML = "Normal"
61            break;
62        case 2:
63            document.getElementById("prior" + idprior).className += "btn-warning";
64            document.getElementById("prior" + idprior).innerHTML = "Urgent"
65            break;
66        case 3:
67            document.getElementById("prior" + idprior).className += "btn-danger";
68            document.getElementById("prior" + idprior).innerHTML = "Critical";
69            break;
70    }
71    document.getElementById("prior" + idprior).innerHTML += "<span class='caret'></span>";
72}
73function resetPrior(id) {
74    document.getElementById("prior" + id).className = "btn dropdown-toggle ";
75}
Note: See TracBrowser for help on using the repository browser.