view service/mqtt_graph_bridge/index.html @ 1496:e2d5290bef22

tester page that can PUT some statements Ignore-this: 238b55764b2f4f59a21a7e7907e7039a darcs-hash:c38f9eaddc08f0e6c773840e2e8ebf77d535156f
author drewp <drewp@bigasterisk.com>
date Fri, 31 Jan 2020 23:55:04 -0800
parents 928b1833de0f
children
line wrap: on
line source

<!doctype html>
<html>
  <head>
    <title>mqtt_graph_bridge</title>
    <meta charset="utf-8">
    <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents.min.js"></script>
    <script src="/lib/require/require-2.3.3.js"></script>
    <script src="/rdf/common_paths_and_ns.js"></script>

    <link rel="stylesheet" href="/rdf/browse/style.css">

  </head>
  <body class="rdfBrowsePage">
    mqtt_graph_bridge


    <p>Send demo statements to bridge:</p>
    <div><button data-post="output?s=:kitchenLight&p=:brightness" data-body="0.0">Send (:kitchenLight :brightness 0.0)</button></div>
    <div><button data-post="output?s=:kitchenLight&p=:brightness" data-body="1.0">Send (:kitchenLight :brightness 1.0)</button></div>
    <div><button data-post="output?s=:livingLampShelf&p=:brightness" data-body="0.0">Send (:livingLampShelf :brightness 0.0)</button></div>
    <div><button data-post="output?s=:livingLampShelf&p=:brightness" data-body="1.0">Send (:livingLampShelf :brightness 1.0)</button></div>

    <script>
     Array.from(document.querySelectorAll("button")).forEach((el) => {
       el.addEventListener("click", (ev) => {
         fetch(el.dataset.post, {
           method: "PUT",
           body: el.dataset.body
         });
       });
     });
    </script>

  </body>
</html>