Skip to content

Use endpoint to get list of predefined layout variants - #25947

Merged
maxiadlovskii merged 31 commits into
masterfrom
feat/connect-use-layout-vatiants-endpoint
Jun 2, 2026
Merged

Use endpoint to get list of predefined layout variants#25947
maxiadlovskii merged 31 commits into
masterfrom
feat/connect-use-layout-vatiants-endpoint

Conversation

@maxiadlovskii

@maxiadlovskii maxiadlovskii commented May 8, 2026

Copy link
Copy Markdown
Contributor

NOTE: To test the feature, turn on GRAYLOG_FEATURE_SHOW_ALERTS_PREDEFINED_LAYOUTS flag

Description

This PR uses the BE endpoint to get layout variants. After this change, the user can switch between variants. If user change something we also store that to specific variant

Motivation and Context

fix: https://github.com/Graylog2/graylog-plugin-enterprise/issues/14096

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

@maxiadlovskii maxiadlovskii added the e2e-tests Run PR build with e2e tests. label May 18, 2026
@maxiadlovskii
maxiadlovskii marked this pull request as ready for review May 19, 2026 09:10
const url = ({ entityListId }: Props): string => qualifyUrl(`/entitylists/preferences/list_predefined/${entityListId}`);

const fetchLayoutVariants = (props: Props): Promise<Array<LayoutVariant>> =>
fetch('POST', url(props), props.timerange).then((response: Array<LayoutVariantJSON>) =>

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.

Can't we use the API stubs here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added it, but for now, we have a type error; it seems like we need to do some BE work to generate them properly

) : (
<EntityDataTable<T, M>
entities={list}
key={`${tableLayout?.entityTableId}${tableLayout?.layoutVariant}`}

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.

I would really like to avoid this, because it unmounts the complete table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's rendered when we change the layout. Since the layout is likely different, it's not a big problem to rerender it. As we need to reset the inner state of the component (columns order and columns width), that is one of the React recommendations

@maxiadlovskii
maxiadlovskii requested a review from linuspahl May 28, 2026 07:58
@maxiadlovskii maxiadlovskii mentioned this pull request Jun 1, 2026
9 tasks
@maxiadlovskii
maxiadlovskii merged commit f97caa2 into master Jun 2, 2026
24 of 25 checks passed
@maxiadlovskii
maxiadlovskii deleted the feat/connect-use-layout-vatiants-endpoint branch June 2, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e-tests Run PR build with e2e tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants