Project

General

Profile

Download (19.9 KB) Statistics
| Branch: | Revision:
1
<!doctype html>
2
<html>
3
  <head>
4
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
5
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
7
    <title>Stabile</title>
8
      <link rel="stylesheet" href="/stabile/static/css/style.css" />
9
      <link rel="stylesheet" href="/stabile/static/css/plupload.queue.css" />
10

    
11
      <script type="text/javascript">
12
      var dojoConfig = {
13
          async:1,
14
          packages: [{
15
            name: 'fileTree',
16
            location: '/stabile/static/js/fileTree'
17
          },{
18
            name: 'steam2',
19
            location: '/stabile/static/js/steam2'
20
          },{
21
            name: 'stabile',
22
            location: '/stabile/static/js/stabile'
23
          },{
24
            name: 'evd',
25
            location: '/stabile/static/js/evd'
26
          },{
27
            name: 'java',
28
            location: '/stabile/static/js/java'
29
          },{
30
            name: 'ssh',
31
            location: '/stabile/static/js/ssh'
32
          },{
33
            name: 'vnc',
34
            location: '/stabile/static/js/vnc'
35
          },{
36
            name: 'rdp',
37
            location: '/stabile/static/js/rdp'
38
          },{
39
            name: 'helpers',
40
            location: '/stabile/static/js/helpers'
41
          },
42
          {
43
            name: 'plupload',
44
            location: '/stabile/static/js/plupload'
45
          }
46
      ]};
47
    </script>
48
      <!-- script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script -->
49
      <script type="text/javascript" src="/stabile/static/js/jquery/1.10.2/jquery.min.js"></script>
50
      <script type="text/javascript" src="/stabile/static/js/toastr.js"></script>
51
      <script type="text/javascript" src="/stabile/static/js/js.cookie.min.js"></script>
52
      <script src="/stabile/static/js/apexcharts-3.22.1/apexcharts.min.js"></script>
53
      <!-- script src="https://cdn.jsdelivr.net/npm/apexcharts"></script -->
54
      <!-- script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.5/dojo/dojo.js"></script -->
55
      <script src="/stabile/static/js/dojo/1.7.12/dojo/dojo.js"></script>
56
      <link rel="icon" id="icon" href="/stabile/static/img/logo-icon.png" sizes="192x192" />
57
      <!-- link rel="icon" href="/stabile/static/img/logo-icon-32.png" sizes="32x32" / -->
58

    
59
  </head>
60

    
61
  <body class="tundra" onresize="home.bodyResize();">
62
      <div id="toaster" style="font-size: 14px;"></div>
63
      <div class="modal-body">
64
          <ul id="steamtabs" class="nav nav-tabs">
65
              <span class="navbar-brand navbar-right" style="white-space: nowrap; margin-right:-10px; margin-top: -12px;">
66
                  <span class="glyphicon glyphicon-alert" aria-hidden="true" style="font-size:15px; vertical-align:top; margin-top:7px; margin-left:10px; margin-right:10px; color:#3c3c3c; display:none; cursor:pointer;" title="alerts" id="toasthistory" onclick="IRIGO.toasthistory();"></span>
67
                  <span id="engines_span" style="display:none; margin-right:12px">
68
                      <span class="glyphicon glyphicon-cloud" aria-hidden="true" style="font-size:15px; vertical-align:top; margin-top:9px; margin-left:10px; color:#3c3c3c;" title=""></span>
69
                      <span id="engines"></span>
70
                  </span>
71
                  <span class="glyphicon glyphicon-user" aria-hidden="true" style="font-size:15px; vertical-align:top; margin-top:7px; margin-left:10px; color:#3c3c3c;" title=""></span>
72
                  <span id="account" style="display:none;"></span>
73
                  <span style="margin-left:14px;" class="logo"><a href="https://www.origo.io"><img alt="Origo" src="static/img/logo-icon.png" style="height:28px;"></a></span>
74
              </span>
75
              <li role="presentation" id="hometab" class="active" title="Click to manage your servers and stacks">
76
                  <a data-toggle="tab" href="#homecontent" id="hometab_a" onclick="fixInfoWidth();">
77
                      Dashboard
78
                  </a>
79
              </li>
80
              <li role="presentation" id="serverstab" title="Click to manage the servers that run your apps"><a data-toggle="tab" href="#serverscontent" onclick="">Servers</a></li>
81
              <li role="presentation" id="imagestab" title="Click to manage the images your servers run off"><a data-toggle="tab" href="#imagescontent" onclick="">Images</a></li>
82
              <li role="presentation" id="networkstab" title="Click to manage the connections your servers connect to the network  through"><a data-toggle="tab" href="#networkscontent" onclick="">Network</a></li>
