Skip to content
Snippets Groups Projects
Commit f0c1f091 authored by Christoph Dornieden's avatar Christoph Dornieden
Browse files
parents 4263c950 3557def8
Branches
No related tags found
No related merge requests found
import Ember from 'ember';
import RESTAdapter from 'ember-data/adapters/rest';
import FixtureAdapter from 'ember-data-fixture-adapter';
import ENV from 'iobserve-ui/config/environment';
export default RESTAdapter.extend({
host: 'http://localhost:8080', // TODO: replace with live url
host: ENV.APP.API_ROOT,
namespace: 'v1',
session: Ember.inject.service()
});
\ No newline at end of file
......@@ -10,7 +10,7 @@
{{content-for "head"}}
<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/frontend-prototype.css">
<link rel="stylesheet" href="assets/iobserve-ui.css">
<!-- <script src="http://marvl.infotech.monash.edu/webcola/cola.v3.min.js"></script> -->
{{content-for "head-footer"}}
......@@ -19,7 +19,7 @@
{{content-for "body"}}
<script src="assets/vendor.js"></script>
<script src="assets/frontend-prototype.js"></script>
<script src="assets/iobserve-ui.js"></script>
{{content-for "body-footer"}}
</body>
......
import Ember from 'ember';
import ENV from 'iobserve-ui/config/environment';
export default Ember.Service.extend({
changelogQueue: Ember.inject.service(),
......@@ -11,7 +12,7 @@ export default Ember.Service.extend({
this.set('shouldClose', false);
this.debug('setting up websocket', systemId);
const socket = new WebSocket(`ws://localhost:8080/v1/changelogstream/${systemId}`); // TODO: from environment!
const socket = new WebSocket(`${ENV.APP.WEBSOCKET_ROOT}/v1/changelogstream/${systemId}`);
this.set('socket', socket);
socket.onopen = this.get('events.onOpen').bind(this);
......@@ -19,6 +20,7 @@ export default Ember.Service.extend({
socket.onmessage = this.get('events.onMessage').bind(this);
// automatically reconnect
if(ENV.APP.WEBSOCKET_RECONNECT) {
socket.onclose = () => {
if(!this.get('shouldClose')) {
this.debug('connection lost, reconnecting!');
......@@ -28,6 +30,7 @@ export default Ember.Service.extend({
}, 500));
}
};
}
// close socket connection when the user closes the window/tab or nagivates to a different website
window.onbeforeunload = this.get('disconnect').bind(this);
......
{
"name": "frontend-prototype",
"name": "iobserve-ui",
"dependencies": {
"ember": "~2.4.1",
"ember-cli-shims": "0.1.0",
......
......@@ -2,7 +2,7 @@
module.exports = function(environment) {
var ENV = {
modulePrefix: 'frontend-prototype',
modulePrefix: 'iobserve-ui',
environment: environment,
baseURL: '/',
locationType: 'auto',
......@@ -17,6 +17,9 @@ module.exports = function(environment) {
APP: {
// Here you can pass flags/options to your application instance
// when it is created
API_ROOT: 'http://iobserve-api.herokuapp.com',
WEBSOCKET_ROOT: 'ws://iobserve-api.herokuapp.com',
WEBSOCKET_RECONNECT: false // not running on heroku/jetty-runner
}
};
......@@ -27,6 +30,10 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.APP.API_ROOT = 'http://localhost:8080';
ENV.APP.WEBSOCKET_ROOT = 'ws://localhost:8080';
ENV.APP.WEBSOCKET_RECONNECT = true;
}
if (environment === 'test') {
......
{
"name": "frontend-prototype",
"name": "iobserve-ui",
"version": "0.0.0",
"description": "Small description for frontend-prototype goes here",
"description": "Web based user interface for the iObserve project",
"private": true,
"directories": {
"doc": "doc",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment