mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-28 10:01:11 +02:00
* adds field group support to forms * adds forms for sync destination types * adds type for sync destination form * adds readonlyParams to sync-destinations helper and error handling to findDestination util * updates sync destinations create/edit routes to use forms * updates sync create-and-edit component to use form class and api service * updates sync destinations tests
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* 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 { commonFields, getPayload } from './shared';
|
|
|
|
import type { SystemWriteSyncDestinationsVercelProjectNameRequest } from '@hashicorp/vault-client-typescript';
|
|
|
|
type VercelProjectFormData = Partial<SystemWriteSyncDestinationsVercelProjectNameRequest>;
|
|
|
|
export default class GcpSmForm extends Form {
|
|
declare data: VercelProjectFormData;
|
|
|
|
formFieldGroups = [
|
|
new FormFieldGroup('default', [
|
|
commonFields.name,
|
|
new FormField('projectId', 'string', {
|
|
label: 'Project ID',
|
|
subText: 'Project ID where to manage environment variables.',
|
|
editDisabled: true,
|
|
}),
|
|
new FormField('teamId', 'string', {
|
|
label: 'Team ID',
|
|
subText: 'Team ID the project belongs to. Optional.',
|
|
}),
|
|
new FormField('deploymentEnvironments', 'string', {
|
|
subText: 'Deployment environments where the environment variables are available.',
|
|
editType: 'checkboxList',
|
|
possibleValues: ['development', 'preview', 'production'],
|
|
}),
|
|
]),
|
|
new FormFieldGroup('Credentials', [
|
|
new FormField('accessToken', 'string', {
|
|
subText: 'Vercel API access token with the permissions to manage environment variables.',
|
|
sensitive: true,
|
|
noCopy: true,
|
|
}),
|
|
]),
|
|
new FormFieldGroup('Advanced configuration', [commonFields.granularity, commonFields.secretNameTemplate]),
|
|
];
|
|
|
|
toJSON() {
|
|
const formState = super.toJSON();
|
|
return { ...formState, data: getPayload('vercel-project', this.data, this.isNew) };
|
|
}
|
|
}
|