open-consul/ui/packages/consul-ui/app/models/gateway-config.js
John Cowen d4a8316bd8
ui: Convert Service.GatewayConfig to a model fragment (#9586)
* ui: Convert Service.GatewayConfig to a model fragment

We added the ember-intl addon, which has its own format-number helper.
We replaced our own similarly named helper with this one, but the
ember-intl one is far stricter and errors if the arguments passed are
undefined. Our previously one would cope with this.

We'd rather continue to use the stricter ember-intl helper, so here we
convert the GatewayConfig property to a model fragment so that we can
give the GatewayConfig.AssociatedServices property a default zero value.
2021-01-20 15:36:23 +00:00

13 lines
531 B
JavaScript

import Fragment from 'ember-data-model-fragments/fragment';
import { array } from 'ember-data-model-fragments/attributes';
import { attr } from '@ember-data/model';
export default class GatewayConfig extends Fragment {
// AssociatedServiceCount is only populated when asking for a list of
// services
@attr('number', { defaultValue: () => 0 }) AssociatedServiceCount;
// Addresses is only populated when asking for a list of services for a
// specific gateway
@array('string', { defaultValue: () => [] }) Addresses;
}