83
              <li role="presentation" id="userstab" title="Click to manage users on this engine" style="display:none"><a data-toggle="tab" href="#userscontent" onclick="">Users</a></li>
84
              <li role="presentation" id="nodestab" title="Click to manage the nodes that your servers run on" style="display:none"><a data-toggle="tab" href="#nodescontent" onclick="">Nodes</a></li>
85
          </ul>
86

    
87
          <div id="tabs-content" class="tab-content" style="margin:0; background-color:white; border-left: 1px solid #ddd;
88
    border-right: 1px solid #ddd; min-height: 450px; height:80vh;">
89
              <div id="homecontent" class="tab-pane in active grid-tab">
90
              </div>
91
              <div id="serverscontent" class="tab-pane grid-tab">
92
              </div>
93
              <div id="imagescontent" class="tab-pane grid-tab">
94
              </div>
95
              <div id="networkscontent" class="tab-pane grid-tab">
96
              </div>
97
              <div id="userscontent" class="tab-pane grid-tab">
98
              </div>
99
              <div id="nodescontent" class="tab-pane grid-tab">
100
              </div>
101
          </div>
102

    
103
          <div class="panel-group" role="tablist" style="margin-botton: 0;">
104
              <div class="panel panel-default" id="activityPanel" style="border-radius:0;">
105
                  <div class="panel-heading" role="tab" id="activityHeading1">
106
                      <h4 class="panel-title" id="-collapsible-list-group-">
107
                          <a class="collapsed" data-toggle="collapse" href="#activity-collapse" aria-expanded="false" aria-controls="collapseListGroup1">
108
                              Activity log
109
                          </a>
110
                          <a class="anchorjs-link" href="#-collapsible-list-group-"><span class="anchorjs-icon"></span></a>
111
                      </h4>
112
                  </div>
113
                  <div id="activity-collapse" class="panel-collapse collapse" role="tabpanel" aria-expanded="false" style="height: 0px;">
114
                      <pre style="height:140px; overflow-y:auto; overflow-x:hidden; padding:6px; margin:0; border-radius: 0; background-color: white; border-left:0; border-right:0;" class="small" id="activity-panel">
115
                      </pre>
116
                      <div class="panel-footer" style="padding:4px;"><button class="btn btn-success btn-sm" id="refresh_activity_button">Refresh</button> <button class="btn btn-danger btn-sm" id="clear_activity_button" style="display:none">Clear</button></div>
117
                  </div>
118
              </div>
119
          </div>
120
          <div class="attribution pull-right">Powered by <a href="https://www.stabile.io"><img src="https://www.stabile.io/images/stabile-logo.png" style="height:32px;" alt="Stabile"></a></div>
121
      </div>
