mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Allow lookup modals to refresh when opened.
This commit is contained in:
@@ -83,6 +83,7 @@ function ApplicationLookup({ onChange, value, label, fieldName, validate }) {
|
|||||||
header={t`Application`}
|
header={t`Application`}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchApplications}
|
||||||
onDebounce={checkApplicationName}
|
onDebounce={checkApplicationName}
|
||||||
fieldName={fieldName}
|
fieldName={fieldName}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ function CredentialLookup({
|
|||||||
value={value}
|
value={value}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchCredentials}
|
||||||
onDebounce={checkCredentialName}
|
onDebounce={checkCredentialName}
|
||||||
fieldName={fieldName}
|
fieldName={fieldName}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ function ExecutionEnvironmentLookup({
|
|||||||
value={value}
|
value={value}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchExecutionEnvironments}
|
||||||
onDebounce={checkExecutionEnvironmentName}
|
onDebounce={checkExecutionEnvironmentName}
|
||||||
fieldName={fieldName}
|
fieldName={fieldName}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ function HostFilterLookup({
|
|||||||
pathname: `${location.pathname}`,
|
pathname: `${location.pathname}`,
|
||||||
search: queryString,
|
search: queryString,
|
||||||
});
|
});
|
||||||
|
fetchHosts(organizationId);
|
||||||
toggleModal();
|
toggleModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ function InstanceGroupsLookup({
|
|||||||
header={t`Instance Groups`}
|
header={t`Instance Groups`}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchInstanceGroups}
|
||||||
fieldName={fieldName}
|
fieldName={fieldName}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
qsConfig={QS_CONFIG}
|
qsConfig={QS_CONFIG}
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ function InventoryLookup({
|
|||||||
header={t`Inventory`}
|
header={t`Inventory`}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchInventories}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
required={required}
|
required={required}
|
||||||
onDebounce={checkInventoryName}
|
onDebounce={checkInventoryName}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ function Lookup(props) {
|
|||||||
fieldName,
|
fieldName,
|
||||||
validate,
|
validate,
|
||||||
modalDescription,
|
modalDescription,
|
||||||
|
onUpdate,
|
||||||
} = props;
|
} = props;
|
||||||
const [typedText, setTypedText] = useState('');
|
const [typedText, setTypedText] = useState('');
|
||||||
const debounceRequest = useDebounce(onDebounce, 1000);
|
const debounceRequest = useDebounce(onDebounce, 1000);
|
||||||
@@ -120,6 +121,11 @@ function Lookup(props) {
|
|||||||
dispatch({ type: 'CLOSE_MODAL' });
|
dispatch({ type: 'CLOSE_MODAL' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClick = () => {
|
||||||
|
onUpdate();
|
||||||
|
dispatch({ type: 'TOGGLE_MODAL' });
|
||||||
|
};
|
||||||
|
|
||||||
const { isModalOpen, selectedItems } = state;
|
const { isModalOpen, selectedItems } = state;
|
||||||
const canDelete =
|
const canDelete =
|
||||||
(!required || (multiple && value.length > 1)) && !isDisabled;
|
(!required || (multiple && value.length > 1)) && !isDisabled;
|
||||||
@@ -137,7 +143,7 @@ function Lookup(props) {
|
|||||||
aria-label={t`Search`}
|
aria-label={t`Search`}
|
||||||
id={`${id}-open`}
|
id={`${id}-open`}
|
||||||
ouiaId={`${id}-open`}
|
ouiaId={`${id}-open`}
|
||||||
onClick={() => dispatch({ type: 'TOGGLE_MODAL' })}
|
onClick={onClick}
|
||||||
variant={ButtonVariant.control}
|
variant={ButtonVariant.control}
|
||||||
isDisabled={isLoading || isDisabled}
|
isDisabled={isLoading || isDisabled}
|
||||||
>
|
>
|
||||||
@@ -223,6 +229,7 @@ Lookup.propTypes = {
|
|||||||
header: string,
|
header: string,
|
||||||
modalDescription: oneOfType([string, node]),
|
modalDescription: oneOfType([string, node]),
|
||||||
onChange: func.isRequired,
|
onChange: func.isRequired,
|
||||||
|
onUpdate: func,
|
||||||
value: oneOfType([Item, arrayOf(Item), object]),
|
value: oneOfType([Item, arrayOf(Item), object]),
|
||||||
multiple: bool,
|
multiple: bool,
|
||||||
required: bool,
|
required: bool,
|
||||||
@@ -255,6 +262,7 @@ Lookup.defaultProps = {
|
|||||||
),
|
),
|
||||||
validate: () => undefined,
|
validate: () => undefined,
|
||||||
onDebounce: () => undefined,
|
onDebounce: () => undefined,
|
||||||
|
onUpdate: () => {},
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ function MultiCredentialsLookup({
|
|||||||
validate={validate}
|
validate={validate}
|
||||||
multiple
|
multiple
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchCredentials}
|
||||||
qsConfig={QS_CONFIG}
|
qsConfig={QS_CONFIG}
|
||||||
isLoading={isTypesLoading || isCredentialsLoading}
|
isLoading={isTypesLoading || isCredentialsLoading}
|
||||||
renderItemChip={renderChip}
|
renderItemChip={renderChip}
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ function OrganizationLookup({
|
|||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onDebounce={checkOrganizationName}
|
onDebounce={checkOrganizationName}
|
||||||
|
onUpdate={fetchOrganizations}
|
||||||
fieldName={fieldName}
|
fieldName={fieldName}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
qsConfig={QS_CONFIG}
|
qsConfig={QS_CONFIG}
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ function ProjectLookup({
|
|||||||
value={value}
|
value={value}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
onUpdate={fetchProjects}
|
||||||
onDebounce={checkProjectName}
|
onDebounce={checkProjectName}
|
||||||
fieldName={fieldName}
|
fieldName={fieldName}
|
||||||
validate={validate}
|
validate={validate}
|
||||||
|
|||||||
Reference in New Issue
Block a user