Skip to content

Use endpoint to get list of predefined layout variants#25947

Open
maxiadlovskii wants to merge 17 commits into
masterfrom
feat/connect-use-layout-vatiants-endpoint
Open

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

Conversation

@maxiadlovskii
Copy link
Copy Markdown
Contributor

@maxiadlovskii maxiadlovskii commented May 8, 2026

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?

) : (
<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

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