New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix application dropdown to fetch resources based on extensions. #7034
Fix application dropdown to fetch resources based on extensions. #7034
Conversation
5df5c15
to
d69f19c
Compare
/retest |
resources={resources} | ||
loaded={loaded} | ||
loadError={loadError} | ||
placeholder={t('devconsole~Select application')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder={t('devconsole~Select application')} | |
placeholder={t('devconsole~Select an application')} |
unsure if we need to take care of localization in this PR 'cause PR #6905 takes care of all the files under dev-console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik, the ask was to make sure any PRs do the i18n work as well in order to help ensure things are not missed.
d69f19c
to
ab14885
Compare
This works fine. However we are severely overfetching resources now. |
!kindsInFlight && | ||
Object.keys(watchResults).length > 0 && | ||
Object.keys(watchResults).every( | ||
(key) => watchResults[key].loaded || watchResults[key].loadError, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need kindsInFlight
? Seems like you can rely on loaded
of the watched resources. kindsInFlight
will include every resource that's currently in flight from anywhere on the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially loaded can return true with load errors for every resource fetched when kindsInFlight
is true. This results in an error being shown briefly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put a fix into useK8sWatchResources
to not set the loaded flag to true when the model is not loaded and kinds are still in flight. @rawagner PTAL
be68ac3
to
6fc7a2d
Compare
/approve @rawagner please have a look at the change to |
@@ -212,7 +212,7 @@ export const useK8sWatchResources = <R extends ResourcesObject>( | |||
} else { | |||
acc[key] = { | |||
data: resources[key].isList ? [] : {}, | |||
loaded: true, | |||
loaded: modelsLoaded, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that everytime we get here we can say that either all models are loaded or all requested models are loaded -
const hasAllModelsLoaded = React.useMemo(() => modelsLoaded || k8sModels.every((m) => !!m), [ |
modelsLoaded
is also missing in dependency array
}, [reduxIDs, JSON.stringify(resources), resourceK8s, noModels]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeff-phillips-18 I guess I see the problem. Can you change hasAllModelsLoaded
to
const hasAllModelsLoaded = React.useMemo(
() => modelsLoaded || Object.values(resources).every((r) => k8sModels.includes(r.kind)),
[k8sModels, modelsLoaded, resources],
);
and revert other changes ? That might help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeff-phillips-18 I've updated my PR #6464 with some more changes which should resolve your issues. Can you try ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rawagner I'll give that a try. I definitely saw instances where all models returned loaded: true
here while modelsLoaded
was false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeff-phillips-18 makes sense, hasAllModelsLoaded
was broken because second part (after or operator) was just wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that fixes the issue I was seeing. Thanks, I will remove my changes to k8s-watch-hook.ts
@jeff-phillips-18 do we wait for the related bug to be fixed or are we sticking with this small fix to the k8s-watch-hook? |
No, we can go in without the change. Just can't update |
6fc7a2d
to
52fb056
Compare
52fb056
to
242d585
Compare
@christianvogt #6464 has merged. This PR should be ready now. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, jeff-phillips-18 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes:
https://issues.redhat.com/browse/ODC-3613
Solution Description:
Use the topology plugin extensions to determine which resource kinds to fetch to then search for existing application groupings.
Browser conformance: