vault/ui/app/forms/ssh/sign.ts
Vault Automation 5a7eb39077
[UI] Ember Data Migration - SSH Role Sign Key and Generate Credential Views | Vault-45234 (#15100) (#15107)
* migrated ssh views - list, detail, create and edit

* adds validation for role name and update test attributes for consistency

* updated sign key attr name in test

* migrated ssh views - list, detail, create and edit

* adds validation for role name and update test attributes for consistency

* updated sign key attr name in test

* moved flat ordering logic to form as per dynamic selection

* Humanized TTL field display value

* Apply suggestions from code review



* fixed prettier issue

* VAULT-45234 - Migrates SSH credential generation and signing components with forms and Api service

* fixed review comments

* Apply suggestions from code review



---------

Co-authored-by: mohit-hashicorp <mohit.ojha@hashicorp.com>
Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com>
2026-06-02 00:45:48 +05:30

49 lines
1.6 KiB
TypeScript

/**
* Copyright IBM Corp. 2016, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
import Form from 'vault/forms/form';
import FormField from 'vault/utils/forms/field';
import FormFieldGroup from 'vault/utils/forms/field-group';
import { Validations } from 'vault/vault/app-types';
interface SshSignData {
public_key: string;
key_id?: string;
valid_principals?: string;
cert_type?: string;
critical_options?: Record<string, unknown>;
extensions?: Record<string, unknown>;
ttl?: string;
}
export default class SshSignForm extends Form<SshSignData> {
get formFieldGroups() {
return [
new FormFieldGroup('default', [
new FormField('public_key', 'string', { label: 'Public key' }),
new FormField('valid_principals', 'string', {
label: 'Valid principals',
helpText:
'Specifies valid principals, either usernames or hostnames, that the certificate should be signed for. Required unless the role has specified allow_empty_principals.',
}),
]),
new FormFieldGroup('More options', [
new FormField('key_id', 'string', { label: 'Key ID' }),
new FormField('cert_type', 'string', {
label: 'Certificate Type',
possibleValues: ['user', 'host'],
defaultValue: 'user',
}),
new FormField('critical_options', 'object', { label: 'Critical Options' }),
new FormField('extensions', 'object', { label: 'Extensions' }),
new FormField('ttl', 'string', { label: 'TTL', editType: 'ttl' }),
]),
];
}
validations: Validations = {
public_key: [{ type: 'presence', message: 'Public Key is required' }],
};
}