mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Autopopulate credential on container group form and organization on notification template form
This commit is contained in:
parent
24a4236232
commit
56ed2c6afa
@ -21,7 +21,7 @@ import {
|
||||
import CredentialLookup from '../../../components/Lookup/CredentialLookup';
|
||||
import { VariablesField } from '../../../components/CodeMirrorInput';
|
||||
|
||||
function ContainerGroupFormFields({ i18n }) {
|
||||
function ContainerGroupFormFields({ i18n, instanceGroup }) {
|
||||
const { setFieldValue } = useFormikContext();
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
'credential'
|
||||
@ -57,6 +57,7 @@ function ContainerGroupFormFields({ i18n }) {
|
||||
tooltip={i18n._(
|
||||
t`Credential to authenticate with Kubernetes or OpenShift. Must be of type "Kubernetes/OpenShift API Bearer Token”.`
|
||||
)}
|
||||
autoPopulate={!instanceGroup?.id}
|
||||
/>
|
||||
|
||||
<FormGroup
|
||||
@ -120,7 +121,7 @@ function ContainerGroupForm({
|
||||
{formik => (
|
||||
<Form autoComplete="off" onSubmit={formik.handleSubmit}>
|
||||
<FormColumnLayout>
|
||||
<ContainerGroupFormFields {...rest} />
|
||||
<ContainerGroupFormFields instanceGroup={instanceGroup} {...rest} />
|
||||
{submitError && <FormSubmitError error={submitError} />}
|
||||
<FormActionGroup
|
||||
onCancel={onCancel}
|
||||
|
||||
@ -16,7 +16,7 @@ import CustomMessagesSubForm from './CustomMessagesSubForm';
|
||||
import hasCustomMessages from './hasCustomMessages';
|
||||
import typeFieldNames, { initialConfigValues } from './typeFieldNames';
|
||||
|
||||
function NotificationTemplateFormFields({ i18n, defaultMessages }) {
|
||||
function NotificationTemplateFormFields({ i18n, defaultMessages, template }) {
|
||||
const { setFieldValue } = useFormikContext();
|
||||
const [orgField, orgMeta, orgHelpers] = useField('organization');
|
||||
const [typeField, typeMeta] = useField({
|
||||
@ -56,6 +56,7 @@ function NotificationTemplateFormFields({ i18n, defaultMessages }) {
|
||||
touched={orgMeta.touched}
|
||||
error={orgMeta.error}
|
||||
required
|
||||
autoPopulate={!template?.id}
|
||||
/>
|
||||
<FormGroup
|
||||
fieldId="notification-type"
|
||||
@ -185,6 +186,7 @@ function NotificationTemplateForm({
|
||||
<NotificationTemplateFormFields
|
||||
i18n={i18n}
|
||||
defaultMessages={defaultMessages}
|
||||
template={template}
|
||||
/>
|
||||
<FormSubmitError error={submitError} />
|
||||
<FormActionGroup
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user