mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Merge pull request #10597 from AlexSCorey/10547-fix
Fixes missing key values in ad hoc credental step advanced search SUMMARY Resolves #10547 ISSUE TYPE Bugfix Pull Request COMPONENT NAME UI AWX VERSION ADDITIONAL INFORMATION Reviewed-by: Kersom <None> Reviewed-by: Jake McDermott <yo@jakemcdermott.me> Reviewed-by: Sarah Akus <sakus@redhat.com>
This commit is contained in:
commit
62a1eddd1a
@ -153,6 +153,10 @@ describe('<AdHocCommands />', () => {
|
||||
count: 5,
|
||||
},
|
||||
});
|
||||
CredentialsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {} } },
|
||||
});
|
||||
|
||||
ExecutionEnvironmentsAPI.read.mockResolvedValue({
|
||||
data: {
|
||||
results: [
|
||||
@ -310,6 +314,10 @@ describe('<AdHocCommands />', () => {
|
||||
count: 5,
|
||||
},
|
||||
});
|
||||
CredentialsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {} } },
|
||||
});
|
||||
|
||||
ExecutionEnvironmentsAPI.read.mockResolvedValue({
|
||||
data: {
|
||||
results: [
|
||||
|
||||
@ -126,6 +126,9 @@ describe('<AdHocCommandsWizard/>', () => {
|
||||
count: 2,
|
||||
},
|
||||
});
|
||||
CredentialsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {} } },
|
||||
});
|
||||
await waitForElement(wrapper, 'WizardNavItem', el => el.length > 0);
|
||||
|
||||
await act(async () => {
|
||||
@ -245,6 +248,9 @@ describe('<AdHocCommandsWizard/>', () => {
|
||||
},
|
||||
})
|
||||
);
|
||||
CredentialsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {} } },
|
||||
});
|
||||
await waitForElement(wrapper, 'WizardNavItem', el => el.length > 0);
|
||||
|
||||
await act(async () => {
|
||||
|
||||
@ -27,23 +27,45 @@ function AdHocCredentialStep({ credentialTypeId, onEnableLaunch }) {
|
||||
error,
|
||||
isLoading,
|
||||
request: fetchCredentials,
|
||||
result: { credentials, credentialCount },
|
||||
result: {
|
||||
credentials,
|
||||
credentialCount,
|
||||
relatedSearchableKeys,
|
||||
searchableKeys,
|
||||
},
|
||||
} = useRequest(
|
||||
useCallback(async () => {
|
||||
const params = parseQueryString(QS_CONFIG, history.location.search);
|
||||
|
||||
const {
|
||||
data: { results, count },
|
||||
} = await CredentialsAPI.read(
|
||||
mergeParams(params, { credential_type: credentialTypeId })
|
||||
);
|
||||
const [
|
||||
{
|
||||
data: { results, count },
|
||||
},
|
||||
actionsResponse,
|
||||
] = await Promise.all([
|
||||
CredentialsAPI.read(
|
||||
mergeParams(params, { credential_type: credentialTypeId })
|
||||
),
|
||||
CredentialsAPI.readOptions(),
|
||||
]);
|
||||
|
||||
return {
|
||||
credentials: results,
|
||||
credentialCount: count,
|
||||
relatedSearchableKeys: (
|
||||
actionsResponse?.data?.related_search_fields || []
|
||||
).map(val => val.slice(0, -8)),
|
||||
searchableKeys: Object.keys(
|
||||
actionsResponse.data.actions?.GET || {}
|
||||
).filter(key => actionsResponse.data.actions?.GET[key].filterable),
|
||||
};
|
||||
}, [credentialTypeId, history.location.search]),
|
||||
{ credentials: [], credentialCount: 0 }
|
||||
{
|
||||
credentials: [],
|
||||
credentialCount: 0,
|
||||
relatedSearchableKeys: [],
|
||||
searchableKeys: [],
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@ -84,6 +106,8 @@ function AdHocCredentialStep({ credentialTypeId, onEnableLaunch }) {
|
||||
header={t`Machine Credential`}
|
||||
readOnly
|
||||
qsConfig={QS_CONFIG}
|
||||
relatedSearchableKeys={relatedSearchableKeys}
|
||||
searchableKeys={searchableKeys}
|
||||
searchColumns={[
|
||||
{
|
||||
name: t`Name`,
|
||||
|
||||
@ -23,6 +23,9 @@ describe('<AdHocCredentialStep />', () => {
|
||||
count: 2,
|
||||
},
|
||||
});
|
||||
CredentialsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {} } },
|
||||
});
|
||||
await act(async () => {
|
||||
wrapper = mountWithContexts(
|
||||
<Formik>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user