Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dougestey committed Jun 27, 2018
1 parent 4f6ca1a commit f7b92e1
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 41 deletions.
11 changes: 11 additions & 0 deletions app/components/gloss-message-disposable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Component from '@ember/component';

export default Component.extend({

willDestroy() {
this._super(...arguments);

this.get('action')();
}

});
3 changes: 3 additions & 0 deletions app/controllers/navigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export default Controller.extend({
killsRenderable: computed('kills', 'context', 'regionKills.[]', 'constellationKills.[]', 'systemKills.[]', function() {
let kills = this.get('kills');

if (!kills)
return [];

return kills.sortBy('time').reverse().slice(0, 200);
}),

Expand Down
6 changes: 6 additions & 0 deletions app/controllers/navigate/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default Controller.extend({

fleets: reads('tracker.fleets.[]'),

deadFleetCount: reads('tracker.deadFleetCount'),

activeFleets: filterBy('fleets', 'isActive', true),

inactiveFleets: filterBy('fleets', 'isActive', false),
Expand All @@ -26,6 +28,10 @@ export default Controller.extend({
toggleTracking(fleet) {
this.get('navigate').send('toggleTracking', fleet);
},

resetDeadFleetCount() {
this.get('tracker').set('deadFleetCount', 0);
},
}

});
33 changes: 27 additions & 6 deletions app/services/intel.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,26 +191,47 @@ export default Service.extend({
let systemFleets = this.get('fleets.system');
let systemKills = this.get('kills.system');

fleets.map((fleet) => systemFleets.pushObject(fleet));
kills.map((kill) => systemKills.pushObject(kill));
fleets.map((fleet) => {
if (!systemFleets.findBy('id', fleet.id))
systemFleets.pushObject(fleet);
});

kills.map((kill) => {
if (!systemKills.findBy('id', kill.id))
systemKills.pushObject(kill);
});
},

receiveConstellationIntel(data) {
let { fleets, kills } = data;
let constellationFleets = this.get('fleets.constellation');
let constellationKills = this.get('kills.constellation');

fleets.map((fleet) => constellationFleets.pushObject(fleet));
kills.map((kill) => constellationKills.pushObject(kill));
fleets.map((fleet) => {
if (!constellationFleets.findBy('id', fleet.id))
constellationFleets.pushObject(fleet);
});

kills.map((kill) => {
if (!constellationKills.findBy('id', kill.id))
constellationKills.pushObject(kill);
});
},

receiveRegionIntel(data) {
let { fleets, kills } = data;
let regionFleets = this.get('fleets.region');
let regionKills = this.get('kills.region');

fleets.map((fleet) => regionFleets.pushObject(fleet));
kills.map((kill) => regionKills.pushObject(kill));
fleets.map((fleet) => {
if (!regionFleets.findBy('id', fleet.id))
regionFleets.pushObject(fleet);
});

kills.map((kill) => {
if (!regionKills.findBy('id', kill.id))
regionKills.pushObject(kill);
});
},

/* Methods */
Expand Down
3 changes: 3 additions & 0 deletions app/services/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export default Service.extend({
updateCurrentSystem(system) {
let currentSystem = this.get('system');

if (!currentSystem || !currentSystem.id)
return;

if (currentSystem.id === system.id) {
if (_isWormhole(system)) {
system.stats.npcKills = '?';
Expand Down
11 changes: 10 additions & 1 deletion app/services/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default Service.extend({

fleets: storageFor('tracked-fleets-01'),

deadFleetCount: 0,

kills: computed('fleets.[]', function() {
let fleets = this.get('fleets').toArray();
let kills = [];
Expand Down Expand Up @@ -35,7 +37,14 @@ export default Service.extend({

if (existingFleet) {
fleets.removeObject(existingFleet);
fleets.addObject(fleet);

if (fleet.characters.length) {
fleets.addObject(fleet);
} else {
let count = this.get('deadFleetCount');

this.set('deadFleetCount', count + 1);
}
}
}

Expand Down
50 changes: 25 additions & 25 deletions app/styles/utilities/_margin.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
.m0 { margin: 0; }
.m1 { margin: 1rem; }
.m2 { margin: 2rem; }
.m3 { margin: 3rem; }
.m4 { margin: 4rem; }
.m0 { margin: 0 !important; }
.m1 { margin: 1rem !important; }
.m2 { margin: 2rem !important; }
.m3 { margin: 3rem !important; }
.m4 { margin: 4rem !important; }

.mt0 { margin-top: 0rem; }
.mt1 { margin-top: 1rem; }
.mt2 { margin-top: 2rem; }
.mt3 { margin-top: 3rem; }
.mt4 { margin-top: 4rem; }
.mt0 { margin-top: 0rem !important; }
.mt1 { margin-top: 1rem !important; }
.mt2 { margin-top: 2rem !important; }
.mt3 { margin-top: 3rem !important; }
.mt4 { margin-top: 4rem !important; }

.mr0 { margin-right: 0rem; }
.mr1 { margin-right: 1rem; }
.mr2 { margin-right: 2rem; }
.mr3 { margin-right: 3rem; }
.mr4 { margin-right: 4rem; }
.mr0 { margin-right: 0rem !important; }
.mr1 { margin-right: 1rem !important; }
.mr2 { margin-right: 2rem !important; }
.mr3 { margin-right: 3rem !important; }
.mr4 { margin-right: 4rem !important; }

.ml0 { margin-left: 0rem; }
.ml1 { margin-left: 1rem; }
.ml2 { margin-left: 2rem; }
.ml3 { margin-left: 3rem; }
.ml4 { margin-left: 4rem; }
.ml0 { margin-left: 0rem !important; }
.ml1 { margin-left: 1rem !important; }
.ml2 { margin-left: 2rem !important; }
.ml3 { margin-left: 3rem !important; }
.ml4 { margin-left: 4rem !important; }

.mb0 { margin-bottom: 0rem; }
.mb1 { margin-bottom: 1rem; }
.mb2 { margin-bottom: 2rem; }
.mb3 { margin-bottom: 3rem; }
.mb4 { margin-bottom: 4rem; }
.mb0 { margin-bottom: 0rem !important; }
.mb1 { margin-bottom: 1rem !important; }
.mb2 { margin-bottom: 2rem !important; }
.mb3 { margin-bottom: 3rem !important; }
.mb4 { margin-bottom: 4rem !important; }
1 change: 1 addition & 0 deletions app/templates/components/gloss-message-disposable.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{yield}}
4 changes: 2 additions & 2 deletions app/templates/components/gloss-stats.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@

{{#if stats.createdAt}}
{{gloss-shard
label="Refresh"
label="Stat Refresh"
value=(sub 60 (moment-diff stats.createdAt now precision='minutes' interval='60000'))
loaded=loadUiElements
loadOrder=6
}}
{{else}}
{{gloss-shard
label=(if (not-eq context 'tracker') "Refresh")
label=(if (not-eq context 'tracker') "Stat Refresh")
value=(if (not-eq context 'tracker') "?")
loaded=loadUiElements
loadOrder=6
Expand Down
15 changes: 13 additions & 2 deletions app/templates/navigate/tracker.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@
{{/each}}
</div>

{{#unless fleets.length}}
{{#if deadFleetCount}}
{{#gloss-message-disposable action=(action 'resetDeadFleetCount')}}
<p class="copy mt2 ml1">{{deadFleetCount}} fleet(s) GLOSS was tracking for you have expired.

This occurrs due to lack of combat activity or because all pilots are now part of another fleet.

<small>If you find this confusing, or wish to suggest an improvement to how GLOSS handles tracking, <a href="https://github.com/dougestey/gloss/issues" target="_blank">open a ticket</a>.</small>
</p>
{{/gloss-message-disposable}}
{{/if}}

{{#if (and (not deadFleetCount) (not fleets.length))}}
<p class="copy mt1 ml2">You aren't tracking any fleet movement.

To get started, select a fleet from one of the other panes and hit <span class="primary">Track Fleet</span>.

<small>Fleets are tracked through New Eden as they amass kills, and expire after 30 minutes of inactivity.</small>
</p>
{{/unless}}
{{/if}}
9 changes: 5 additions & 4 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ module.exports = function(environment) {

moment: {
allowEmpty: true
}
},

sentry: {
dsn: 'https://38965402c5b14f64ab7f2d4febe0c48a@app.getsentry.com/1232945'
}
};

if (environment === 'development') {
Expand All @@ -40,6 +43,7 @@ module.exports = function(environment) {
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
ENV.ARBITER_URL = 'http://arbiter.gloss.development';
ENV.sentry.development = true;
}

if (environment === 'test') {
Expand All @@ -55,9 +59,6 @@ module.exports = function(environment) {

if (environment === 'production') {
ENV.ARBITER_URL = 'https://arbiter.gloss.space';
ENV.sentry = {
dsn: 'https://38965402c5b14f64ab7f2d4febe0c48a@app.getsentry.com/1232945'
};
}

return ENV;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gloss",
"version": "1.0.5",
"version": "1.0.7",
"private": false,
"description": "A heads up display for space travel.",
"license": "MIT",
Expand Down
24 changes: 24 additions & 0 deletions tests/integration/components/gloss-message-disposable-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('gloss-message-disposable', 'Integration | Component | gloss message disposable', {
integration: true
});

test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });

this.render(hbs`{{gloss-message-disposable}}`);

assert.equal(this.$().text().trim(), '');

// Template block usage:
this.render(hbs`
{{#gloss-message-disposable}}
template block text
{{/gloss-message-disposable}}
`);

assert.equal(this.$().text().trim(), 'template block text');
});

0 comments on commit f7b92e1

Please sign in to comment.