Merge pull request #9642 from mabashian/9640-workflow-output

Only attempt to fetch event options on non workflow jobs

SUMMARY
link #9640
This was fallout from output search filtering.  We need this request for non workflow jobs so that we can build the search options.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

UI

Reviewed-by: Tiago Góes <tiago.goes2009@gmail.com>
This commit is contained in:
softwarefactory-project-zuul[bot] 2021-03-19 21:42:21 +00:00 committed by GitHub
commit 3878d8f7d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,11 +33,15 @@ function Job({ i18n, setBreadcrumb }) {
result: { jobDetail, eventRelatedSearchableKeys, eventSearchableKeys },
} = useRequest(
useCallback(async () => {
let eventOptions = {};
const { data: jobDetailData } = await JobsAPI.readDetail(id, type);
const { data: jobEventOptions } = await JobsAPI.readEventOptions(
id,
type
);
if (jobDetailData.type !== 'workflow_job') {
const { data: jobEventOptions } = await JobsAPI.readEventOptions(
id,
type
);
eventOptions = jobEventOptions;
}
if (
jobDetailData?.summary_fields?.credentials?.find(
cred => cred.kind === 'vault'
@ -54,11 +58,11 @@ function Job({ i18n, setBreadcrumb }) {
return {
jobDetail: jobDetailData,
eventRelatedSearchableKeys: (
jobEventOptions?.related_search_fields || []
eventOptions?.related_search_fields || []
).map(val => val.slice(0, -8)),
eventSearchableKeys: Object.keys(
jobEventOptions.actions?.GET || {}
).filter(key => jobEventOptions.actions?.GET[key].filterable),
eventOptions?.actions?.GET || {}
).filter(key => eventOptions?.actions?.GET[key].filterable),
};
}, [id, type, setBreadcrumb]),
{