moving the shell files out to where they belong
[plstackapi.git] / planetstack / core / static / shell / opencloud.js
1 var opencloud_data = [];
2 var opencloud_data_received = false;
3
4 function 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
27 function Slices() {
28     this.listAll = function() { return opencloud_data["slices"] }
29     this.__str__ = function() { return '["listAll"]'; }
30 }
31
32 function OpenCloud() {
33     this.slices = new Slices()
34     this.__str__ = function() { return '["slices"]'; }
35 };