5c18dc099f
* 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
31 lines
943 B
JavaScript
31 lines
943 B
JavaScript
import Fragment from 'ember-data-model-fragments/fragment';
|
|
import { fragmentArray, array } from 'ember-data-model-fragments/attributes';
|
|
import { attr } from '@ember-data/model';
|
|
import { computed } from '@ember/object';
|
|
import { or } from '@ember/object/computed';
|
|
|
|
export const schema = {
|
|
PathType: {
|
|
allowedValues: ['PathPrefix', 'PathExact', 'PathRegex'],
|
|
},
|
|
Methods: {
|
|
allowedValues: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
|
|
},
|
|
};
|
|
|
|
export default class IntentionPermissionHttp extends Fragment {
|
|
@attr('string') PathExact;
|
|
@attr('string') PathPrefix;
|
|
@attr('string') PathRegex;
|
|
|
|
@fragmentArray('intention-permission-http-header') Header;
|
|
@array('string') Methods;
|
|
|
|
@or(...schema.PathType.allowedValues) Path;
|
|
|
|
@computed(...schema.PathType.allowedValues)
|
|
get PathType() {
|
|
return schema.PathType.allowedValues.find(prop => typeof this[prop] === 'string');
|
|
}
|
|
}
|