mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
enable scm branch ui work
This commit is contained in:
@@ -48,6 +48,7 @@ function InventorySourceDetail({ inventorySource }) {
|
|||||||
source,
|
source,
|
||||||
source_path,
|
source_path,
|
||||||
source_vars,
|
source_vars,
|
||||||
|
scm_branch,
|
||||||
update_cache_timeout,
|
update_cache_timeout,
|
||||||
update_on_launch,
|
update_on_launch,
|
||||||
verbosity,
|
verbosity,
|
||||||
@@ -233,6 +234,11 @@ function InventorySourceDetail({ inventorySource }) {
|
|||||||
helpText={helpText.subFormVerbosityFields}
|
helpText={helpText.subFormVerbosityFields}
|
||||||
value={VERBOSITY()[verbosity]}
|
value={VERBOSITY()[verbosity]}
|
||||||
/>
|
/>
|
||||||
|
<Detail
|
||||||
|
label={t`Scm Branch`}
|
||||||
|
helpText={helpText.sourceControlBranch}
|
||||||
|
value={scm_branch}
|
||||||
|
/>
|
||||||
<Detail
|
<Detail
|
||||||
label={t`Cache timeout`}
|
label={t`Cache timeout`}
|
||||||
value={`${update_cache_timeout} ${t`seconds`}`}
|
value={`${update_cache_timeout} ${t`seconds`}`}
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ const getInventoryHelpTextStrings = () => ({
|
|||||||
},
|
},
|
||||||
enabledVariableField: t`Retrieve the enabled state from the given dict of host variables.
|
enabledVariableField: t`Retrieve the enabled state from the given dict of host variables.
|
||||||
The enabled variable may be specified using dot notation, e.g: 'foo.bar'`,
|
The enabled variable may be specified using dot notation, e.g: 'foo.bar'`,
|
||||||
|
sourceControlBranch: t`Branch to use on inventory sync. Project default used if blank. Only allowed if project allow_override field is set to true.`,
|
||||||
enabledValue: t`This field is ignored unless an Enabled Variable is set. If the enabled variable matches this value, the host will be enabled on import.`,
|
enabledValue: t`This field is ignored unless an Enabled Variable is set. If the enabled variable matches this value, the host will be enabled on import.`,
|
||||||
hostFilter: t`Regular expression where only matching host names will be imported. The filter is applied as a post-processing step after any inventory plugin filters are applied.`,
|
hostFilter: t`Regular expression where only matching host names will be imported. The filter is applied as a post-processing step after any inventory plugin filters are applied.`,
|
||||||
sourceVars: (docsBaseUrl, source) => {
|
sourceVars: (docsBaseUrl, source) => {
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ const InventorySourceFormFields = ({
|
|||||||
source_project: null,
|
source_project: null,
|
||||||
source_script: null,
|
source_script: null,
|
||||||
source_vars: '---\n',
|
source_vars: '---\n',
|
||||||
|
scm_branch: null,
|
||||||
update_cache_timeout: 0,
|
update_cache_timeout: 0,
|
||||||
update_on_launch: false,
|
update_on_launch: false,
|
||||||
verbosity: 1,
|
verbosity: 1,
|
||||||
@@ -248,6 +249,7 @@ const InventorySourceForm = ({
|
|||||||
source_project: source?.summary_fields?.source_project || null,
|
source_project: source?.summary_fields?.source_project || null,
|
||||||
source_script: source?.summary_fields?.source_script || null,
|
source_script: source?.summary_fields?.source_script || null,
|
||||||
source_vars: source?.source_vars || '---\n',
|
source_vars: source?.source_vars || '---\n',
|
||||||
|
scm_branch: source?.scm_branch || '',
|
||||||
update_cache_timeout: source?.update_cache_timeout || 0,
|
update_cache_timeout: source?.update_cache_timeout || 0,
|
||||||
update_on_launch: source?.update_on_launch || false,
|
update_on_launch: source?.update_on_launch || false,
|
||||||
verbosity: source?.verbosity || 1,
|
verbosity: source?.verbosity || 1,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
EnabledVarField,
|
EnabledVarField,
|
||||||
EnabledValueField,
|
EnabledValueField,
|
||||||
HostFilterField,
|
HostFilterField,
|
||||||
|
BranchFormField,
|
||||||
} from './SharedFields';
|
} from './SharedFields';
|
||||||
import getHelpText from '../Inventory.helptext';
|
import getHelpText from '../Inventory.helptext';
|
||||||
|
|
||||||
@@ -36,7 +37,6 @@ const SCMSubForm = ({ autoPopulateProject }) => {
|
|||||||
name: 'source_path',
|
name: 'source_path',
|
||||||
validate: required(t`Select a value for this field`),
|
validate: required(t`Select a value for this field`),
|
||||||
});
|
});
|
||||||
|
|
||||||
const { error: sourcePathError, request: fetchSourcePath } = useRequest(
|
const { error: sourcePathError, request: fetchSourcePath } = useRequest(
|
||||||
useCallback(async (projectId) => {
|
useCallback(async (projectId) => {
|
||||||
const { data } = await ProjectsAPI.readInventories(projectId);
|
const { data } = await ProjectsAPI.readInventories(projectId);
|
||||||
@@ -44,7 +44,6 @@ const SCMSubForm = ({ autoPopulateProject }) => {
|
|||||||
}, []),
|
}, []),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (projectMeta.initialValue) {
|
if (projectMeta.initialValue) {
|
||||||
fetchSourcePath(projectMeta.initialValue.id);
|
fetchSourcePath(projectMeta.initialValue.id);
|
||||||
@@ -68,7 +67,6 @@ const SCMSubForm = ({ autoPopulateProject }) => {
|
|||||||
},
|
},
|
||||||
[fetchSourcePath, setFieldValue, setFieldTouched, sourcePathField.value]
|
[fetchSourcePath, setFieldValue, setFieldTouched, sourcePathField.value]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleCredentialUpdate = useCallback(
|
const handleCredentialUpdate = useCallback(
|
||||||
(value) => {
|
(value) => {
|
||||||
setFieldValue('credential', value);
|
setFieldValue('credential', value);
|
||||||
@@ -76,9 +74,9 @@ const SCMSubForm = ({ autoPopulateProject }) => {
|
|||||||
},
|
},
|
||||||
[setFieldValue, setFieldTouched]
|
[setFieldValue, setFieldTouched]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<BranchFormField label={t`Source Control Branch/Tag/Commit`} />
|
||||||
<CredentialLookup
|
<CredentialLookup
|
||||||
credentialTypeKind="cloud"
|
credentialTypeKind="cloud"
|
||||||
label={t`Credential`}
|
label={t`Credential`}
|
||||||
|
|||||||
@@ -150,3 +150,16 @@ export const HostFilterField = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const BranchFormField = ({ label }) => {
|
||||||
|
const helpText = getHelpText();
|
||||||
|
return (
|
||||||
|
<FormField
|
||||||
|
id="project-scm-branch"
|
||||||
|
name="scm_branch"
|
||||||
|
type="text"
|
||||||
|
label={label}
|
||||||
|
tooltip={helpText.sourceControlBranch}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user