2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Remove jquery dependency for console demo

jquery is needless burden for this sort of application
This commit is contained in:
jjohnson2 2014-11-20 15:42:22 -05:00
parent f6b68d8efe
commit c4fcbd960e
2 changed files with 21 additions and 8 deletions

View File

@ -1,8 +1,5 @@
<html><head><title>Console demo</title>
<link rel="stylesheet" href="consoles.css" type="text/css">
<!-- <link rel="stylesheet" href="css/smoothness/jquery-ui-1.10.4.custom.min.css" type="text/css"> -->
<script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="js/term.js"></script>
<script type="text/javascript" src="js/consolewindow.js"></script>
<script type="text/javascript" src="js/consoles.js"></script>

View File

@ -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("<button id="+nodename+">"+nodename+"</button><br>");
$("#"+nodename).button().click(function( event ) {
var myrow = document.createElement('div');
myrow.innerHTML = "<button id="+nodename+">"+nodename+"</button><br>";
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);