-
Notifications
You must be signed in to change notification settings - Fork 3
Provider Configs Table #29
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
Conversation
4e9cc78
to
3924a60
Compare
src/lib/api/useApiResource.ts
Outdated
|
||
const providerConfigsData: ProviderConfigsData[] = crdWithProviderConfig?.map((item) => { | ||
return { | ||
provider: item.metadata.name, |
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.
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.
src/lib/api/useApiResource.ts
Outdated
}); | ||
} | ||
|
||
providerConfigsDataForRequest.forEach(async (item) => { |
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.
The forEach method doesn't handle asynchronous operations properly because it doesn't wait for the promises to resolve before moving on.
You can use something like this:
const promises = providerConfigsDataForRequest.map(async (item) => {
const data = await fetchApiServerJson<ProviderConfigs>(
`/apis/${item.url ?? ''}/${item.version}/providerconfigs`,
apiConfig,
CRDRequest.jq,
CRDRequest.method,
CRDRequest.body
);
if (data) {
providerConfigs.push(data);
}
});
await Promise.all(promises);
providerConfigsList.forEach((provider) => { | ||
provider.items.forEach((config) => { | ||
rows.push({ | ||
parent: provider.provider, |
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.
You sure that you can access this object properties without Optional chaining (?.) operator?
bda676c
to
ae274c8
Compare
providers config table
Moving function to common file
ae274c8
to
1789a22
Compare
Providers config table with temporary solution for getting configs. There are a lot of requests to be made. They are made async.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: