e9e52e0dfe
This doesn’t include Ember Data, as we are still back on 3.12. Most changes are deprecation updates, linting fixes, and dependencies. It can be read commit-by-commit, though many of them are mechanical and skimmable. For the new linting exclusions, I’ve added them to the Tech Debt list. The decrease in test count is because linting is no longer included in ember test. There’s a new deprecation warning in the logs that can be fixed by updating Ember Power Select but when I tried that it caused it to render incorrectly, so I decided to ignore it for now and address it separately.
45 lines
1.7 KiB
JavaScript
45 lines
1.7 KiB
JavaScript
import { inject as service } from '@ember/service';
|
|
import { alias } from '@ember/object/computed';
|
|
import Component from '@ember/component';
|
|
import { computed } from '@ember/object';
|
|
import { lazyClick } from '../helpers/lazy-click';
|
|
import { classNames, classNameBindings, tagName } from '@ember-decorators/component';
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
@classic
|
|
@tagName('tr')
|
|
@classNames('server-agent-row', 'is-interactive')
|
|
@classNameBindings('isActive:is-active')
|
|
export default class ServerAgentRow extends Component {
|
|
// TODO Switch back to the router service once the service behaves more like Route
|
|
// https://github.com/emberjs/ember.js/issues/15801
|
|
// router: inject.service('router'),
|
|
// eslint-disable-next-line ember/no-private-routing-service
|
|
@service('-routing') _router;
|
|
@alias('_router.router') router;
|
|
|
|
agent = null;
|
|
|
|
@computed('agent', 'router.currentURL')
|
|
get isActive() {
|
|
// TODO Switch back to the router service once the service behaves more like Route
|
|
// https://github.com/emberjs/ember.js/issues/15801
|
|
// const targetURL = this.get('router').urlFor('servers.server', this.get('agent'));
|
|
// const currentURL = `${this.get('router.rootURL').slice(0, -1)}${this.get('router.currentURL')}`;
|
|
|
|
const router = this.router;
|
|
const targetURL = router.generate('servers.server', this.agent);
|
|
const currentURL = `${router.get('rootURL').slice(0, -1)}${
|
|
router.get('currentURL').split('?')[0]
|
|
}`;
|
|
|
|
// Account for potential URI encoding
|
|
return currentURL.replace(/%40/g, '@') === targetURL.replace(/%40/g, '@');
|
|
}
|
|
|
|
click() {
|
|
const transition = () => this.router.transitionTo('servers.server', this.agent);
|
|
lazyClick([transition, event]);
|
|
}
|
|
}
|