John Cowen e8b7c44087 ui: Move ember-data classes to use native JS classes/decorators (#9136)
* ui: Upgrade ember-data models to use native classes/decorators

* ui: Update remaining ember-data imports

* ui: Move ember-data Adapters to use native classes

* ui: Upgrade serializers to native classes/decorators

* ui: remove meta from roles, they never had it to start with
2020-11-09 17:30:11 +00:00

23 lines
532 B
JavaScript

import Adapter from './http';
import { inject as service } from '@ember/service';
export const DATACENTER_QUERY_PARAM = 'dc';
export const NSPACE_QUERY_PARAM = 'ns';
export default class ApplicationAdapter extends Adapter {
@service('client/http') client;
@service('env') env;
formatNspace(nspace) {
if (this.env.env('CONSUL_NSPACES_ENABLED')) {
return nspace !== '' ? { [NSPACE_QUERY_PARAM]: nspace } : undefined;
}
}
formatDatacenter(dc) {
return {
[DATACENTER_QUERY_PARAM]: dc,
};
}
}