Skip to content

[FEATURE] Add panel-level repeat variable model#32

Open
adrianSepiol wants to merge 1 commit into
perses:mainfrom
adrianSepiol:feat/panel-level-repeat
Open

[FEATURE] Add panel-level repeat variable model#32
adrianSepiol wants to merge 1 commit into
perses:mainfrom
adrianSepiol:feat/panel-level-repeat

Conversation

@adrianSepiol

Copy link
Copy Markdown

Related to: perses/perses#2936
Model for repeat variable on panel level.

@adrianSepiol adrianSepiol force-pushed the feat/panel-level-repeat branch from 0c5361e to 0e593be Compare June 1, 2026 17:20
@adrianSepiol adrianSepiol changed the title Feat/panel level repeat [FEATURE] Add panel-level repeat variable model Jun 1, 2026
@adrianSepiol adrianSepiol force-pushed the feat/panel-level-repeat branch 2 times, most recently from 5289d45 to 73a8a20 Compare June 10, 2026 06:53

@ibakshay ibakshay left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thank you for the PR! Added few comments.

Comment thread java/src/main/java/dev/perses/spec/dashboard/Layout.java Outdated
Comment thread ts/src/schema/panel.ts Outdated
Comment thread ts/src/dashboard/panel.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a panel-level “repeat variable” model to the dashboard layout spec so an individual grid item/panel can be repeated based on a variable, and exposes the needed layout fields in the panel editor model.

Changes:

  • Introduces repeatVariable as an object on grid items (TS/Go/Java/CUE) with fields like value, maxPer, and alignment.
  • Extends panel editor values/schema to include a layoutDefinition (width/height + optional repeat variable).
  • Adds Go JSON unmarshal tests for grid items containing the new repeat variable object.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ts/src/schema/panel.ts Adds zod schemas for panel editor layoutDefinition and repeat variable.
ts/src/dashboard/panel.ts Extends exported PanelEditorValues with layoutDefinition.
ts/src/dashboard/layout.ts Adds RepeatVariable model and repeatVariable on GridItemDefinition.
java/src/main/java/dev/perses/spec/dashboard/Layout.java Adds RepeatVariable to GridItem.
go/dashboard/layout.go Adds RepeatVariable structs/types and repeatVariable on GridItem.
go/dashboard/layout_test.go Adds JSON unmarshal test cases for the new repeat variable object.
cue/dashboard/layout_go_gen.cue Updates generated CUE schema to include repeat variable object on grid items.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ts/src/schema/panel.ts
Comment thread ts/src/schema/panel.ts Outdated
Comment thread java/src/main/java/dev/perses/spec/dashboard/Layout.java Outdated
Comment thread go/dashboard/layout.go
Comment thread go/dashboard/layout_test.go
Comment thread ts/src/dashboard/panel.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread ts/src/schema/panel.ts Outdated
Comment thread ts/src/dashboard/panel.ts Outdated
@adrianSepiol adrianSepiol force-pushed the feat/panel-level-repeat branch 2 times, most recently from f88e3d5 to 1da3efd Compare June 11, 2026 12:21
@ibakshay ibakshay requested a review from Copilot June 11, 2026 15:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread go/dashboard/layout.go
Comment thread java/src/main/java/dev/perses/spec/dashboard/Layout.java
Signed-off-by: Adrian Sepiół <a.sepiol@sap.com>
@adrianSepiol adrianSepiol force-pushed the feat/panel-level-repeat branch from 1da3efd to ea0c4d0 Compare June 12, 2026 06:38

@ibakshay ibakshay left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM! @AntoineThebaud Do you also want to have a look?

Comment thread ts/src/schema/panel.ts

export const layoutDefinitionSchema = z.object({
repeatVariable: repeatVariableSchema.optional(),
width: z.number().int().positive(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Panel Editor is only for panel spec, layout is not really handled here (at least currently). Because JSON tab, will only output panel spec, if you do change on layout, nothing will change in JSON. Maybe we need to add two JSON tabs, if we add layout to this editor.
And it's supposing all layouts are using GridItem, that is the case currently. But I don't know if it will always be the case 🤔

After, I don't think it's a better to add a new editor just for layout. And put spec and layout in same editor can be fine.

Ping @Nexucis / @jgbernalp if have strong opinion on this


#RepeatVariable: {
value: string @go(Value)
maxPer?: null | int @go(MaxPer,*int)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

More link to implem than spec, but what happen if there is two panels next to each other without repeat variable. And you enable it on one with maxPer: 2. Will it do 2 rows?

  • 1 panel (without repeat), empty
  • panel repeat, panel repeat

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

maxPer refers to rows inside grid item. By default the grid item will extend it's width to full grid width when setting repeat panel on given item (inspired by grafana) but after that you can change its width and the panels will be fit into rows based on maxPer variable.

demo.mov

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.

4 participants