<body>
<div id="AppContainer" class="parent">
<script id="item-template" type="x-tmpl-mustache">
- <div class="item">
+ <a href="#" class="item" app-id="{{ id }}" onclick="window.launch(this);">
<img class="icon" src="{{ icon }}" onload="SVGInject(this);">
<div class="name">
{{ name }}
</div>
- </div>
+ </a>
</script>
</div>
<div class="log" id="log">
/* JS */
import '@iconfu/svg-inject';
import './js/AFB.js';
-import './js/app.js';
+import { init, launch } from './js/app.js';
/* CSS */
import './styles/app.scss';
+
+window.launch = launch;
+
+document.addEventListener('DOMContentLoaded', init);
\ No newline at end of file
});
}
-function init() {
+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: "raspberrypi3.local:31022",
+ host: host+":"+port,
token: token
});
load_application_list();
-}
-
-document.addEventListener('DOMContentLoaded', init);
\ No newline at end of file
+}
\ No newline at end of file