open-consul/ui/packages/consul-ui/app/models/intention-permission-http-header.js
John Cowen 5c18dc099f
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:29:12 +00:00

32 lines
845 B
JavaScript

import Fragment from 'ember-data-model-fragments/fragment';
import { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { or } from '@ember/object/computed';
export const schema = {
Name: {
required: true,
},
HeaderType: {
allowedValues: ['Exact', 'Prefix', 'Suffix', 'Regex', 'Present'],
},
};
export default class IntentionPermission extends Fragment {
@attr('string') Name;
@attr('string') Exact;
@attr('string') Prefix;
@attr('string') Suffix;
@attr('string') Regex;
// this is a boolean but we don't want it to automatically be set to false
@attr() Present;
@or(...schema.HeaderType.allowedValues) Value;
@computed(...schema.HeaderType.allowedValues)
get HeaderType() {
return schema.HeaderType.allowedValues.find(prop => typeof this[prop] !== 'undefined');
}
}