vault/ui/app/models/pki/pki-issuer-engine.js
Angel Garbarino 613498cbc9
PKI Keys List View (#17239)
* setup

* cleanup

* cleanup
2022-09-21 08:41:44 -06:00

52 lines
1.3 KiB
JavaScript

import Model, { attr } from '@ember-data/model';
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
import { withModelValidations } from 'vault/decorators/model-validations';
const validations = {
name: [
{ type: 'presence', message: 'Name is required.' },
{
type: 'containsWhiteSpace',
message: 'Name cannot contain whitespace.',
},
],
};
@withModelValidations(validations)
export default class PkiIssuerEngineModel extends Model {
@attr('string', { readOnly: true }) backend;
@attr('string', {
label: 'Issuer name',
fieldValue: 'id',
})
name;
get useOpenAPI() {
return true;
}
getHelpUrl(backend) {
return `/v1/${backend}/issuer/example?help=1`;
}
@attr('boolean') isDefault;
@attr('string') issuerName;
// Form Fields not hidden in toggle options
_attributeMeta = null;
get formFields() {
if (!this._attributeMeta) {
this._attributeMeta = expandAttributeMeta(this, [
'name',
'leafNotAfterBehavior',
'usage',
'manualChain',
'issuingCertifications',
'crlDistributionPoints',
'ocspServers',
'deltaCrlUrls', // new endpoint, mentioned in RFC, but need to confirm it's there.
]);
}
return this._attributeMeta;
}
}