cockpit/js/instance.js in cpee-1.3.209 vs cockpit/js/instance.js in cpee-1.3.211
- old
+ new
@@ -54,11 +54,16 @@
'events' + '=' + 'error,change' + '&' +
'topic' + '=' + 'handlers' + '&' +
'events' + '=' + 'change';// }}}
$(document).ready(function() {// {{{
- $("input[name=base-url]").val(location.protocol + "//" + location.host + ":" + $('body').data('defaultport'));
+ console.log(location.protocol);
+ if (location.protocol.match(/^file/)) {
+ $("input[name=base-url]").val("http://localhost:" + $('body').data('defaultport'));
+ } else {
+ $("input[name=base-url]").val(location.protocol + "//" + location.host + ":" + $('body').data('defaultport'));
+ }
$("button[name=base]").click(function(){ create_instance(null,false); });
$("button[name=instance]").click(function(){ ui_activate_tab("#tabinstance"); monitor_instance(false,false); });
$("button[name=loadtestset]").click(function(e){new CustomMenu(e).menu($('#predefinedtestsets'),function(){ load_testset(false) } ); });
$("button[name=loadtestsetfile]").click(load_testsetfile);
$("button[name=loadmodelfile]").click(load_modelfile);
@@ -76,10 +81,14 @@
$('testset',res).each(function(){
var ts = $(this).text();
$('#predefinedtestsets').append($("<div class='menuitem'></div>").text(ts));
});
var q = $.parseQuerySimple();
+ if (q.min || q.min == "") {
+ ui_toggle_vis_tab($('#instance ui-tabbar'));
+ ui_toggle_vis_tab($('#parameters ui-tabbar'));
+ }
if (q.monitor && q.load) {
$("input[name=instance-url]").val(q.monitor);
$("#predefinedtestsets div.menuitem").each(function(k,v){
if ($(v).text() == q.load) { $(v).attr('data-selected','selected'); }
});
@@ -192,11 +201,12 @@
$("#current-instance-properties").text('P');
$("#current-instance-subscriptions").attr('href',url + 'notifications/subscriptions/');
$("#current-instance-subscriptions").text('S');
$("#current-instance-callbacks").attr('href',url + 'callbacks/');
$("#current-instance-callbacks").text('C');
- history.replaceState({}, '', '?monitor='+url);
+ var q = $.parseQuerySimple();
+ history.replaceState({}, '', '?' + (q.min || q.min=="" ? "min&" : "") + 'monitor='+url);
// Change url to return to current instance when reloading (because new subscription is made)
$("input[name=votecontinue]").removeAttr('checked');
subscription_state = 'less';
@@ -595,11 +605,10 @@
});
}
});
}// }}}
function set_testset(testset,exec) {// {{{
- console.log(exec);
var url = $("#current-instance").text();
$.ajax({
type: "GET",
url: url + "/notifications/subscriptions/",
@@ -667,13 +676,14 @@
}
var files = $('#testsetfile').get(0).files;
var reader = new FileReader();
reader.onload = function(){
set_testset($.parseXML(reader.result),false);
+ document.getElementById("fuckchrome").reset();
running = false;
}
- reader.onerror = function(){ running = false; }
- reader.onabort = function(){ running = false; }
+ reader.onerror = function(){ console.log('error reading file'); running = false; }
+ reader.onabort = function(){ console.log('abort reading file'); running = false; }
reader.readAsText(files[0]);
} //}}}
function load_testsetfile() {// {{{
if (running) return;
document.getElementById('testsetfile').click();