Skip to content

fix: add w and h to save emit#152

Merged
gkrajniak merged 2 commits into
mainfrom
config-save-bug
May 26, 2026
Merged

fix: add w and h to save emit#152
gkrajniak merged 2 commits into
mainfrom
config-save-bug

Conversation

@Sobyt483
Copy link
Copy Markdown
Contributor

@Sobyt483 Sobyt483 commented May 26, 2026

Summary by CodeRabbit

  • Documentation

    • Clarified dashboard docs: saved edits include card width and height alongside position.
  • Enhancements

    • Cards now persist width and height when edits are saved.
    • Dashboard grid change handling now also tracks card removals and additions.
  • Developer Experience

    • Storybook dashboard story now surfaces the save event for easier inspection.

Review Change Stack

Signed-off-by: Sobyt483 <andrianingomel@gmail.com>
@Sobyt483 Sobyt483 requested review from a team as code owners May 26, 2026 14:45
@Sobyt483 Sobyt483 self-assigned this May 26, 2026
@Sobyt483 Sobyt483 added the bug Something isn't working label May 26, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2122a1c5-4a9d-4b7a-9c3f-e09090911529

📥 Commits

Reviewing files that changed from the base of the PR and between f7d7130 and edd2ad2.

📒 Files selected for processing (5)
  • docs/dashboard.md
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.html
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.spec.ts
  • projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts
  • projects/ngx/declarative-ui/stories/dashboard.stories.ts

📝 Walkthrough

Walkthrough

The Dashboard now captures and persists card dimensions (w,h) alongside positions (x,y), routes GridStack removed/added/change events to a single onGridChange handler that records node geometry, and emits complete card geometry on save. Tests and docs/storybook are updated accordingly.

Changes

Card Dimension Persistence

Layer / File(s) Summary
Card dimension data model
projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts
cardsPosition map now stores optional w and h values alongside x and y.
Event handling and dimension capture
projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.html, projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts
Template event bindings route removedCB, addedCB, and changeCB through onGridChange() which captures node x,y,w,h and updates cardsPosition.
Saving and emitting updated card state
projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.ts
saveEdit() emits card objects including x,y,w,h, using stored cardsPosition values or falling back to card defaults.
Test coverage for dimension persistence
projects/ngx/declarative-ui/dashboard/dashboard/dashboard.component.spec.ts
Mocks and assertions updated to include w/h; tests verify capture, storage, emitted payloads, resize handling, and edit-mode exit behavior.
Documentation and Storybook setup
docs/dashboard.md, projects/ngx/declarative-ui/stories/dashboard.stories.ts
Docs clarify saved payload includes x,y,w,h; Storybook wires (saved) output to an action for inspection.

Sequence Diagram

sequenceDiagram
  participant GridStack
  participant DashboardTemplate
  participant DashboardComponent
  participant CardsPosition
  participant SavedEvent
  
  GridStack->>DashboardTemplate: removedCB/addedCB/changeCB event
  DashboardTemplate->>DashboardComponent: onGridChange($event)
  DashboardComponent->>CardsPosition: saveCardsPosition() reads node (x,y,w,h)
  DashboardComponent->>CardsPosition: store {x,y,w,h} for each card
  
  DashboardComponent->>DashboardComponent: saveEdit() called
  DashboardComponent->>SavedEvent: emit cards with x,y,w,h
  SavedEvent->>DashboardTemplate: (saved) event to parent
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • gkrajniak

Poem

A rabbit nudges tiles in line,
Tracking widths and heights so fine.
Drag or stretch, each change held true,
Saved geometry sings anew. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: adding width and height (w/h) to the save emit event for dashboard cards, which is the core functionality change across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch config-save-bug

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Grzegorz Krajniak <gkrajniak@gmail.com>
@gkrajniak gkrajniak enabled auto-merge (squash) May 26, 2026 20:14
@gkrajniak gkrajniak merged commit ad23d3f into main May 26, 2026
8 of 9 checks passed
@gkrajniak gkrajniak deleted the config-save-bug branch May 26, 2026 20:15
@github-project-automation github-project-automation Bot moved this from In review to Done in OpenMFP Development May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

In the edit view mode while changing the size the width and height not updated.

2 participants