mirror of https://github.com/status-im/consul.git
30 lines
817 B
JavaScript
30 lines
817 B
JavaScript
import { computed } from '@ember/object';
|
|
import { or } from '@ember/object/computed';
|
|
import attr from 'ember-data/attr';
|
|
|
|
import Fragment from 'ember-data-model-fragments/fragment';
|
|
|
|
export const schema = {
|
|
Name: {
|
|
required: true,
|
|
},
|
|
HeaderType: {
|
|
allowedValues: ['Exact', 'Prefix', 'Suffix', 'Regex', 'Present'],
|
|
},
|
|
};
|
|
|
|
export default Fragment.extend({
|
|
Name: attr('string'),
|
|
|
|
Exact: attr('string'),
|
|
Prefix: attr('string'),
|
|
Suffix: attr('string'),
|
|
Regex: attr('string'),
|
|
Present: attr(), // this is a boolean but we don't want it to automatically be set to false
|
|
|
|
Value: or(...schema.HeaderType.allowedValues),
|
|
HeaderType: computed(...schema.HeaderType.allowedValues, function() {
|
|
return schema.HeaderType.allowedValues.find(prop => typeof this[prop] !== 'undefined');
|
|
}),
|
|
});
|