vault/ui/app/models/transform/alphabet.js
Chelsea Shaw 99bdfa7803
CRUD for transform alphabets (#9989)
includes tests for templates and alphabets
2020-09-21 15:36:07 -05:00

38 lines
1.1 KiB
JavaScript

import DS from 'ember-data';
import { computed } from '@ember/object';
import { apiPath } from 'vault/macros/lazy-capabilities';
import attachCapabilities from 'vault/lib/attach-capabilities';
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
const { attr } = DS;
const Model = DS.Model.extend({
idPrefix: 'alphabet/',
idForNav: computed('id', 'idPrefix', function() {
let modelId = this.id || '';
return `${this.idPrefix}${modelId}`;
}),
name: attr('string', {
fieldValue: 'id',
readOnly: true,
subText: 'The alphabet name. Keep in mind that spaces are not allowed and this cannot be edited later.',
}),
alphabet: attr('string', {
label: 'Alphabet',
subText:
'Provide the set of valid UTF-8 characters contained within both the input and transformed value. Read more.',
}),
attrs: computed(function() {
let keys = ['name', 'alphabet'];
return expandAttributeMeta(this, keys);
}),
backend: attr('string', { readOnly: true }),
});
export default attachCapabilities(Model, {
updatePath: apiPath`${'backend'}/alphabet/${'id'}`,
});