Commit bd45d7d3 authored by Matthias Möller's avatar Matthias Möller

Fehlerfreie Modul installation, Einfügung von css

parent 62f188e8
export function initialize(/* application */) {
// application.inject('route', 'foo', 'service:foo');
}
export default {
name: 'exploviz-plugin-bci',
initialize
};
...@@ -5,14 +5,30 @@ export default Ember.Service.extend({ ...@@ -5,14 +5,30 @@ export default Ember.Service.extend({
websockets : Ember.inject.service("websockets"), websockets : Ember.inject.service("websockets"),
init: function(){ init: function(){
const self = this;
this._super(); this._super();
console.log("service started!"); $(document).ready(addButton);
this.start();
function addButton(){
let item = document.createElement("li");
let button = document.createElement("a");
let span = document.createElement("span");
//span.onclick = self.start;
span.className = "glyphicon glyphicon-signal";
span.dataset.type = "disconnected";
button.appendChild(span);
item.appendChild(button);
let field = document.getElementById("addon-bar");
field.appendChild(item);
}
}, },
start: function(){ start: function(){
let sockets = websockets.socketFor("ws://localhost:1313/"); let sockets = this.get("websockets").socketFor("ws://localhost:1313/");
sockets.on("open", openMessageHandler, this); sockets.on("open", this.openMessageHandler, this);
sockets.on("message", this.myMessageHandler, this); sockets.on("message", this.myMessageHandler, this);
sockets.on("close", function(){console.log("arr");}, this);
}, },
openMessageHandler: function(event){ openMessageHandler: function(event){
...@@ -22,7 +38,7 @@ export default Ember.Service.extend({ ...@@ -22,7 +38,7 @@ export default Ember.Service.extend({
myMessageHandler: function(event){ myMessageHandler: function(event){
let data = event.data; let data = event.data;
console.log(data); console.log(data);
}, }
......
@keyframes connecting{
0% {color:grey;}
50% {color:#7FFF00;}
100% {color:grey;}
}
.glyphicon.glyphicon-signal[data-type="connected"]{
color: #7FFF00;
}
.glyphicon.glyphicon-signal[data-type="disconnected"]{
color: grey;
cursor: pointer;
}
.glyphicon.glyphicon-signal[data-type="connecting"]{
animation-name: connecting;
animation-duration: 1s;
animation-iteration-count: infinite;
cursor: wait;
}
\ No newline at end of file
export { default, initialize } from 'explorviz-plugin-bci/initializers/exploviz-plugin-bci';
...@@ -5,10 +5,32 @@ module.exports = { ...@@ -5,10 +5,32 @@ module.exports = {
name: 'explorviz-plugin-bci', name: 'explorviz-plugin-bci',
included: function(app) { included: function(app) {
this.addons.forEach(function(addon){ this.addons.forEach((addon) =>{
if (addon.name === "ember-websocket") { if(addon.name === "ember-websockets"){
addon.included.apply(addon, [app]); //überschreibt eine Funktion, die einen allgemeinen Fehler verursacht
addon._readConfig =
function help(environment) {
let path = require("path");
let exists = require('exists-sync');
const project = this.parent.app.project;
const configPath = path.dirname(project.configPath());
let config = path.join(configPath, 'environment.js');
if (!path.isAbsolute(config)) {
config = path.join(project.root, config);
}
if (exists(config)) {
return require(config)(environment);
}
return {
'ember-websockets': {}
};
};
} }
}); });
this._super.included.apply(this, arguments);
} }
}; };
...@@ -18,29 +18,28 @@ ...@@ -18,29 +18,28 @@
"test": "ember try:each" "test": "ember try:each"
}, },
"dependencies": { "dependencies": {
"ember-cli-babel": "^5.1.7", "ember-cli-babel": "^6.6.0",
"ember-websockets": "^7.0.3" "ember-websockets": "^7.0.3"
}, },
"devDependencies": { "devDependencies": {
"broccoli-asset-rev": "^2.4.5", "broccoli-asset-rev": "^2.4.5",
"ember-ajax": "^2.4.1", "ember-ajax": "^3.0.0",
"ember-cli": "2.12.2", "ember-cli": "2.14.0",
"ember-cli-dependency-checker": "^1.3.0", "ember-cli-dependency-checker": "^2.0.1",
"ember-cli-eslint": "^3.0.0", "ember-cli-eslint": "^4.1.0",
"ember-cli-htmlbars": "^1.1.1", "ember-cli-htmlbars": "^2.0.2",
"ember-cli-htmlbars-inline-precompile": "^0.3.6", "ember-cli-htmlbars-inline-precompile": "^0.4.3",
"ember-cli-inject-live-reload": "^1.4.1", "ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-qunit": "^3.1.0", "ember-cli-qunit": "^4.0.0",
"ember-cli-shims": "^1.0.2", "ember-cli-shims": "^1.0.2",
"ember-cli-sri": "^2.1.0", "ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0", "ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.1.0", "ember-disable-prototype-extensions": "^1.1.0",
"ember-export-application-global": "^1.0.5", "ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^0.6.0", "ember-load-initializers": "^1.0.0",
"ember-resolver": "^2.0.3", "ember-resolver": "^4.3.0",
"ember-source": "~2.12.0", "ember-source": "~2.14.0",
"ember-websockets": "^7.0.3", "ember-welcome-page": "^3.1.1",
"ember-welcome-page": "^2.0.2",
"loader.js": "^4.2.3" "loader.js": "^4.2.3"
}, },
"engines": { "engines": {
......
import Ember from 'ember';
import { initialize } from 'dummy/initializers/exploviz-plugin-bci';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';
module('Unit | Initializer | exploviz plugin bci', {
beforeEach() {
Ember.run(() => {
this.application = Ember.Application.create();
this.application.deferReadiness();
});
},
afterEach() {
destroyApp(this.application);
}
});
// Replace this with your real tests.
test('it works', function(assert) {
initialize(this.application);
// you would normally confirm the results of the initializer here
assert.ok(true);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment