summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-06-07 11:26:58 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-06-07 11:26:58 +0200
commit465dac06620b252e1697fb4adec15df2dc53e518 (patch)
tree2ec0f4934a013a06ac3e493fe2b8c7e9c46072f5
parent8fee152a65795ba1505f11a93b5954eadcd9f601 (diff)
downloadbackoffice-465dac06620b252e1697fb4adec15df2dc53e518.tar.gz
backoffice-465dac06620b252e1697fb4adec15df2dc53e518.tar.bz2
backoffice-465dac06620b252e1697fb4adec15df2dc53e518.zip
Still UI minor changes.
-rw-r--r--js/backoffice.js64
-rw-r--r--talerbackoffice/backoffice/templates/backoffice.html3
2 files changed, 16 insertions, 51 deletions
diff --git a/js/backoffice.js b/js/backoffice.js
index 9fd0bda..fc223d6 100644
--- a/js/backoffice.js
+++ b/js/backoffice.js
@@ -147,6 +147,7 @@ function make_marker(wtid){
* 'fill_table()'.
*/
var track_transfer = function(exchange, wtid, cb){
+
/* Remove any previous errors, if there are any. */
var info_bar = document.getElementById("information-bar");
info_bar.style.visibility = "hidden";
@@ -169,9 +170,9 @@ var track_transfer = function(exchange, wtid, cb){
* results: older than what? The scroll feature will
* be re-enabled from the /history callback. */
SCROLL = false;
+ clear_results();
var tracks = JSON.parse(req.responseText);
- cb(false,
- tracks.deposits_sums,
+ cb(tracks.deposits_sums,
tracks.execution_time,
wtid);
break;
@@ -328,53 +329,12 @@ function xpath_get(xpath, ctx){
return ret;
}
-/**
- * Modify the table showing orders. Those orders could be
- * either from /history or /track/transfer. If data is _not_
- * to be appended to previous results in the table, this
- * function will erase previous results and either show new
- * data or make the "no results" message available. Otherwise,
- * it will just append data to what already exists in the table.
- *
- * Data is non-appending if (1) the page has been (re)loaded,
- * (2) the user queried /track/transfer, (3) the user changed
- * the instance being tracked. Those 1-3 cases will all have
- * the 'refresh' parameter set to true.
- *
- * 'wtid_marker' - set to <WTID> - serves to show a line at the
- * bottom of the lines being added in the table which indicates
- * that all those entries - orders - have been paid out by the
- * same WTID.
- *
- * FIXME: 'execution_time' is a problematic field: when showing
- * /history results, it shows the order timestamp. When instead
- * /track/tranfer results are being shown, it indicates the time
- * the exchange wire transferred this order's amount.
- */
-function fill_table(scroll, data, execution_time, wtid_marker){
+
+function fill_table(data, execution_time, wtid_marker){
var table = document.getElementById("history");
var tbody = xpath_get("tbody", table).snapshotItem(0);
- var nr = xpath_get("tr[@class='no-records']", tbody)
- .snapshotItem(0)
-
- /* not append data, erase! */
- if (!scroll){
- clear_results();
- if(0 == data.length){
- /* make NO RESULTS visible and hide tab headers */
- nr.style.display = "block";
- xpath_get("tr[@class='headers']", tbody)
- .snapshotItem(0).style.visibility = "hidden";
- toggle_loader();
- console.log("Nothing gotten!");
- return;
- }
- }
- /* hide "no records" message */
- nr.style.display = "none";
-
- /* Make table's header visible */
+ /* Make table's headers visible */
xpath_get("tr[@class='headers']", tbody)
.snapshotItem(0).style.visibility = "visible";
/* Will only be effective on page first load; afterwards
@@ -516,10 +476,14 @@ function get_instance(){
function clear_results(){
var table = document.getElementById("history");
var tbody = xpath_get("tbody", table).snapshotItem(0);
- var tbody_children = xpath_get("tbody/*[position() > 2]", table);
+ var tbody_children = xpath_get("tbody/*[position() > 1]", table);
for(var i=0; i<tbody_children.snapshotLength; i++){
tbody.removeChild(tbody_children.snapshotItem(i));
}
+
+ xpath_get("tr[@class='headers']", tbody)
+ .snapshotItem(0).style.visibility = "hidden";
+
}
/**
* Nullify curreny instance and triggers history for newly
@@ -567,11 +531,15 @@ function get_history(scroll, cb){
console.log("Got invalid JSON");
return;
}
+ if (0 == history.length){
+ show_warning("No records found!");
+ return;
+ }
if(0 < history.length){
console.log(history);
LAST = history[history.length - 1].row_id;
+ cb(history);
}
- cb(scroll, history);
}
else{
console.log("error: status != 200");
diff --git a/talerbackoffice/backoffice/templates/backoffice.html b/talerbackoffice/backoffice/templates/backoffice.html
index d904531..bccdcc4 100644
--- a/talerbackoffice/backoffice/templates/backoffice.html
+++ b/talerbackoffice/backoffice/templates/backoffice.html
@@ -51,9 +51,6 @@
<col width="40">
<col width="40">
<tbody>
- <tr class="no-records">
- <th colspan="3">No records found</th>
- </tr>
<tr class="headers" style="visibility: hidden">
<th class="order-id">Order ID</th>
<th class="amount">Amount</th>