122

    
123
<script type="text/javascript">
124
    require([
125
              "dojo/domReady!",
126
              'dojo/io/script',
127
              'dojo/ready',
128
              'dojo/parser',
129
              'dojo/cookie',
130
              'dojo/dom',
131
              'dojo/hash',
132
              'dojo/topic',
133
              'dojo/require',
134
              'dijit/form/Select',
135
              'dojox/widget/Toaster',
136
              'java/applet',
137
              'stabile/ui_update',
138
              'steam2/user',
139
              '/stabile/static/docs/embed.js',
140

    
141
              'dojo/_base/declare',
142
              'dijit/layout/TabContainer',
143
              'dijit/layout/ContentPane',
144

    
145
              'stabile/home',
146
              'stabile/servers',
147
              'stabile/images',
148
              'stabile/networks',
149
              'stabile/users',
150
              'stabile/nodes',
151

    
152
              'stabile/ClearTextBox',
153
              'stabile/home',
154
              '/stabile/static/js/plupload/moxie.js',
155
              'steam2/xhrDecorator',
156

    
157
              'dojo/aspect',
158
              'dojo/on',
159
              'dojo/Evented',
160
              'dojo/_base/connect'
161

    
162
          ], function(
163
                  domReady,
164
                  ioScript,
165
                  ready,
166
                  parser,
167
                  cookie,
168
                  dom,
169
                  hash,
170
                  topic,
171
                  require,
172
                  Select,
173
                  Toaster,
174
                  applet,
175
                  ui_update,
176
                  user,
177
                  embed,
178
                  declare,
179
                  TabContainer,
180
                  ContentPane
181
          ) {
182
              ready(function(){
183

    
184
                  dojo.connect(window, 'onkeypress', function(evt) {
185
                      key = evt.keyCode;
186
                      if (key == dojo.keys.ESCAPE) {
187
                          console.debug("Escape trapped !!");
188
                          dojo.stopEvent(evt);
189
                      } else if (key == dojo.keys.BACKSPACE) {
190
                          if (evt.target.nodeName != "INPUT" && evt.target.nodeName != "TEXTAREA") {
191
                              dojo.stopEvent(evt);
192
                              console.debug("Backspace trapped !!", evt);
193
                          }
194
                      }
195
                  });
196

    
197
                  IRIGO.toasthistory = function() {
198
                      if (IRIGO.alerts.length>0) {
199
                          var messages = IRIGO.alerts.map(function (element) {
200
                              return element.time.toLocaleTimeString() + " : " + element.message
201
                          });
202
                          var message = "<hr>" + messages.join("<hr>\n");
203
                          toastr.options.timeOut = 3000;
204
                          toastr.options.preventDuplicates = true;
205
                          toastr.options.progressBar = false;
206
                          toastr.alert(message, 'Alert history <a onclick="IRIGO.toastclear();" class="pull-right" style="font-weight: 400;">clear</a>');
207
                      }
208
                  }
209

    
210
                  IRIGO.toastclear = function() {
211
                      IRIGO.alerts = [];
212
                      toastr.remove();
213
                  //    toastr.clear();
214
                      $("#toasthistory").hide();
215
                  }
216

    
217
                  IRIGO.toast = function(message) {
218
                      IRIGO.toaster([{
219
                          message: message,
220
                          type: "message",
221
                          priority: "success",
222
                          duration: 3000
223
                      }]);
224
                  }
225

    
226
                  IRIGO.toaster = function(toast, nohistory) {
227
                      var priority = toast.priority || 'info'; // success
228
                      toastr.options.timeOut = toast.duration || 3000;
229
                      toastr.options.preventDuplicates = true;
230
                      toastr.options.progressBar = true;
231
                      toastr.options.closeButton = false;
232
                      var message = toast[0].message;
233
                      if (toastr[priority]) {
234
                          toastr[priority](message);
235
                      } else {
236
                          toastr.info(message);
237
                      }
238
                      if (!nohistory) {
239
                          IRIGO.alerts.unshift({"message": message, "time": new Date()});
240
                          if (IRIGO.alerts.length>12) IRIGO.alerts.pop();
241
                          $("#toasthistory").show();
242
                      }
243
                  }
244

    
245
                  dojo.subscribe('message', function(obj){
246
                     if (obj.message) IRIGO.toaster([{message: obj.message}]);
247
                  });
248

    
249
                  homepane = new ContentPane({id: 'homepane', title: 'Dashboard', href: "static/html/home.html", style:"min-height: 450px; height:80vh;",
250
                      onLoad: function(){home.init();}
251
                  });
252
                  serverspane = new ContentPane({id: 'serverspane', title: 'Servers', href: "static/html/servers.html", style:"height:80vh;",
253
                      onLoad: function(){servers.init();}
254
                  });
255
                  imagespane = new ContentPane({id: 'imagespane', title: 'Images', href: "static/html/images.html", style:"height:80vh;",
256
                      onLoad: function(){images.init();}
257
                  });
258
                  networkspane = new ContentPane({id: 'networkspane', Networks: 'Servers', href: "static/html/networks.html", style:"height:80vh;",
259
                      onLoad: function(){networks.init();}
260
                  });
261

    
262
                  $('#homecontent').empty().append(homepane.domNode);
263
                  homepane.startup();
264
                  $('#serverscontent').empty().append(serverspane.domNode);
265
                  serverspane.startup();
266
                  $('#imagescontent').empty().append(imagespane.domNode);
267
                  imagespane.startup();
268
                  $('#networkscontent').empty().append(networkspane.domNode);
269
                  networkspane.startup();
270

    
271
                  $('#serverstab').on('shown.bs.tab', function(e){
272
                      servers.grid.handleSelectTab();
273
                      if (!user.is_readonly) $("#serversNewButton").show();
274
                  });
275
                  $('#imagestab').on('shown.bs.tab', function(e){
276
                      images.grid.handleSelectTab();
277
                      if (!user.is_readonly) {
278
                          $("#imagesNewButton").show();
279
                          $("#imagesUploadButton").show();
280
                      };
281
                      images.updateMissingBackups();
282
                  });
283
                  $('#networkstab').on('shown.bs.tab', function(e){
284
                      networks.grid.handleSelectTab();
285
                      if (!user.is_readonly) {
286
                          $("#networksNewButton").show();
287
                      }
288
                  });
289
                  $('#hometab').on('shown.bs.tab', function(e){
290
                      if (home.grid.updatePending) {
291
                          home.grid.refresh();
292
                          home.grid.updatePending = false;
293
                      }
294
                  });
295

    
296
                  if(user.is_admin) {
297
                      nodespane = new ContentPane({id: 'nodespane', title: 'Nodes', href: "static/html/nodes.html", style:"height:80vh;",
298
                          onLoad: function(){nodes.init();}
299
                      });
300
                      $('#nodescontent').empty().append(nodespane.domNode);
301
                      nodespane.startup();
302
                      $('#nodestab').on('shown.bs.tab', function(e){
303
                        nodes.grid.handleSelectTab();
304
                      });
305

    
306
                      userspane = new ContentPane({id: 'userspane', title: 'Users', href: "static/html/users.html", style:"height:80vh;",
307
                          onLoad: function(){users.init();}
308
                      });
309
                      $('#userscontent').empty().append(userspane.domNode);
310
                      userspane.startup();
311
                      $('#userstab').on('shown.bs.tab', function(e){
312
                          users.grid.handleSelectTab();
313
                      });
314

    
315
                  }
316

    
317
                  function getActivity() {
318
                      $('#activity-panel').load("/stabile/cgi/nodes.cgi?action=listlog", function(){
319
                        setTimeout(function(){
320
                          $('#activity-panel').scrollTop($('#activity-panel')[0].scrollHeight);
321
                        }, 200);
322
                      })
323
                  }
324
                  function clearActivity() {
325
                      $.get("/stabile/cgi/nodes.cgi?action=clearlog", function() {
326
                          $('#activity-panel').text("--");
327
                      });
328
                  }
329
                  $('#activity-collapse').on('show.bs.collapse', function () {
330
                      getActivity();
331
                  });
332
                  $('#activity-collapse').on('shown.bs.collapse', function () {
333
                      $(".border_container_south").css("bottom","270px");
334
                      window.scrollTo(0,document.body.scrollHeight);
335
                  });
336
                  $('#activity-collapse').on('hide.bs.collapse', function () {
337
                      $(".border_container_south").css("bottom","90px");
338
                  });
339
                  $('#refresh_activity_button').on('click', function () {
340
                      getActivity();
341
                  });
342
                  $('#clear_activity_button').on('click', function () {
343
                      clearActivity();
344
                  });
345
                  $(document).on('click', function(evt) { // Hidi Dojo dialogs when clicking outside
346
                      if (evt.target.className.indexOf("dijitDialogUnderlay")!=-1) {
347
                          $.each($(".dijitDialog"), function( index, value ) {
348
                              dijit.byId(value.id).hide();
349
                          });
350
                      }
351
                  });
352

    
353
                  $('#hometab').on('shown.bs.tab', function (e) {location="#home";});
354
                  $('#serverstab').on('shown.bs.tab', function (e) {location="#servers";});
355
                  $('#imagestab').on('shown.bs.tab', function (e) {location="#images";});
356
                  $('#networkstab').on('shown.bs.tab', function (e) {location="#networks";});
357
                  if ($('#nodestab')) $('#nodestab').on('shown.bs.tab', function (e) {location="#nodes";});
358
                  if ($('#userstab')) $('#userstab').on('shown.bs.tab', function (e) {location="#users";});
359

    
360
                  $('a[data-toggle=tab]').on('click', function () {
361
                    console.log($(this)[0].hash.substring(1));
362
                    if ($(this)[0].hash.substring(1) == 'homecontent') {
363
                        console.log("resizing");
364
                        if (typeof homepane !== 'undefined') setTimeout(function() { home.bodyResize(); homepane.resize();}, 100);
365
                    }
366
                  });
367
              });
368
          });
