|
From: <tob...@us...> - 2014-03-18 04:38:11
|
Revision: 7993
http://sourceforge.net/p/bigdata/code/7993
Author: tobycraig
Date: 2014-03-18 04:38:07 +0000 (Tue, 18 Mar 2014)
Log Message:
-----------
#843 - Initial improvements to status tab
Modified Paths:
--------------
branches/RDR/bigdata-war/src/html/css/style.css
branches/RDR/bigdata-war/src/html/js/workbench.js
branches/RDR/bigdata-war/src/html/new.html
Modified: branches/RDR/bigdata-war/src/html/css/style.css
===================================================================
--- branches/RDR/bigdata-war/src/html/css/style.css 2014-03-17 18:33:10 UTC (rev 7992)
+++ branches/RDR/bigdata-war/src/html/css/style.css 2014-03-18 04:38:07 UTC (rev 7993)
@@ -191,3 +191,23 @@
pre {
font-family: monospace;
}
+
+#running-queries li {
+ margin: 10px 0;
+}
+
+#running-queries div {
+ border: 1px solid;
+ border-bottom: none;
+ padding: 10px;
+}
+
+#running-queries .query {
+ max-height: 50px;
+ overflow: scroll;
+}
+
+#running-queries div.query-details {
+ border-bottom: 1px solid;
+}
+
Modified: branches/RDR/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-17 18:33:10 UTC (rev 7992)
+++ branches/RDR/bigdata-war/src/html/js/workbench.js 2014-03-18 04:38:07 UTC (rev 7993)
@@ -20,12 +20,6 @@
showTab($(this).data('target'));
});
-if(window.location.hash) {
- showTab(window.location.hash.substr(1));
-} else {
- $('#tab-selector a:first').click();
-}
-
function showTab(tab) {
$('.tab').hide();
$('#' + tab + '-tab').show();
@@ -795,10 +789,58 @@
$('#tab-selector a[data-target=status]').click(function(e) {
$.get('/bigdata/status', function(data) {
- $('#status-tab .box').html(data);
+ var accepted = data.match(/Accepted query count=(\d+)/)[1];
+ var running = data.match(/Running query count=(\d+)/)[1];
+ var numbers = $(data).get(-1).textContent;
+ $('#accepted-query-count').html(accepted);
+ $('#running-query-count').html(running);
+ $('#status-numbers').html(numbers);
});
});
+$('#show-queries').click(function(e) {
+ e.preventDefault();
+ $.get('/bigdata/status?showQueries', function(data) {
+ // clear current list
+ $('#running-queries').empty();
+
+ // get data inside a jQuery object
+ data = $('<div>').append(data);
+ data.find('h1').each(function(i, e) {
+ // per running query, data is structured h1 form (with numbers/cancel data) h2 pre (with SPARQL)
+ e = $(e);
+ // get numbers string, which includes cancel link
+ var form = e.next();
+ var numbers = form.find('p')[0].textContent;
+ // remove cancel link
+ numbers = numbers.substring(0, numbers.lastIndexOf(','));
+ // get query id
+ var queryId = form.find('input[type=hidden]').val();
+ // get SPARQL
+ var sparql = form.next().next().html();
+
+ // got all data, create a li for each query
+ var li = $('<li><div class="query"><pre>' + sparql + '</pre></div><div class="query-numbers">' + numbers + ', <a href="#" class="cancel-query">Cancel</a></div><div class="query-details"><a href="#" class="query-details collapsed">Details</a></div>');
+ li.find('a').data('queryId', queryId);
+ $('#running-queries').append(li);
+ });
+
+ $('.cancel-query').click(cancelQuery);
+ $('a.query-details').click(getQueryDetails);
+ });
+});
+
+function cancelQuery(e) {
+ e.preventDefault();
+ if(confirm('Cancel query?')) {
+ var id = $(this).data('queryId');
+ $.post('/bigdata/?cancel&queryId=' + id);
+ $(this).parents('li').remove();
+ }
+}
+
+function getQueryDetails(e) {}
+
/* Performance */
$('#tab-selector a[data-target=performance]').click(function(e) {
@@ -823,4 +865,10 @@
return $('<div/>').text(text).html();
}
+if(window.location.hash) {
+ $('a[data-target=' + window.location.hash.substring(1) + ']').click();
+} else {
+ $('#tab-selector a:first').click();
+}
+
});
Modified: branches/RDR/bigdata-war/src/html/new.html
===================================================================
--- branches/RDR/bigdata-war/src/html/new.html 2014-03-17 18:33:10 UTC (rev 7992)
+++ branches/RDR/bigdata-war/src/html/new.html 2014-03-18 04:38:07 UTC (rev 7993)
@@ -154,8 +154,14 @@
<div class="tab" id="status-tab">
- <div class="box"></div>
-
+ <div class="box">
+ <p>Accepted query count: <span id="accepted-query-count"></span></p>
+ <p>Running query count: <span id="running-query-count"></span></p>
+ <p>Show <a href="#" id="show-queries">queries</a>, <a href="#" id="show-query-details">query details</a>.</p>
+ <pre id="status-numbers"></pre>
+ <ul id="running-queries"></ul>
+ </div>
+
</div>
<div class="tab" id="performance-tab">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|