blob: 52c9e5cb680deae7db96150e5c57e5a3e43f13d2 [file] [log] [blame]
Scott Bakerbf1610d2014-06-18 18:22:03 -07001var opencloud_data = [];
2var opencloud_data_received = false;
3
4function updateOpenCloud(onLoaded) {
5 $.ajax({url: "/admin/shelldata",
6 dataType: "json",
7 type: "GET",
8 success: function(data) {
9 opencloud_data = data;
10 if (!opencloud_data_received) {
11 opencloud_data_received = true;
12 if (onLoaded!=null) {
13 onLoaded();
14 }
15 }
16 // do this again in 30 seconds
17 setTimeout(function() {updateOpenCloud(onLoaded)}, 10000);
18 },
19 error: function() {
20 console.log("something went wrong. trying again");
21 // do this again in 30 seconds
22 setTimeout(function() {updateOpenCloud(onLoaded)}, 10000);
23 }
24 });
25}
26
27function Slices() {
28 this.listAll = function() { return opencloud_data["slices"] }
29 this.__str__ = function() { return '["listAll"]'; }
30}
31
32function OpenCloud() {
33 this.slices = new Slices()
34 this.__str__ = function() { return '["slices"]'; }
35};