Skip to content

feat: switch the data source to the new backend#336

Open
OlhaTmlk wants to merge 4 commits into
RedHatInsights:masterfrom
OlhaTmlk:backend-migration
Open

feat: switch the data source to the new backend#336
OlhaTmlk wants to merge 4 commits into
RedHatInsights:masterfrom
OlhaTmlk:backend-migration

Conversation

@OlhaTmlk
Copy link
Copy Markdown
Contributor

@OlhaTmlk OlhaTmlk commented May 11, 2026

Description

Adds feature flag-based API routing for the chrome-service → widget-layout backend migration.

  • useApi() hook reads platform.widget-layout.new-backend flag and returns the correct API module
  • Jotai atoms use getApi() from a shared store (can't use hooks)
  • Entry points (Default.tsx, DashboardHub.tsx) sync the flag via <Provider store={store}>
  • landingPage layout type is mapped to landing-landingPage for the new backend

Flag: platform.widget-layout.new-backend — routes API calls to /api/widget-layout/v1/ when enabled, chrome-service endpoints when disabled.

RHCLOUD40885

@OlhaTmlk OlhaTmlk force-pushed the backend-migration branch from a8bcb6d to 2bd2662 Compare May 11, 2026 12:31
@OlhaTmlk OlhaTmlk changed the title feat: add hook for backend toggle and store for atoms feat: switch the data source to the new backend May 11, 2026
@OlhaTmlk OlhaTmlk marked this pull request as ready for review May 11, 2026 12:43
@OlhaTmlk OlhaTmlk requested a review from a team as a code owner May 11, 2026 12:43
Comment thread src/api/dashboard-templates-new.ts Outdated

export const widgetIdSeparator = '#';

export type LayoutTypes = 'landingPage' | 'landing-landingPage';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Now that we will have multiple dashboards, I am wondering if this should be simply a string. And we validate the strings based on what we got back from the API. It should have an endpoint that returns all possible types.

If that endpoint does not exist, it should be a follow-up work instead of blocking this.

};

export const getWidgetIdentifier = (widgetType: string, uniqueId: string = crypto.randomUUID()) => {
return `${widgetType}${widgetIdSeparator}${uniqueId}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just wondering it this unique ID is ever used to do any updates in the backend? Or just for local React purposes. If its used in backend it can't be randomized like this.

@OlhaTmlk OlhaTmlk marked this pull request as draft May 18, 2026 07:38
@OlhaTmlk OlhaTmlk force-pushed the backend-migration branch from f056880 to 89a57de Compare May 18, 2026 07:58
@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

OlhaTmlk commented May 18, 2026

/retest

1 similar comment
@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

/retest

@OlhaTmlk OlhaTmlk marked this pull request as ready for review May 18, 2026 11:50
@OlhaTmlk OlhaTmlk requested a review from Hyperkid123 May 18, 2026 11:50
@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

/retest

Copy link
Copy Markdown
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

When switching to user who has never fetched the data from the new backend, I see a blank dashboard. The data was loaded, and I can see it in the component props, but nothing is rendered.

@OlhaTmlk OlhaTmlk force-pushed the backend-migration branch from ba5a7c0 to 68a7676 Compare May 20, 2026 07:17
@OlhaTmlk OlhaTmlk force-pushed the backend-migration branch from 68a7676 to 021aa2a Compare May 20, 2026 07:22
@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

/retest

@OlhaTmlk
Copy link
Copy Markdown
Contributor Author

/retest

@OlhaTmlk OlhaTmlk requested a review from Hyperkid123 May 20, 2026 11:23
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.

2 participants