afb-api-v3: Simplify the code
[src/app-framework-binder.git] / test / monitoring / monitor.js
index 5b9dc0e..1bdfcb4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 "IoT.bzh"
+ * Copyright (C) 2017, 2018 "IoT.bzh"
  * Author: José Bollo <jose.bollo@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -131,7 +131,7 @@ function init() {
        at("param-host").value = document.location.hostname;
        at("param-port").value = document.location.port;
        var args = new URLSearchParams(document.location.search.substring(1));
-       at("param-token").value = args.get("x-afb-token") || args.get("token") || "hello";
+       at("param-token").value = args.get("x-afb-token") || args.get("token") || "HELLO";
 
        document.onbeforeunload = on_disconnect;
 
@@ -454,12 +454,12 @@ function gottraceevent(obj) {
        x.className = x.className + " " + type;
        get(".time", x).textContent = data.time;
        get(".tag", x).textContent = ({
-               request: function(r) { return r.api + "/" + r.verb + "  [" + r.index + "] " + r.action; },
+               request: function(r,d) { return r.api + "/" + r.verb + "  [" + r.index + "] " + r.action + (r.action == 'reply' ? ' '+d.data.error  : ''); },
                service: function(r) { return r.api + "@" + r.action; },
                daemon: function(r) { return r.api + ":" + r.action; },
                event: function(r) { return r.name + "!" + r.action; },
                global: function(r) { return "$" + r.action; },
-               })[type](desc);
+               })[type](desc,data);
        var tab = makeobj(desc, 4);
        if ("data" in data)
                makeobjitem(tab, 2, "data", data.data);