369

    
370
          $(document).ready(function() {
371
              function hashChange() {
372
                if ($('#steamtabs .active')[0] && $('#steamtabs .active')[0].id != location.hash.substring(1) + 'tab') {
373
                    // console.log("switching tab -> ",'#steamtabs a[href="#' + location.hash.substring(1) + 'content"]', $('#steamtabs .active')[0].id + " != " + location.hash.substring(1));
374
                    if (!location.hash.substring(1)) location = "#home";
375
                    $('#steamtabs a[href="#' + location.hash.substring(1) + 'content"]').tab('show');
376
                    if (typeof homepane !== 'undefined' && location.hash.substring(1) == 'home') homepane.resize();
377
                } else {
378
                    // console.log("not switching tab", $('#steamtabs .active')[0].id + " == " +  location.hash.substring(1));
379
                }
380
              }
381
              $(window).bind('hashchange', hashChange);
382
              hashChange();
383
          });
384

    
385
          // For some reason dijit_layout_BorderContainer_0 get's reset to width 0 sometimes, this ugly hack fixes it
386
          function fixInfoWidth() {
387
              if ($("#dijit_layout_BorderContainer_0").width() == 0)
388
                  $("#dijit_layout_BorderContainer_0").css("width","");
389
          }
390
      </script>
391
      <!-- script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
392
      <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script -->
393
      <script type="text/javascript" src="/stabile/static/js/jqueryui/1.8.23/jquery-ui.min.js"></script>
394
      <script type="text/javascript" src="/stabile/static/js/bootstrap/3.3.4/js/bootstrap.min.js"></script>
395
  </body>
396
</html>
(5-5/5)