UI: Convert pki component files to ts (#20533)

This commit is contained in:
Kianna 2023-05-16 08:07:12 -07:00 committed by GitHub
parent f14a039a65
commit 65c100182d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 272 additions and 171 deletions

View File

@ -9,9 +9,9 @@ import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import { waitFor } from '@ember/test-waiters';
import errorMessage from 'vault/utils/error-message';
import FlashMessageService from 'vault/services/flash-messages';
import DownloadService from 'vault/services/download';
import PkiCertificateBaseModel from 'vault/models/pki/certificate/base';
import type FlashMessageService from 'vault/services/flash-messages';
import type DownloadService from 'vault/services/download';
import type PkiCertificateBaseModel from 'vault/models/pki/certificate/base';
interface Args {
model: PkiCertificateBaseModel;

View File

@ -4,16 +4,14 @@
*/
import Component from '@glimmer/component';
import errorMessage from 'vault/utils/error-message';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
//TYPES
import RouterService from '@ember/routing/router-service';
import FlashMessageService from 'vault/services/flash-messages';
import Store from '@ember-data/store';
import VersionService from 'vault/services/version';
import errorMessage from 'vault/utils/error-message';
import type RouterService from '@ember/routing/router-service';
import type FlashMessageService from 'vault/services/flash-messages';
import type Store from '@ember-data/store';
import type VersionService from 'vault/services/version';
interface Args {
currentPath: string;

View File

@ -9,13 +9,13 @@ import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import { waitFor } from '@ember/test-waiters';
import RouterService from '@ember/routing/router-service';
import FlashMessageService from 'vault/services/flash-messages';
import VersionService from 'vault/services/version';
import { FormField, TtlEvent } from 'vault/app-types';
import PkiCrlModel from 'vault/models/pki/crl';
import PkiUrlsModel from 'vault/models/pki/urls';
import errorMessage from 'vault/utils/error-message';
import type RouterService from '@ember/routing/router-service';
import type FlashMessageService from 'vault/services/flash-messages';
import type VersionService from 'vault/services/version';
import type PkiCrlModel from 'vault/models/pki/crl';
import type PkiUrlsModel from 'vault/models/pki/urls';
import type { FormField, TtlEvent } from 'vault/app-types';
interface Args {
crl: PkiCrlModel;

View File

@ -6,12 +6,11 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
// TYPES
import Store from '@ember-data/store';
import Router from '@ember/routing/router';
import FlashMessageService from 'vault/services/flash-messages';
import PkiActionModel from 'vault/models/pki/action';
import { Breadcrumb } from 'vault/vault/app-types';
import type Store from '@ember-data/store';
import type Router from '@ember/routing/router';
import type FlashMessageService from 'vault/services/flash-messages';
import type PkiActionModel from 'vault/models/pki/action';
import type { Breadcrumb } from 'vault/vault/app-types';
interface Args {
config: PkiActionModel;

View File

@ -5,7 +5,12 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import type PkiIssuerModel from 'vault/models/pki/issuer';
export default class PkiIssuerDetailsComponent extends Component {
interface Args {
issuer: PkiIssuerModel;
}
export default class PkiIssuerDetailsComponent extends Component<Args> {
@tracked showRotationModal = false;
}

View File

@ -10,9 +10,9 @@ import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import { waitFor } from '@ember/test-waiters';
import errorMessage from 'vault/utils/error-message';
import RouterService from '@ember/routing/router-service';
import FlashMessageService from 'vault/services/flash-messages';
import PkiIssuerModel from 'vault/models/pki/issuer';
import type RouterService from '@ember/routing/router-service';
import type FlashMessageService from 'vault/services/flash-messages';
import type PkiIssuerModel from 'vault/models/pki/issuer';
interface Args {
model: PkiIssuerModel;

View File

@ -1,6 +1,11 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import type PkiActionModel from 'vault/vault/models/pki/action';
export default class PagePkiIssuerGenerateIntermediateComponent extends Component {
interface Args {
model: PkiActionModel;
}
export default class PagePkiIssuerGenerateIntermediateComponent extends Component<Args> {
@tracked title = 'Generate intermediate CSR';
}

View File

@ -1,6 +1,11 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import type PkiActionModel from 'vault/vault/models/pki/action';
export default class PagePkiIssuerGenerateRootComponent extends Component {
interface Args {
model: PkiActionModel;
}
export default class PagePkiIssuerGenerateRootComponent extends Component<Args> {
@tracked title = 'Generate root';
}

View File

@ -1,6 +1,11 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import type PkiActionModel from 'vault/vault/models/pki/action';
export default class PagePkiIssuerImportComponent extends Component {
interface Args {
model: PkiActionModel;
}
export default class PagePkiIssuerImportComponent extends Component<Args> {
@tracked title = 'Import a CA';
}

View File

@ -5,14 +5,13 @@ import { action } from '@ember/object';
import { waitFor } from '@ember/test-waiters';
import { task } from 'ember-concurrency';
import errorMessage from 'vault/utils/error-message';
// TYPES
import Store from '@ember-data/store';
import Router from '@ember/routing/router';
import FlashMessageService from 'vault/services/flash-messages';
import SecretMountPath from 'vault/services/secret-mount-path';
import PkiIssuerModel from 'vault/models/pki/issuer';
import PkiActionModel from 'vault/vault/models/pki/action';
import { Breadcrumb, ValidationMap } from 'vault/vault/app-types';
import type Store from '@ember-data/store';
import type Router from '@ember/routing/router';
import type FlashMessageService from 'vault/services/flash-messages';
import type SecretMountPath from 'vault/services/secret-mount-path';
import type PkiIssuerModel from 'vault/models/pki/issuer';
import type PkiActionModel from 'vault/vault/models/pki/action';
import type { Breadcrumb, ValidationMap } from 'vault/vault/app-types';
interface Args {
oldRoot: PkiIssuerModel;

View File

@ -3,13 +3,13 @@
* SPDX-License-Identifier: MPL-2.0
*/
import { action } from '@ember/object';
import Component from '@glimmer/component';
import RouterService from '@ember/routing/router-service';
import FlashMessageService from 'vault/services/flash-messages';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import errorMessage from 'vault/utils/error-message';
import PkiKeyModel from 'vault/models/pki/key';
import type RouterService from '@ember/routing/router-service';
import type FlashMessageService from 'vault/services/flash-messages';
import type PkiKeyModel from 'vault/models/pki/key';
interface Args {
key: PkiKeyModel;
}

View File

@ -3,15 +3,14 @@
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';
// TYPES
import Store from '@ember-data/store';
import RouterService from '@ember/routing/router-service';
import PkiIssuerModel from 'vault/models/pki/issuer';
import PkiRoleModel from 'vault/models/pki/role';
import type Store from '@ember-data/store';
import type RouterService from '@ember/routing/router-service';
import type PkiIssuerModel from 'vault/models/pki/issuer';
import type PkiRoleModel from 'vault/models/pki/role';
interface Args {
issuers: PkiIssuerModel | number;

View File

@ -3,14 +3,14 @@
* SPDX-License-Identifier: MPL-2.0
*/
import { action } from '@ember/object';
import RouterService from '@ember/routing/router-service';
import Component from '@glimmer/component';
import FlashMessageService from 'vault/services/flash-messages';
import SecretMountPath from 'vault/services/secret-mount-path';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import errorMessage from 'vault/utils/error-message';
import PkiRoleModel from 'vault/models/pki/role';
import type SecretMountPath from 'vault/services/secret-mount-path';
import type FlashMessageService from 'vault/services/flash-messages';
import type RouterService from '@ember/routing/router-service';
import type PkiRoleModel from 'vault/models/pki/role';
interface Args {
role: PkiRoleModel;

View File

@ -4,15 +4,14 @@
*/
import Component from '@glimmer/component';
import errorMessage from 'vault/utils/error-message';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';
import { waitFor } from '@ember/test-waiters';
import { tracked } from '@glimmer/tracking';
import PkiTidyModel from 'vault/models/pki/tidy';
import RouterService from '@ember/routing/router-service';
import errorMessage from 'vault/utils/error-message';
import type PkiTidyModel from 'vault/models/pki/tidy';
import type RouterService from '@ember/routing/router-service';
interface Args {
tidy: PkiTidyModel;

View File

@ -1,5 +1,6 @@
import Component from '@glimmer/component';
import { parsedParameterKeys } from 'vault/utils/parse-pki-cert-oids';
import { ParsedCertificateData } from 'vault/vault/utils/parse-pki-cert';
/**
* @module ParsedCertificateInfoRowsComponent
@ -13,11 +14,23 @@ import { parsedParameterKeys } from 'vault/utils/parse-pki-cert-oids';
*
* @param {object} model - object of parsed attributes from parse-pki-cert util
*/
export default class ParsedCertificateInfoRowsComponent extends Component {
interface AttrOptions {
[key: string]: {
label?: string;
formatDate?: string;
};
}
interface Args {
model: ParsedCertificateData;
}
export default class ParsedCertificateInfoRowsComponent extends Component<Args> {
get possibleFields() {
// We show common name elsewhere on the details view, so no need to render it here
const fieldKeys = parsedParameterKeys.filter((k) => k !== 'common_name');
const attrsByKey = {
const attrsByKey: AttrOptions = {
other_sans: { label: 'Other SANs' },
alt_names: { label: 'Subject Alternative Names (SANs)' },
uri_sans: { label: 'URI SANs' },

View File

@ -10,10 +10,10 @@ import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import { waitFor } from '@ember/test-waiters';
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
import FlashMessageService from 'vault/services/flash-messages';
import PkiActionModel from 'vault/models/pki/action';
import errorMessage from 'vault/utils/error-message';
import { ValidationMap } from 'vault/vault/app-types';
import type FlashMessageService from 'vault/services/flash-messages';
import type PkiActionModel from 'vault/models/pki/action';
import type { ValidationMap } from 'vault/vault/app-types';
interface Args {
model: PkiActionModel;

View File

@ -3,18 +3,18 @@
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
import RouterService from '@ember/routing/router-service';
import { service } from '@ember/service';
import { waitFor } from '@ember/test-waiters';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { task } from 'ember-concurrency';
import PkiActionModel from 'vault/models/pki/action';
import PkiUrlsModel from 'vault/models/pki/urls';
import FlashMessageService from 'vault/services/flash-messages';
import errorMessage from 'vault/utils/error-message';
import { ValidationMap } from 'vault/vault/app-types';
import type PkiActionModel from 'vault/models/pki/action';
import type PkiUrlsModel from 'vault/models/pki/urls';
import type FlashMessageService from 'vault/services/flash-messages';
import type RouterService from '@ember/routing/router-service';
import type { ValidationMap } from 'vault/vault/app-types';
interface AdapterOptions {
actionType: string;

View File

@ -7,8 +7,8 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { keyParamsByType } from 'pki/utils/action-params';
import PkiActionModel from 'vault/models/pki/action';
import { ModelValidations } from 'vault/vault/app-types';
import type PkiActionModel from 'vault/models/pki/action';
import type { ModelValidations } from 'vault/vault/app-types';
interface Args {
model: PkiActionModel;

View File

@ -3,15 +3,15 @@
* SPDX-License-Identifier: MPL-2.0
*/
import { action } from '@ember/object';
import Component from '@glimmer/component';
import FlashMessageService from 'vault/services/flash-messages';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';
import { tracked } from '@glimmer/tracking';
import { waitFor } from '@ember/test-waiters';
import errorMessage from 'vault/utils/error-message';
import PkiActionModel from 'vault/models/pki/action';
import type FlashMessageService from 'vault/services/flash-messages';
import type PkiActionModel from 'vault/models/pki/action';
/**
* @module PkiImportPemBundle

View File

@ -7,8 +7,11 @@ import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';
import { tracked } from '@glimmer/tracking';
import errorMessage from 'vault/utils/error-message';
import { waitFor } from '@ember/test-waiters';
import errorMessage from 'vault/utils/error-message';
import type FlashMessageService from 'vault/services/flash-messages';
import type PkiKeyModel from 'vault/models/pki/key';
import type { ValidationMap } from 'vault/app-types';
/**
* @module PkiKeyForm
@ -24,16 +27,21 @@ import { waitFor } from '@ember/test-waiters';
* @callback onSave - Callback triggered on save success.
*/
export default class PkiKeyForm extends Component {
@service flashMessages;
interface Args {
model: PkiKeyModel;
onSave: CallableFunction;
}
@tracked errorBanner;
@tracked invalidFormAlert;
@tracked modelValidations;
export default class PkiKeyForm extends Component<Args> {
@service declare readonly flashMessages: FlashMessageService;
@tracked errorBanner = '';
@tracked invalidFormAlert = '';
@tracked modelValidations: ValidationMap | null = null;
@task
@waitFor
*save(event) {
*save(event: Event) {
event.preventDefault();
try {
const { isNew, keyName } = this.args.model;

View File

@ -3,14 +3,16 @@
* SPDX-License-Identifier: MPL-2.0
*/
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import errorMessage from 'vault/utils/error-message';
import trimRight from 'vault/utils/trim-right';
import { waitFor } from '@ember/test-waiters';
import { inject as service } from '@ember/service';
import trimRight from 'vault/utils/trim-right';
import errorMessage from 'vault/utils/error-message';
import type PkiKeyModel from 'vault/models/pki/key';
import type FlashMessageService from 'vault/services/flash-messages';
/**
* @module PkiKeyImport
@ -25,16 +27,21 @@ import { waitFor } from '@ember/test-waiters';
* @callback onCancel - Callback triggered when cancel button is clicked.
* @callback onSubmit - Callback triggered on submit success.
*/
interface Args {
model: PkiKeyModel;
onSave: CallableFunction;
onCancel: CallableFunction;
}
export default class PkiKeyImport extends Component {
@service flashMessages;
export default class PkiKeyImport extends Component<Args> {
@service declare readonly flashMessages: FlashMessageService;
@tracked errorBanner;
@tracked invalidFormAlert;
@tracked errorBanner = '';
@tracked invalidFormAlert = '';
@task
@waitFor
*submitForm(event) {
*submitForm(event: Event) {
event.preventDefault();
try {
const { keyName } = this.args.model;
@ -48,7 +55,7 @@ export default class PkiKeyImport extends Component {
}
@action
onFileUploaded({ value, filename }) {
onFileUploaded({ value, filename }: { value: string; filename: string }) {
this.args.model.pemBundle = value;
if (!this.args.model.keyName) {
const trimmedFileName = trimRight(filename, ['.json', '.pem']);

View File

@ -1,47 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
/**
* @module PkiKeyParameters
* PkiKeyParameters components are used to display a list of key bit options depending on the selected key type. The key bits field is disabled until a key type is selected.
* If the component renders in a group, other attrs may be passed in and will be rendered using the <FormField> component
* @example
* ```js
* <PkiKeyParameters @model={{@model}} @fields={{fields}}/>
* ```
* @param {class} model - The pki/role model.
* @param {string} fields - Array of attributes from a formFieldGroup generated by the @withFormFields decorator ex: [{ name: 'attrName', type: 'string', options: {...} }]
*/
// first value in array is the default bits for that key type
const KEY_BITS_OPTIONS = {
rsa: ['2048', '3072', '4096', '0'],
ec: ['256', '224', '384', '521', '0'],
ed25519: ['0'],
any: ['0'],
};
export default class PkiKeyParameters extends Component {
get keyBitOptions() {
return KEY_BITS_OPTIONS[this.args.model.keyType];
}
@action handleSelection(name, selection) {
this.args.model[name] = selection;
if (name === 'keyType') {
this.args.model.keyBits = Object.keys(KEY_BITS_OPTIONS).includes(selection)
? KEY_BITS_OPTIONS[selection][0]
: '';
}
}
@action onKeyBitsChange({ target }) {
this.handleSelection(target.name, target.value);
}
}

View File

@ -0,0 +1,67 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
import type PkiRoleModel from 'vault/models/pki/role';
import type PkiKeyModel from 'vault/models/pki/key';
import type PkiActionModel from 'vault/models/pki/action';
import type { HTMLElementEvent } from 'forms';
/**
* @module PkiKeyParameters
* PkiKeyParameters components are used to display a list of key bit options depending on the selected key type. The key bits field is disabled until a key type is selected.
* If the component renders in a group, other attrs may be passed in and will be rendered using the <FormField> component
* @example
* ```js
* <PkiKeyParameters @model={{@model}} @fields={{fields}}/>
* ```
* @param {class} model - The pki/role, pki/action, pki/key model.
* @param {string} fields - Array of attributes from a formFieldGroup generated by the @withFormFields decorator ex: [{ name: 'attrName', type: 'string', options: {...} }]
*/
interface Args {
model: PkiRoleModel | PkiKeyModel | PkiActionModel;
}
interface ModelAttributeName {
keyType: string;
keyBits: string;
}
interface TypeOptions {
rsa: string;
ec: string;
ed25519: string;
any: string;
}
interface BitOptions {
[key: string]: Array<string>;
}
// first value in array is the default bits for that key type
const KEY_BITS_OPTIONS: BitOptions = {
rsa: ['2048', '3072', '4096', '0'],
ec: ['256', '224', '384', '521', '0'],
ed25519: ['0'],
any: ['0'],
};
export default class PkiKeyParameters extends Component<Args> {
get keyBitOptions() {
if (!this.args.model.keyType) return [];
return KEY_BITS_OPTIONS[this.args.model.keyType];
}
@action handleSelection(name: string, selection: string) {
this.args.model[name as keyof ModelAttributeName] = selection;
if (name === 'keyType' && Object.keys(KEY_BITS_OPTIONS)?.includes(selection)) {
const bitOptions = KEY_BITS_OPTIONS[selection as keyof TypeOptions];
this.args.model.keyBits = bitOptions?.firstObject;
}
}
@action onKeyBitsChange(event: HTMLElementEvent<HTMLInputElement>) {
this.handleSelection(event.target.name, event.target.value);
}
}

View File

@ -6,8 +6,8 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { HTMLElementEvent } from 'forms';
import { format } from 'date-fns';
import type { HTMLElementEvent } from 'forms';
/**
* <PkiNotValidAfterForm /> components are used to manage two mutually exclusive role options in the form.

View File

@ -8,6 +8,13 @@ import { inject as service } from '@ember/service';
import { task } from 'ember-concurrency';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import errorMessage from 'vault/utils/error-message';
import type Store from '@ember-data/store';
import type FlashMessageService from 'vault/services/flash-messages';
import type SecretMountPathService from 'vault/services/secret-mount-path';
import type PkiRoleModel from 'vault/models/pki/role';
import type PkiIssuerModel from 'vault/models/pki/issuer';
import type { ValidationMap } from 'vault/app-types';
/**
* @module PkiRoleForm
@ -25,18 +32,24 @@ import { action } from '@ember/object';
* @param {onSave} onSave - Callback triggered on save success.
*/
export default class PkiRoleForm extends Component {
@service store;
@service flashMessages;
@service secretMountPath;
interface Args {
role: PkiRoleModel;
issuers: PkiIssuerModel[];
onSave: CallableFunction;
}
@tracked errorBanner;
@tracked invalidFormAlert;
@tracked modelValidations;
export default class PkiRoleForm extends Component<Args> {
@service declare readonly store: Store;
@service declare readonly flashMessages: FlashMessageService;
@service declare readonly secretMountPath: SecretMountPathService;
@tracked errorBanner = '';
@tracked invalidFormAlert = '';
@tracked modelValidations: ValidationMap | null = null;
@tracked showDefaultIssuer = true;
constructor() {
super(...arguments);
constructor(owner: unknown, args: Args) {
super(owner, args);
this.showDefaultIssuer = this.args.role.issuerRef === 'default';
}
@ -47,20 +60,8 @@ export default class PkiRoleForm extends Component {
});
}
get breadcrumbs() {
const crumbs = [
{ label: 'secrets', route: 'secrets', linkExternal: true },
{ label: this.secretMountPath.currentPath, route: 'overview' },
{ label: 'roles', route: 'roles.index' },
];
if (!this.args.role.isNew) {
crumbs.push({ label: this.args.role.id, route: 'roles.role.details' }, { label: 'edit' });
}
return crumbs;
}
@task
*save(event) {
*save(event: Event) {
event.preventDefault();
try {
const { isValid, state, invalidFormMessage } = this.args.role.validate();
@ -73,8 +74,7 @@ export default class PkiRoleForm extends Component {
this.args.onSave();
}
} catch (error) {
const message = error.errors ? error.errors.join('. ') : error.message;
this.errorBanner = message;
this.errorBanner = errorMessage(error);
this.invalidFormAlert = 'There was an error submitting this form.';
}
}

View File

@ -7,14 +7,14 @@ import Component from '@glimmer/component';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
import { service } from '@ember/service';
import Router from '@ember/routing/router';
import Store from '@ember-data/store';
import { tracked } from '@glimmer/tracking';
import errorMessage from 'vault/utils/error-message';
import FlashMessageService from 'vault/services/flash-messages';
import DownloadService from 'vault/services/download';
import PkiCertificateGenerateModel from 'vault/models/pki/certificate/generate';
import PkiCertificateSignModel from 'vault/models/pki/certificate/sign';
import type Router from '@ember/routing/router';
import type Store from '@ember-data/store';
import type FlashMessageService from 'vault/services/flash-messages';
import type DownloadService from 'vault/services/download';
import type PkiCertificateGenerateModel from 'vault/models/pki/certificate/generate';
import type PkiCertificateSignModel from 'vault/models/pki/certificate/sign';
interface Args {
onSuccess: CallableFunction;

View File

@ -3,16 +3,16 @@
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { service } from '@ember/service';
import { waitFor } from '@ember/test-waiters';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { task } from 'ember-concurrency';
import PkiCertificateSignIntermediate from 'vault/models/pki/certificate/sign-intermediate';
import FlashMessageService from 'vault/services/flash-messages';
import errorMessage from 'vault/utils/error-message';
import { ValidationMap } from 'vault/vault/app-types';
import type PkiCertificateSignIntermediate from 'vault/models/pki/certificate/sign-intermediate';
import type FlashMessageService from 'vault/services/flash-messages';
import type { ValidationMap } from 'vault/vault/app-types';
interface Args {
onCancel: CallableFunction;

26
ui/types/vault/models/pki/key.d.ts vendored Normal file
View File

@ -0,0 +1,26 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Model from '@ember-data/model';
import { ModelValidations } from 'vault/app-types';
export default class PkiKeyModel extends Model {
secretMountPath: class;
keyId: string;
keyName: string;
type: string;
keyType: string;
keyBits: string;
pemBundle: string;
privateKey: string;
isNew: boolean;
get backend(): string;
get canRead(): boolean;
get canEdit(): boolean;
get canDelete(): boolean;
get canGenerateKey(): boolean;
get canImportKey(): boolean;
validate(): ModelValidations;
}

13
ui/types/vault/models/pki/role.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
import Model from '@ember-data/model';
import { FModelValidations } from 'vault/app-types';
export default class PkiRoleModel extends Model {
get useOpenAPI(): boolean;
name: string;
issuerRef: string;
getHelpUrl(backendPath: string): string;
validate(): ModelValidations;
isNew: boolean;
keyType: string;
keyBits: string | undefined;
}