Skip to content

Conversation

Hubert-Szczepanski-SAP
Copy link
Contributor

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:

@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP force-pushed the feature/providers-configs-table branch from 4e9cc78 to 3924a60 Compare March 30, 2025 22:37

const providerConfigsData: ProviderConfigsData[] = crdWithProviderConfig?.map((item) => {
return {
provider: item.metadata.name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-03-31 at 10 01 33
Would it be possible to get the providers name in clear text?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Fixed! :) Changes already pushed

lucasgoral
lucasgoral previously approved these changes Apr 2, 2025
});
}

providerConfigsDataForRequest.forEach(async (item) => {
Copy link
Contributor

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,
Copy link
Contributor

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?

@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP force-pushed the feature/providers-configs-table branch from ae274c8 to 1789a22 Compare April 3, 2025 11:12
@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP merged commit 32343cd into main Apr 3, 2025
4 checks passed
@Hubert-Szczepanski-SAP Hubert-Szczepanski-SAP deleted the feature/providers-configs-table branch April 3, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants