HPC status dashboard
diff --git a/xos/core/xoslib/dashboards/xosHpc.html b/xos/core/xoslib/dashboards/xosHpc.html
new file mode 100644
index 0000000..bdb964d
--- /dev/null
+++ b/xos/core/xoslib/dashboards/xosHpc.html
@@ -0,0 +1,35 @@
+<script src="{{ STATIC_URL }}/js/vendor/underscore-min.js"></script>
+<script src="{{ STATIC_URL }}/js/vendor/backbone.js"></script>
+<script src="{{ STATIC_URL }}/js/vendor/backbone.syphon.js"></script>
+<script src="{{ STATIC_URL }}/js/vendor/backbone.wreqr.js"></script>
+<script src="{{ STATIC_URL }}/js/vendor/backbone.babysitter.js"></script>
+<script src="{{ STATIC_URL }}/js/vendor/backbone.marionette.js"></script>
+
+<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
+<link rel="stylesheet" type="text/css" href="{% static 'css/xosTenantDashboard.css' %}" media="all" >
+<link rel="stylesheet" type="text/css" href="{% static 'css/xosAdminSite.css' %}" media="all" >
+
+<script src="{{ STATIC_URL }}/js/xoslib/xos-util.js"></script>
+<script src="{{ STATIC_URL }}/js/xoslib/xos-defaults.js"></script>
+<script src="{{ STATIC_URL }}/js/xoslib/xos-validators.js"></script>
+<script src="{{ STATIC_URL }}/js/xoslib/xos-backbone.js"></script>
+<script src="{{ STATIC_URL }}/js/xoslib/xosHelper.js"></script>
+<script src="{{ STATIC_URL }}/js/xosHpc.js"></script>
+
+<div id="xos-hpc-view-panel"> <!-- contentPanel"> -->
+<div id="contentTitle">
+</div>
+
+<div id="contentInner">
+
+<h2>Request Routers</h2>
+<div id="xos-hpc-dns"></div>
+
+<br>
+<h2>HyperCache</h2>
+<div id="xos-hpc-hpc"></div>
+
+</div> <!-- end contentInner -->
+</div> <!-- end contentPanel -->
+
+{% include 'xosAdmin.html' %}
diff --git a/xos/core/xoslib/static/js/xosHpc.js b/xos/core/xoslib/static/js/xosHpc.js
new file mode 100644
index 0000000..1d8adf0
--- /dev/null
+++ b/xos/core/xoslib/static/js/xosHpc.js
@@ -0,0 +1,74 @@
+function staleCheck(row, time_key, msg_key) {
+ if (parseInt(row[time_key])>30) {
+ return "stale";
+ } else {
+ return row[msg_key];
+ }
+}
+
+function updateDnsDemuxTable(dnsdemux) {
+ $('#xos-hpc-dns').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamic_dnsdemux"></table>' );
+ var actualEntries = [];
+
+ console.log(dnsdemux);
+
+ for (rowkey in dnsdemux) {
+ row = dnsdemux[rowkey];
+
+ actualEntries.push( [row.name, row.ip, staleCheck(row, "watcher.DNS.time", "watcher.DNS.msg")] );
+ }
+ console.log(actualEntries);
+ oTable = $('#dynamic_dnsdemux').dataTable( {
+ "bJQueryUI": true,
+ "aaData": actualEntries ,
+ "bStateSave": true,
+ "bFilter": false,
+ "bPaginate": false,
+ "aoColumns": [
+ { "sTitle": "Node" },
+ { "sTitle": "IP Address" },
+ { "sTitle": "Status" },
+ ]
+ } );
+}
+
+function updateHpcTable(dnsdemux) {
+ $('#xos-hpc-hpc').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamic_hpc"></table>' );
+ var actualEntries = [];
+
+ console.log(dnsdemux);
+
+ for (rowkey in dnsdemux) {
+ row = dnsdemux[rowkey];
+
+ actualEntries.push( [row.name, staleCheck(row, "watcher.HPC-hb.time", "watcher.HPC-hb.msg")] );
+ }
+ console.log(actualEntries);
+ oTable = $('#dynamic_hpc').dataTable( {
+ "bJQueryUI": true,
+ "aaData": actualEntries ,
+ "bStateSave": true,
+ "bFilter": false,
+ "bPaginate": false,
+ "aoColumns": [
+ { "sTitle": "Node", },
+ { "sTitle": "Status" },
+ ]
+ } );
+}
+
+function updateHpcView(data) {
+ data = data[0];
+ updateDnsDemuxTable( data.attributes.dnsdemux );
+ updateHpcTable( data.attributes.hpc );
+}
+
+$(document).ready(function(){
+ xos.hpcview.on("change", function() { console.log("change"); updateHpcView(xos.hpcview.models); });
+ xos.hpcview.on("remove", function() { console.log("sort"); updateHpcView(xos.hpcview.models); });
+ xos.hpcview.on("sort", function() { console.log("sort"); updateHpcView(xos.hpcview.models); });
+
+ xos.hpcview.startPolling();
+});
+
+
diff --git a/xos/core/xoslib/static/js/xoslib/xos-backbone.js b/xos/core/xoslib/static/js/xoslib/xos-backbone.js
index 6188fa3..2e1795c 100644
--- a/xos/core/xoslib/static/js/xoslib/xos-backbone.js
+++ b/xos/core/xoslib/static/js/xoslib/xos-backbone.js
@@ -33,7 +33,8 @@
XOSLIB_BASE = "/xoslib";
SLICEPLUS_API = XOSLIB_BASE + "/slicesplus/";
- TENANTVIEW_API = XOSLIB_BASE + "/tenantview/"
+ TENANTVIEW_API = XOSLIB_BASE + "/tenantview/";
+ HPCVIEW_API = XOSLIB_BASE + "/hpcview";
XOSModel = Backbone.Model.extend({
relatedCollections: [],
@@ -717,6 +718,13 @@
detailFields: [],
});
+ define_model(this, {urlRoot: HPCVIEW_API,
+ modelName: "hpcview",
+ collectionName: "hpcview",
+ listFields: [],
+ detailFields: [],
+ });
+
/* by default, have slicePlus only fetch the slices the user can see */
this.slicesPlus.currentUserCanSee = true;