url statistics slice by url instead of node
diff --git a/xos/core/xoslib/dashboards/xosHpcNodes.html b/xos/core/xoslib/dashboards/xosHpcNodes.html
new file mode 100644
index 0000000..4682ca5
--- /dev/null
+++ b/xos/core/xoslib/dashboards/xosHpcNodes.html
@@ -0,0 +1,32 @@
+<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/xosHpcNodes.js"></script>
+
+<div id="xos-hpc-view-panel"> <!-- contentPanel"> -->
+<div id="contentTitle">
+</div>
+
+<div id="contentInner">
+
+Url: <select id="xos-hpc-url-select"></select>
+
+<div id="xos-hpc-urls"></div>
+
+</div> <!-- end contentInner -->
+</div> <!-- end contentPanel -->
+
+{% include 'xosAdmin.html' %}
diff --git a/xos/core/xoslib/static/js/xosHpcNodes.js b/xos/core/xoslib/static/js/xosHpcNodes.js
new file mode 100644
index 0000000..729e167
--- /dev/null
+++ b/xos/core/xoslib/static/js/xosHpcNodes.js
@@ -0,0 +1,108 @@
+SC_HPC_FETCH = 3600;
+
+var hpc_data = null;
+
+function updateHpcUrlTable() {
+ hpcnode = null;
+ selected_url = $("#xos-hpc-url-select").val();
+
+ $('#xos-hpc-urls').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamic_hpc_urls"></table>' );
+ var actualEntries = [];
+
+ for (index in hpc_data) {
+ hpc_node = hpc_data[index];
+
+ if (parseInt(hpc_node["watcher.HPC-fetch.time"]) > SC_HPC_FETCH) {
+ $("#xos-hpc-urls").html("stale");
+ actualEntries.push( [hpc_node.name, "stale", "stale", "stale", "stale"] );
+ } else {
+ urls = hpc_node["watcher.HPC-fetch.urls"];
+
+ found = null;
+ for (j in urls) {
+ url = urls[j];
+
+ if (url[0] == selected_url) {
+ found = url;
+ }
+ }
+
+ if (found==null) {
+ actualEntries.push( [hpc_node.name, "not found", "not found", "not found", "not found"] );
+ } else {
+ bytes_downloaded=url[2];
+ total_time = url[3];
+ if (total_time > 0) {
+ KBps = Math.round(bytes_downloaded/total_time/1024.0);
+ } else {
+ KBps = 0;
+ }
+ actualEntries.push( [hpc_node.name, url[1], bytes_downloaded, total_time, KBps] );
+ }
+ }
+ }
+
+ oTable = $('#dynamic_hpc_urls').dataTable( {
+ "bJQueryUI": true,
+ "aaData": actualEntries ,
+ "bStateSave": true,
+ "bFilter": false,
+ "bPaginate": false,
+ "aoColumns": [
+ { "sTitle": "Node", },
+ { "sTitle": "Status" },
+ { "sTitle": "Bytes_Downloaded" },
+ { "sTitle": "Total_Time" },
+ { "sTitle": "KBps" },
+ ]
+ } );
+}
+
+function updateUrlList() {
+ selected_url = $("#xos-hpc-url-select").val();
+
+ urls = [];
+ for (index in hpc_data) {
+ node = hpc_data[index];
+ node_urls = node["watcher.HPC-fetch.urls"];
+ for (j in node_urls) {
+ url = node_urls[j][0];
+ if ($.inArray(url, urls) < 0) {
+ urls.push(url);
+ }
+ }
+ }
+
+ console.log(urls);
+
+ options = [];
+ for (index in urls) {
+ url = urls[index];
+ if (node.name == selected_url) {
+ options.push("<option value=\"" + url + "\" selected>" + url + "</option>");
+ } else {
+ options.push("<option value=\"" + url + "\">" + url + "</option>");
+ }
+ }
+
+ $("#xos-hpc-url-select").html(options);
+}
+
+function updateHpcView(data) {
+ data = data[0];
+ hpc_data = data.attributes.hpc;
+ updateUrlList();
+ updateHpcUrlTable();
+}
+
+$(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-hpc-node-select").click( function() { updateHpcUrlTable(); } );
+
+ xos.hpcview.startPolling();
+});
+
+