limit table rows in log window
diff --git a/planetstack/core/xoslib/dashboards/test.html b/planetstack/core/xoslib/dashboards/test.html
index 48fbc65..27b0b8d 100644
--- a/planetstack/core/xoslib/dashboards/test.html
+++ b/planetstack/core/xoslib/dashboards/test.html
@@ -7,6 +7,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/test.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-backbone.js"></script>
<script src="{{ STATIC_URL }}/js/xoslib/xosHelper.js"></script>
diff --git a/planetstack/core/xoslib/dashboards/xosAdminDashboard.html b/planetstack/core/xoslib/dashboards/xosAdminDashboard.html
index b5dacc9..b41ac9f 100644
--- a/planetstack/core/xoslib/dashboards/xosAdminDashboard.html
+++ b/planetstack/core/xoslib/dashboards/xosAdminDashboard.html
@@ -9,6 +9,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/xosAdminDashboard.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-backbone.js"></script>
<script src="{{ STATIC_URL }}/js/xoslib/xosHelper.js"></script>
diff --git a/planetstack/core/xoslib/dashboards/xosAdminWholePage.html b/planetstack/core/xoslib/dashboards/xosAdminWholePage.html
index 0bc9924..4af6093 100644
--- a/planetstack/core/xoslib/dashboards/xosAdminWholePage.html
+++ b/planetstack/core/xoslib/dashboards/xosAdminWholePage.html
@@ -9,6 +9,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'css/xosAdminWholePage.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-backbone.js"></script>
<script src="{{ STATIC_URL }}/js/xoslib/xosHelper.js"></script>
diff --git a/planetstack/core/xoslib/static/css/xosAdminDashboard.css b/planetstack/core/xoslib/static/css/xosAdminDashboard.css
index f4e8191..d94cb39 100644
--- a/planetstack/core/xoslib/static/css/xosAdminDashboard.css
+++ b/planetstack/core/xoslib/static/css/xosAdminDashboard.css
@@ -10,6 +10,10 @@
display: none;
}
+#logPanel {
+ overflow-y: auto;
+}
+
#logTable {
width: 100%;
}
diff --git a/planetstack/core/xoslib/static/js/xoslib/xos-util.js b/planetstack/core/xoslib/static/js/xoslib/xos-util.js
new file mode 100644
index 0000000..79ce0f8
--- /dev/null
+++ b/planetstack/core/xoslib/static/js/xoslib/xos-util.js
@@ -0,0 +1,23 @@
+// misc utility functions
+
+// http://stackoverflow.com/questions/2117320/set-maximum-displayed-rows-count-for-html-table
+function limitTableRows(tableSelector, maxRows) {
+ var table = $(tableSelector)[0] //document.getElementById(tableId);
+ var wrapper = table.parentNode;
+ var rowsInTable = table.rows.length;
+ try {
+ var border = getComputedStyle(table.rows[0].cells[0], '').getPropertyValue('border-top-width');
+ border = border.replace('px', '') * 1;
+ } catch (e) {
+ var border = table.rows[0].cells[0].currentStyle.borderWidth;
+ border = (border.replace('px', '') * 1) / 2;
+ }
+ var height = 0;
+ if (rowsInTable > maxRows) {
+ for (var i = 0; i < maxRows; i++) {
+ height += table.rows[i].clientHeight + border;
+ //console.log("XXX " + height + " " + table.rows[i].clientHeight + " " + border);
+ }
+ wrapper.style.height = height + "px";
+ }
+}
diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
index 98dfb88..99e47e7 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
@@ -116,6 +116,8 @@
$(this.statusMsgId).html( templateFromId("#xos-status-template")(result) );
}
+ limitTableRows(this.logTableId, 5);
+
return logMessageId;
},