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