Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2582 Job Manager done. Start user management

File size: 3.1 KB
Line 
1var hubber = $.connection.progressHub;
2
3$(function () {
4   // $.connection.hub.logging = true;
5    var v = document.getElementById("userId").innerHTML;
6    console.log(v);
7    $.connection.hub.qs = { 'userid': v };
8    $.connection.hub.start().done(function () {
9        $("#progress").css("width", 0 + '%');
10        $('#progress').attr('aria-valuenow', 0);
11        //Initial connection to server
12        hubber.server.handleMessage("Looking for connection...");
13    });
14    //Processes progress update received from server
15    hubber.client.processMessage = function (message, value) {
16
17        if (value > $('#progress').attr('aria-valuenow')) {
18            $("#progress").css("width", value + '%');
19            $('#progress').attr('aria-valuenow', value);
20            $("#progress").html(value + '%');
21            $("#result").html(message);
22        }
23    };
24});
25//Adds the current loaded job to Hive.
26function addtoHive() {
27
28    var jobname = document.getElementById("jname").value;
29    var resource = document.getElementById("jresource").value;
30    if (jobname && jobname != "" && jobname != null) {
31        hubber.server.changeNameResource(jobname, resource);
32        document.getElementById("fakehiveadd").style.display = "none";
33        document.getElementById("progdiv").style.display = "";
34        document.getElementById("result").style.display = "";
35        document.getElementById("realhiveadd").click();
36    } else {
37        alert("Job name not set!");
38    }
39}
40//Toggles a tasks child distribution
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    $('body').click();
49}
50//Changes a tasks priority
51function changePriority(arr, prior, idprior) {
52    console.log(arr + " to priority " + prior);
53    hubber.server.changePriority(arr, prior);
54    resetPrior(idprior);
55    switch (prior) {
56        case 0:
57            document.getElementById("prior" + idprior).className += "btn-default";
58            document.getElementById("prior" + idprior).innerHTML = "Low"
59            break;
60        case 1:
61            document.getElementById("prior" + idprior).className += "btn-info";
62            document.getElementById("prior" + idprior).innerHTML = "Normal"
63            break;
64        case 2:
65            document.getElementById("prior" + idprior).className += "btn-warning";
66            document.getElementById("prior" + idprior).innerHTML = "Urgent"
67            break;
68        case 3:
69            document.getElementById("prior" + idprior).className += "btn-danger";
70            document.getElementById("prior" + idprior).innerHTML = "Critical";
71            break;
72    }
73    document.getElementById("prior" + idprior).innerHTML += "<span class='caret'></span>";
74}
75//Resets the priorities from a view
76function resetPrior(id) {
77    document.getElementById("prior" + id).className = "btn dropdown-toggle ";
78}
Note: See TracBrowser for help on using the repository browser.