mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-09 22:51:22 +00:00
Style improvements, moved connection-related JavaScript code to own file.
This commit is contained in:
32
guacamole/src/main/webapp/scripts/connections.js
Normal file
32
guacamole/src/main/webapp/scripts/connections.js
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
function Config(protocol, id) {
|
||||
this.protocol = protocol;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
function getConfigList() {
|
||||
|
||||
// Get config list
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "configs", false);
|
||||
xhr.send(null);
|
||||
|
||||
// If fail, throw error
|
||||
if (xhr.status != 200)
|
||||
throw new Error(xhr.statusText);
|
||||
|
||||
// Otherwise, get list
|
||||
var configs = new Array();
|
||||
|
||||
var configElements = xhr.responseXML.getElementsByTagName("config");
|
||||
for (var i=0; i<configElements.length; i++) {
|
||||
configs.push(new Config(
|
||||
configElements[i].getAttribute("protocol"),
|
||||
configElements[i].getAttribute("id")
|
||||
));
|
||||
}
|
||||
|
||||
return configs;
|
||||
|
||||
}
|
Reference in New Issue
Block a user