diff --git a/horizon_mellanox/static/horizon_mellanox/js/horizon_mellanox.js b/horizon_mellanox/static/horizon_mellanox/js/horizon_mellanox.js index a613f64..418510a 100644 --- a/horizon_mellanox/static/horizon_mellanox/js/horizon_mellanox.js +++ b/horizon_mellanox/static/horizon_mellanox/js/horizon_mellanox.js @@ -12,25 +12,30 @@ horizon.horizon_mellanox = { }, prepareNEOPanel: function(){ var val = this._getCookie("mellanox_neo_host"); - if(val != ""){/* - // neo authentication - var xhttp = new XMLHttpRequest(); - var url = "http://" + val + "/neo/login"; + if(val != ""){ + var url = "http://" + val + "/neo/login?next=%2Fneo%2F#"; var user = this._getCookie("mellanox_neo_host_user"); var password = this._getCookie("mellanox_neo_host_password"); - var data = "username=" + user + "&password=" + password; - xhttp.open("POST", url, true); - xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - xhttp.onreadystatechange = function() { - alert("on"); - if (xhttp.readyState == 4 && xhttp.status == 200) { - alert("ready state"); - //document.getElementById("neo_iframe").src = "http://" + val + "/neo"; - } - }; - xhttp.send(data);*/ - document.getElementById("neo_iframe").src = "http://" + val + "/neo"; + var form_html = '' ; + var $frame = $('#neo_iframe'); + setTimeout( function() { + var doc = $frame[0].contentWindow.document; + var $body = $('body', doc); + $body.html(form_html); + $body.find('#username').val(user); + $body.find('#password').val(password); + $body.find('#neo_login').submit(); + }, 1 ); }else{ var msg = "
NEO hostname/ip is not set, you can set it in Configurations panel
"; document.getElementsByClassName("col-xs-12")[0].innerHTML = msg;