Project

General

Profile

Download (17.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" 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 inframe" onresize="home.bodyResize();" onbeforeunload="return home.logout();">
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;">
88
        <div id="homecontent" class="tab-pane in active grid-tab">
89
        </div>
90
        <div id="serverscontent" class="tab-pane grid-tab">
91
        </div>
92
        <div id="imagescontent" class="tab-pane grid-tab">
93
        </div>
94
        <div id="networkscontent" class="tab-pane grid-tab">
95
        </div>
96
        <div id="userscontent" class="tab-pane grid-tab">
97
        </div>
98
        <div id="nodescontent" class="tab-pane grid-tab">
99
        </div>
100
    </div>
101

    
102
    <div class="panel-group" role="tablist" style="margin-botton: 0;">
103
        <div class="panel panel-default" id="activityPanel" style="border-radius:0;">
104
            <div class="panel-heading" role="tab" id="activityHeading1">
105
                <h4 class="panel-title" id="-collapsible-list-group-">
106
                    <a class="collapsed" data-toggle="collapse" href="#activity-collapse" aria-expanded="false" aria-controls="collapseListGroup1">
107
                        Activity log
108
                    </a>
109
                    <a class="anchorjs-link" href="#-collapsible-list-group-"><span class="anchorjs-icon"></span></a>
110
                </h4>
111
            </div>
112
            <div id="activity-collapse" class="panel-collapse collapse" role="tabpanel" aria-expanded="false" style="height: 0px;">
113
                      <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">
114
                      </pre>
115
                <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>
116
            </div>
117
        </div>
118
    </div>
119
</div>
120

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

    
139
              'dojo/_base/declare',
140
              'dijit/layout/TabContainer',
141
              'dijit/layout/ContentPane',
142

    
143
              'stabile/home',
144
              'stabile/servers',
145
              'stabile/images',
146
              'stabile/networks',
147
              'stabile/users',
148
              'stabile/nodes',
149

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

    
155
              'dojo/aspect',
156
              'dojo/on',
157
              'dojo/Evented',
158
              'dojo/_base/connect'
159

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

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

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

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

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

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

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

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

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

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

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

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

    
313
            }
314

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

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

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

    
368
    // For some reason dijit_layout_BorderContainer_0 get's reset to width 0 sometimes, this ugly hack fixes it
369
    function fixInfoWidth() {
370
        if ($("#dijit_layout_BorderContainer_0").width() == 0)
371
            $("#dijit_layout_BorderContainer_0").css("width","");
372
    }
373
</script>
374
      <!-- script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
375
      <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script -->
376
      <script type="text/javascript" src="/stabile/static/js/jqueryui/1.8.23/jquery-ui.min.js"></script>
377
      <script type="text/javascript" src="/stabile/static/js/bootstrap/3.3.4/js/bootstrap.min.js"></script>
378
</body>
379
</html>
(4-4/5)