diff --git a/confluent_web/consoles.html b/confluent_web/consoles.html index 57e5e4bb..4833c2b0 100644 --- a/confluent_web/consoles.html +++ b/confluent_web/consoles.html @@ -1,8 +1,5 @@ Console demo - - - diff --git a/confluent_web/js/consoles.js b/confluent_web/js/consoles.js index a93b4839..6eb82d7b 100644 --- a/confluent_web/js/consoles.js +++ b/confluent_web/js/consoles.js @@ -1,18 +1,34 @@ -$(document).ready(function() { +function getRequest(url, success) { + var request = new XMLHttpRequest(); + request.open('GET', url, true); + request.setRequestHeader('Accept', 'application/json'); + request.onload = function() { + if (this.status >= 200 && this.status <= 400) { + success(JSON.parse(this.responseText)); + } + }; + request.send(); +} - $.getJSON("/confluent-api/nodes/", function( data) { +document.addEventListener('DOMContentLoaded', function() { + + getRequest("/confluent-api/nodes/", function( data) { var items = []; var options = []; var nodename = ""; - $.each( data["_links"]["item"], function( key, val ) { + data["_links"]["item"].forEach( function( val, key ) { + console.log(val); if (typeof(val) == "object") { nodename = val.href; } else { nodename = val; } + console.log(nodename); nodename = nodename.replace('/', ''); - $("#nodes").append("
"); - $("#"+nodename).button().click(function( event ) { + var myrow = document.createElement('div'); + myrow.innerHTML = "
"; + document.getElementById("nodes").appendChild(myrow); + document.getElementById(nodename).addEventListener("click", function( event ) { var tname = this.id; var url = "/confluent-api/nodes/" + tname + "/console/session"; new ConsoleWindow(url, tname);