mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-15 00:58:37 -05:00
revert MultiCredentialLookup loading jank fix
This commit is contained in:
@@ -37,14 +37,14 @@ function MultiCredentialsLookup(props) {
|
||||
const [selectedType, setSelectedType] = useState(null);
|
||||
const [credentials, setCredentials] = useState([]);
|
||||
const [credentialsCount, setCredentialsCount] = useState(0);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const types = await loadCredentialTypes();
|
||||
setCredentialTypes(types);
|
||||
setSelectedType(types.find(type => type.kind === 'ssh') || types[0]);
|
||||
const match = types.find(type => type.kind === 'ssh') || types[0];
|
||||
setSelectedType(match);
|
||||
} catch (err) {
|
||||
onError(err);
|
||||
}
|
||||
@@ -57,7 +57,6 @@ function MultiCredentialsLookup(props) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const params = parseQueryString(QS_CONFIG, history.location.search);
|
||||
const { results, count } = await loadCredentials(
|
||||
params,
|
||||
@@ -65,14 +64,12 @@ function MultiCredentialsLookup(props) {
|
||||
);
|
||||
setCredentials(results);
|
||||
setCredentialsCount(count);
|
||||
setIsLoading(false);
|
||||
} catch (err) {
|
||||
onError(err);
|
||||
}
|
||||
})();
|
||||
}, [selectedType, history.location.search, onError]);
|
||||
|
||||
const isMultiple = selectedType && selectedType.kind === 'vault';
|
||||
const renderChip = ({ item, removeItem, canDelete }) => (
|
||||
<CredentialChip
|
||||
key={item.id}
|
||||
@@ -82,6 +79,8 @@ function MultiCredentialsLookup(props) {
|
||||
/>
|
||||
);
|
||||
|
||||
const isMultiple = selectedType && selectedType.kind === 'vault';
|
||||
|
||||
return (
|
||||
<FormGroup label={i18n._(t`Credentials`)} fieldId="multiCredential">
|
||||
{tooltip && <FieldTooltip content={tooltip} />}
|
||||
@@ -136,7 +135,6 @@ function MultiCredentialsLookup(props) {
|
||||
name="credentials"
|
||||
qsConfig={QS_CONFIG}
|
||||
readOnly={!canDelete}
|
||||
isLoading={isLoading}
|
||||
selectItem={item => {
|
||||
if (isMultiple) {
|
||||
return dispatch({ type: 'SELECT_ITEM', item });
|
||||
|
||||
Reference in New Issue
Block a user