Basic RS setup
This commit is contained in:
parent
42c657adf3
commit
5926575d50
12
app/controllers/application.js
Normal file
12
app/controllers/application.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import Controller from '@ember/controller';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import { alias } from '@ember/object/computed';
|
||||||
|
|
||||||
|
export default Controller.extend({
|
||||||
|
|
||||||
|
storage: service(),
|
||||||
|
|
||||||
|
connecting: alias('storage.connecting'),
|
||||||
|
connected: alias('storage.connected')
|
||||||
|
|
||||||
|
});
|
4
app/controllers/index.js
Normal file
4
app/controllers/index.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import Controller from '@ember/controller';
|
||||||
|
|
||||||
|
export default Controller.extend({
|
||||||
|
});
|
@ -6,7 +6,6 @@ const Router = EmberRouter.extend({
|
|||||||
rootURL: config.rootURL
|
rootURL: config.rootURL
|
||||||
});
|
});
|
||||||
|
|
||||||
Router.map(function() {
|
Router.map(function() {});
|
||||||
});
|
|
||||||
|
|
||||||
export default Router;
|
export default Router;
|
||||||
|
5
app/routes/application.js
Normal file
5
app/routes/application.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
|
export default Route.extend({
|
||||||
|
|
||||||
|
});
|
8
app/routes/index.js
Normal file
8
app/routes/index.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import Route from '@ember/routing/route';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
|
export default Route.extend({
|
||||||
|
|
||||||
|
storage: service()
|
||||||
|
|
||||||
|
});
|
@ -13,7 +13,6 @@ export default Service.extend({
|
|||||||
const rs = new RemoteStorage({
|
const rs = new RemoteStorage({
|
||||||
cache: false
|
cache: false
|
||||||
});
|
});
|
||||||
this.set('rs', rs);
|
|
||||||
|
|
||||||
rs.access.claim('*', 'rw');
|
rs.access.claim('*', 'rw');
|
||||||
|
|
||||||
@ -25,7 +24,6 @@ export default Service.extend({
|
|||||||
const widget = new Widget(rs, {
|
const widget = new Widget(rs, {
|
||||||
leaveOpen: true
|
leaveOpen: true
|
||||||
});
|
});
|
||||||
this.set('widget', widget);
|
|
||||||
|
|
||||||
// Attach widget to DOM
|
// Attach widget to DOM
|
||||||
widget.attach();
|
widget.attach();
|
||||||
@ -64,6 +62,9 @@ export default Service.extend({
|
|||||||
this.set('connecting', true);
|
this.set('connecting', true);
|
||||||
this.set('connected', false);
|
this.set('connected', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.set('rs', rs);
|
||||||
|
this.set('widget', widget);
|
||||||
}.on('init')
|
}.on('init')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -6,3 +6,9 @@ body {
|
|||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
color: #222;
|
color: #222;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#remotestorage-widget {
|
||||||
|
position: fixed;
|
||||||
|
top: 0.5rem;
|
||||||
|
right: 0.5rem;
|
||||||
|
}
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
<h2 id="title">Welcome to Ember</h2>
|
<h2 id="title">Inspektor</h2>
|
||||||
|
|
||||||
|
{{#if connecting}}
|
||||||
|
Connecting...
|
||||||
|
{{else}}
|
||||||
|
{{#if connected}}
|
||||||
|
Connected.
|
||||||
|
{{else}}
|
||||||
|
Not connected.
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{outlet}}
|
{{outlet}}
|
3
app/templates/index.hbs
Normal file
3
app/templates/index.hbs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
index.hbs
|
||||||
|
|
||||||
|
{{outlet}}
|
@ -43,6 +43,6 @@
|
|||||||
"remotestoragejs": "^1.0.0"
|
"remotestoragejs": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^4.5 || 6.* || >= 7.*"
|
"node": "6.* || >= 7.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
tests/unit/controllers/application-test.js
Normal file
12
tests/unit/controllers/application-test.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
|
||||||
|
moduleFor('controller:application', 'Unit | Controller | application', {
|
||||||
|
// Specify the other units that are required for this test.
|
||||||
|
// needs: ['controller:foo']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace this with your real tests.
|
||||||
|
test('it exists', function(assert) {
|
||||||
|
let controller = this.subject();
|
||||||
|
assert.ok(controller);
|
||||||
|
});
|
12
tests/unit/controllers/index-test.js
Normal file
12
tests/unit/controllers/index-test.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
|
||||||
|
moduleFor('controller:index', 'Unit | Controller | index', {
|
||||||
|
// Specify the other units that are required for this test.
|
||||||
|
// needs: ['controller:foo']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace this with your real tests.
|
||||||
|
test('it exists', function(assert) {
|
||||||
|
let controller = this.subject();
|
||||||
|
assert.ok(controller);
|
||||||
|
});
|
11
tests/unit/routes/index-test.js
Normal file
11
tests/unit/routes/index-test.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { moduleFor, test } from 'ember-qunit';
|
||||||
|
|
||||||
|
moduleFor('route:index', 'Unit | Route | index', {
|
||||||
|
// Specify the other units that are required for this test.
|
||||||
|
// needs: ['controller:foo']
|
||||||
|
});
|
||||||
|
|
||||||
|
test('it exists', function(assert) {
|
||||||
|
let route = this.subject();
|
||||||
|
assert.ok(route);
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user