aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHumberto Alfonso Díaz <humberto.alfonso@asvito.es>2019-07-01 14:32:28 +0200
committerLorenzo Tilve <ltilve@igalia.com>2020-02-04 09:42:15 +0100
commit5dddcfd4212448e7e79b7e075ae6278bba92db92 (patch)
treefc8f26c89c731ed2df057894637094a99b188c85 /src
parent218d0148b1336793aec2bdb5a157f1d3a671807b (diff)
RESTRUCT Update config.xml and app.js
Diffstat (limited to 'src')
-rw-r--r--src/config.xml4
-rw-r--r--src/js/app.js80
2 files changed, 2 insertions, 82 deletions
diff --git a/src/config.xml b/src/config.xml
index b1d38ce..fdc3ab5 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="webapps-html5-homescreen" version="5.0.0">
+<widget xmlns="http://www.w3.org/ns/widgets" id="webapps-html5-hvac" version="5.0.0">
<name>HTML5 HVAC</name>
<icon src="icon.svg"/>
<content src="index.html" type="text/html"/>
@@ -14,7 +14,7 @@
</feature>
<feature name="urn:AGL:widget:required-api">
<param name="windowmanager" value="ws" />
- <param name="homescreen" value="ws" />
+ <param name="hvac" value="ws" />
<param name="afm-main" value="ws" />
</feature>
</widget> \ No newline at end of file
diff --git a/src/js/app.js b/src/js/app.js
index 9c65e4f..e69de29 100644
--- a/src/js/app.js
+++ b/src/js/app.js
@@ -1,80 +0,0 @@
-import Mustache from 'mustache';
-
-var host = document.location.hostname;
-var port = document.location.port;
-var args = new URLSearchParams(document.location.search.substring(1));
-var token = args.get("x-afb-token") || args.get("token") || "HELLO";
-var afb;
-var template;
-
-function log(smgs) {
- document.getElementById('log').innerHTML += '<div>'+smgs+'</div>';
-}
-
-function getIcon(app) {
- if( app.icon.match(/^.*\.svg$/) ) {
- return '/icons/'+app.id;
- } else {
- return '/images/noicon.svg';
- }
-}
-
-function display_applications(apps) {
- var appContainer = document.getElementById('AppContainer');
- for( var i=0; i<apps.length; i++) {
- apps[i].icon = getIcon(apps[i]);
- appContainer.innerHTML += Mustache.render(template, apps[i]);
- }
-}
-
-function load_application_list() {
- var ws = new afb.ws(function() {
- var api_verb = "afm-main/runnables";
- ws.call(api_verb, {}).then(
- function(obj) {
- display_applications(obj.response);
- },
- function(obj) {
- //TODO Manage errors
- log("failure");
- }
- );
- },
- function() {
- //TODO manage errors
- log("ws aborted");
- });
-}
-
-export function launch(app) {
- var appId = app.getAttribute('app-id');
- var ws = new afb.ws(function() {
- var api_verb = "afm-main/start";
- var request = {id: appId};
- ws.call(api_verb, request).then(
- function(obj) {
- log("success: " + obj.response);
- },
- function(obj) {
- //TODO Manage errors
- log("failure");
- }
- );
- },
- function() {
- //TODO Manage errors
- log("ws aborted");
- });
-}
-
-export function init() {
- template = document.getElementById('item-template').innerHTML;
- Mustache.parse(template);
-
- // host: "raspberrypi3.local:31022",
- afb = new AFB({
- host: host+":"+port,
- token: token
- });
- load_application_list();
-} \ No newline at end of file