[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-backoffice] branch master updated: fix switching bet
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-backoffice] branch master updated: fix switching between instances |
Date: |
Sat, 06 Jan 2018 00:28:08 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository backoffice.
The following commit(s) were added to refs/heads/master by this push:
new 5b5173d fix switching between instances
5b5173d is described below
commit 5b5173da54e4a9f98e4fb76055a37a9034a2b4cf
Author: Marcello Stanisci <address@hidden>
AuthorDate: Sat Jan 6 00:27:47 2018 +0100
fix switching between instances
---
talerbackoffice/backoffice/static/backoffice.js | 45 +++++++++++++++----------
talerbackoffice/backoffice/templates/base.html | 4 +--
2 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/talerbackoffice/backoffice/static/backoffice.js
b/talerbackoffice/backoffice/static/backoffice.js
index 43ae9a2..5f37ab3 100644
--- a/talerbackoffice/backoffice/static/backoffice.js
+++ b/talerbackoffice/backoffice/static/backoffice.js
@@ -117,12 +117,7 @@ function track_transfer(exchange, wtid){
switch(req.status){
case 200:
var tracks = JSON.parse(req.responseText);
- var table = document.getElementById("history");
- var tbody = xpath_get("tbody", table).snapshotItem(0);
- var tbody_children = xpath_get("tbody/*[position() > 1]", table);
- for(var i=0; i<tbody_children.snapshotLength; i++){
- tbody.removeChild(tbody_children.snapshotItem(i));
- }
+ clean_results();
close_popup();
fill_table(tracks.deposits_sums, tracks.execution_time);
@@ -143,9 +138,9 @@ function track_transfer(exchange, wtid){
req.send();
}
-function track_order(order_id, instance){
+function track_order(order_id){
var req = new XMLHttpRequest();
- req.open("GET", `/track/order?order_id=${order_id}&instance=${instance}`,
true);
+ req.open("GET", `/track/order?order_id=${order_id}&instance=${INSTANCE}`,
true);
req.onload = function(){
if (4 == req.readyState){
if(200 == req.status){
@@ -209,16 +204,18 @@ function xpath_get(xpath, ctx){
function fill_table(history, execution_time){
var table = document.getElementById("history");
var tbody = xpath_get("tbody", table).snapshotItem(0);
-
+ var nr = xpath_get("address@hidden'no-records']", tbody).snapshotItem(0)
if(0 == history.length){
+ nr.style.display = "block";
+ xpath_get("address@hidden'headers']",
tbody).snapshotItem(0).style.visibility = "hidden";
window.setTimeout(remove_loader, 900);
+ console.log("Nothing gotten!");
return;
}
- /* remove "no records" message */
- var nr = xpath_get("address@hidden'no-records']", tbody).snapshotItem(0)
- if (nr)
- tbody.removeChild(nr);
+ /* hide "no records" message */
+ nr.style.display = "none";
+
/* Make table's header visible */
xpath_get("address@hidden'headers']",
tbody).snapshotItem(0).style.visibility = "";
@@ -237,7 +234,7 @@ function fill_table(history, execution_time){
td_amount.className = "amount";
var td_date = document.createElement("td");
td_date.className = "date";
- td_order_id.innerHTML = `<a href="#${i}"
onclick='track_order("${entry.order_id}", "FSF");'>${entry.order_id}</a>`;
+ td_order_id.innerHTML = `<a href="#${i}"
onclick='track_order("${entry.order_id}");'>${entry.order_id}</a>`;
td_summary.className = "summary";
td_summary.innerHTML = entry.summary;
td_amount.innerHTML = amount_to_string(entry.amount ||
entry.deposit_value);
@@ -270,7 +267,7 @@ function track_cherry_pick(form){
var type = types.snapshotItem(i).value;
if ("order" == type){
var order_id = xpath_get("address@hidden'order']", form).snapshotItem(0);
- track_order(order_id.value, INSTANCE);
+ track_order(order_id.value);
}
else{
var data = xpath_get("address@hidden'transfer']", form);
@@ -315,17 +312,29 @@ function get_instance(){
}
/**
+ * Remove tracks from the main page table.
+ */
+function clean_results(){
+ var table = document.getElementById("history");
+ var tbody = xpath_get("tbody", table).snapshotItem(0);
+ var tbody_children = xpath_get("tbody/*[position() > 2]", table);
+ for(var i=0; i<tbody_children.snapshotLength; i++){
+ tbody.removeChild(tbody_children.snapshotItem(i));
+ }
+}
+/**
* Nullify curreny instance and triggers history for newly
* selected one.
*/
function change_instance(){
INSTANCE = null;
+ clean_results();
get_history();
}
/**
- * - scroll if true, the logic tries to retrieve the
- * "next page" of all the proposals known to the merchant.
+ * scroll if true, the logic tries to retrieve the
+ * "next page" of all the proposals known to the merchant.
*/
function get_history(scroll){
if (!INSTANCE)
@@ -349,7 +358,7 @@ function get_history(scroll){
return;
}
if(0 < history.length){
- console.log(req.respnseText);
+ console.log(history);
LAST = history[history.length - 1].row_id;
}
fill_table(history);
diff --git a/talerbackoffice/backoffice/templates/base.html
b/talerbackoffice/backoffice/templates/base.html
index 755e72f..4ecd543 100644
--- a/talerbackoffice/backoffice/templates/base.html
+++ b/talerbackoffice/backoffice/templates/base.html
@@ -17,7 +17,7 @@
<html data-taler-nojs="true">
<head>
- <title>Taler Donation Demo</title>
+ <title>Taler Back-office interface</title>
<link rel="stylesheet" type="text/css" href="{{
url('/static/web-common/pure.css') }}" />
<link rel="stylesheet" type="text/css" href="{{
url('/static/web-common/demo.css') }}" />
<link rel="stylesheet" type="text/css" href="{{
url('/static/web-common/taler-fallback.css') }}" id="taler-presence-stylesheet"
/>
@@ -30,7 +30,7 @@
<body>
<div class="demobar">
<h1><span class="tt adorn-brackets">Taler Demo</span></h1>
- <h1><span class="it"><a href="{{ env('TALER_ENV_URL_MERCHANT_BLOG')
}}">Shop</a></span></h1>
+ <h1><span class="it"><a href="/">Backoffice</a></span></h1>
<p>This is the Essay shop, you can buy articles using an imaginary
currency (for now).</p>
<ul>
<li><a href="{{ env('TALER_ENV_URL_INTRO', '#') }}">Introduction</a></li>
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-backoffice] branch master updated: fix switching between instances,
gnunet <=