var hubber = $.connection.progressHub; $(function () { // $.connection.hub.logging = true; var v = document.getElementById("userId").innerHTML; console.log(v); $.connection.hub.qs = { 'userid': v }; $.connection.hub.start().done(function () { $("#progress").css("width", 0 + '%'); $('#progress').attr('aria-valuenow', 0); //Initial connection to server hubber.server.handleMessage("Looking for connection..."); }); //Processes progress update received from server hubber.client.processMessage = function (message, value) { if (value > $('#progress').attr('aria-valuenow')) { $("#progress").css("width", value + '%'); $('#progress').attr('aria-valuenow', value); $("#progress").html(value + '%'); $("#result").html(message); } }; }); //Adds the current loaded job to Hive. function addtoHive() { var jobname = document.getElementById("jname").value; var resource = document.getElementById("jresource").value; if (jobname && jobname != "" && jobname != null) { hubber.server.changeNameResource(jobname, resource); document.getElementById("fakehiveadd").style.display = "none"; document.getElementById("progdiv").style.display = ""; document.getElementById("result").style.display = ""; document.getElementById("realhiveadd").click(); } else { alert("Job name not set!"); } } //Toggles a tasks child distribution function toggleChild(arr, idchilds) { console.log(arr + " toggled"); hubber.server.toggleChild(arr); if ($("#childs" + idchilds).css("display") == "none") $("#childs" + idchilds).css("display", ""); else $("#childs" + idchilds).css("display", "none"); $('body').click(); } //Changes a tasks priority function changePriority(arr, prior, idprior) { console.log(arr + " to priority " + prior); hubber.server.changePriority(arr, prior); resetPrior(idprior); switch (prior) { case 0: document.getElementById("prior" + idprior).className += "btn-default"; document.getElementById("prior" + idprior).innerHTML = "Low" break; case 1: document.getElementById("prior" + idprior).className += "btn-info"; document.getElementById("prior" + idprior).innerHTML = "Normal" break; case 2: document.getElementById("prior" + idprior).className += "btn-warning"; document.getElementById("prior" + idprior).innerHTML = "Urgent" break; case 3: document.getElementById("prior" + idprior).className += "btn-danger"; document.getElementById("prior" + idprior).innerHTML = "Critical"; break; } document.getElementById("prior" + idprior).innerHTML += ""; } //Resets the priorities from a view function resetPrior(id) { document.getElementById("prior" + id).className = "btn dropdown-toggle "; }