Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce add and remove widget functionality to dashboard #6572

Merged
merged 21 commits into from
Aug 27, 2024

Conversation

ugur-vaadin
Copy link
Contributor

Description

Adds add/remove widget functionality to dashboard.

Added API:

  • List<DashboardWidget> getWidgets(): Returns the widgets in the dashboard
  • void add(DashboardWidget... widgets): Adds the given widgets to the dashboard
  • void addWidgetAtIndex(int index, DashboardWidget widget): Adds the given widget to the dashboard at the specific index
  • remove(DashboardWidget... widgets): Removes the given widgets from the dashboard
  • void removeAll(): Removes all widgets from the dashboard

Fixes https://github.com/orgs/vaadin/projects/70/views/1?pane=issue&itemId=74589970

Part of vaadin/platform#6626

Type of change

Feature

@ugur-vaadin
Copy link
Contributor Author

  • differences file

This is due to the spotless formatter configuration. It tries to replace the pro component license text with the regular license text.

@sissbruecker
Copy link
Contributor

sissbruecker commented Aug 23, 2024

@ugur-vaadin Isn't it the other way around? In DashboardElement you use the Apache 2 license, but spotless is configured to use the commercial license. In the other files you have formatting changes that remove an asterisk from the licence header which then also causes errors.

Edit: Running spotless in your branch seems to fix the mentioned files.

@ugur-vaadin
Copy link
Contributor Author

ugur-vaadin commented Aug 23, 2024

@ugur-vaadin Isn't it the other way around? In DashboardElement you use the Apache 2 license, but spotless is configured to use the commercial license. In the other files you have formatting changes that remove an asterisk from the licence header which then also causes errors.

Edit: false alarm

@@ -41,4 +44,18 @@ public String getTitle() {
public void setTitle(String title) {
getElement().setProperty("widgetTitle", title == null ? "" : title);
}

@Override
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this bit so that this can be used to remove the widget from the dashboard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use Dashboard.remove(...).

Copy link

sonarcloud bot commented Aug 27, 2024

@ugur-vaadin ugur-vaadin merged commit 4b76531 into feat/dashboard Aug 27, 2024
4 of 5 checks passed
@ugur-vaadin ugur-vaadin deleted the feat/dashboard-add-remove-widgets branch August 27, 2024 14:05
ugur-vaadin added a commit that referenced this pull request Oct 9, 2024
* feat: introduce add and remove widget functionality to dashboard

* fix: add missing lines and run formatter

* fix: fix compilation error

* chore: run formatter

* test: remove first and last widgets and use clickelementswithjs

* refactor: make remove from parent use removevirtualchild for widgets

* refactor: use append and remove with virtual children and remove from parent before add

* chore: remove unused code

* refactor: merge attach handlers

* refactor: do not try to remove virtual child on detach

* refactor: use widgets list to update detach listeners

* test: add more unit tests for testing node ids on detach

* refactor: use dashboard remove when removing widget from parent

* test: use clickelementwithjs without locating element

* refactor: remove detach listeners

* test: add tests for moving widgets between parents

* test: add unit tests for moving widgets between components

* test: cleanup dashboard widget related unit tests

* refactor: use add remove directly instead of using virtual children

* refactor: simplify removing all widgets by reusing single remove logic

* refactor: override getchildren
ugur-vaadin added a commit that referenced this pull request Oct 10, 2024
* feat: introduce add and remove widget functionality to dashboard

* fix: add missing lines and run formatter

* fix: fix compilation error

* chore: run formatter

* test: remove first and last widgets and use clickelementswithjs

* refactor: make remove from parent use removevirtualchild for widgets

* refactor: use append and remove with virtual children and remove from parent before add

* chore: remove unused code

* refactor: merge attach handlers

* refactor: do not try to remove virtual child on detach

* refactor: use widgets list to update detach listeners

* test: add more unit tests for testing node ids on detach

* refactor: use dashboard remove when removing widget from parent

* test: use clickelementwithjs without locating element

* refactor: remove detach listeners

* test: add tests for moving widgets between parents

* test: add unit tests for moving widgets between components

* test: cleanup dashboard widget related unit tests

* refactor: use add remove directly instead of using virtual children

* refactor: simplify removing all widgets by reusing single remove logic

* refactor: override getchildren
ugur-vaadin added a commit that referenced this pull request Oct 10, 2024
* feat: introduce add and remove widget functionality to dashboard

* fix: add missing lines and run formatter

* fix: fix compilation error

* chore: run formatter

* test: remove first and last widgets and use clickelementswithjs

* refactor: make remove from parent use removevirtualchild for widgets

* refactor: use append and remove with virtual children and remove from parent before add

* chore: remove unused code

* refactor: merge attach handlers

* refactor: do not try to remove virtual child on detach

* refactor: use widgets list to update detach listeners

* test: add more unit tests for testing node ids on detach

* refactor: use dashboard remove when removing widget from parent

* test: use clickelementwithjs without locating element

* refactor: remove detach listeners

* test: add tests for moving widgets between parents

* test: add unit tests for moving widgets between components

* test: cleanup dashboard widget related unit tests

* refactor: use add remove directly instead of using virtual children

* refactor: simplify removing all widgets by reusing single remove logic

* refactor: override getchildren
ugur-vaadin added a commit that referenced this pull request Oct 10, 2024
* feat: introduce add and remove widget functionality to dashboard

* fix: add missing lines and run formatter

* fix: fix compilation error

* chore: run formatter

* test: remove first and last widgets and use clickelementswithjs

* refactor: make remove from parent use removevirtualchild for widgets

* refactor: use append and remove with virtual children and remove from parent before add

* chore: remove unused code

* refactor: merge attach handlers

* refactor: do not try to remove virtual child on detach

* refactor: use widgets list to update detach listeners

* test: add more unit tests for testing node ids on detach

* refactor: use dashboard remove when removing widget from parent

* test: use clickelementwithjs without locating element

* refactor: remove detach listeners

* test: add tests for moving widgets between parents

* test: add unit tests for moving widgets between components

* test: cleanup dashboard widget related unit tests

* refactor: use add remove directly instead of using virtual children

* refactor: simplify removing all widgets by reusing single remove logic

* refactor: override getchildren
ugur-vaadin added a commit that referenced this pull request Oct 15, 2024
* feat: introduce add and remove widget functionality to dashboard

* fix: add missing lines and run formatter

* fix: fix compilation error

* chore: run formatter

* test: remove first and last widgets and use clickelementswithjs

* refactor: make remove from parent use removevirtualchild for widgets

* refactor: use append and remove with virtual children and remove from parent before add

* chore: remove unused code

* refactor: merge attach handlers

* refactor: do not try to remove virtual child on detach

* refactor: use widgets list to update detach listeners

* test: add more unit tests for testing node ids on detach

* refactor: use dashboard remove when removing widget from parent

* test: use clickelementwithjs without locating element

* refactor: remove detach listeners

* test: add tests for moving widgets between parents

* test: add unit tests for moving widgets between components

* test: cleanup dashboard widget related unit tests

* refactor: use add remove directly instead of using virtual children

* refactor: simplify removing all widgets by reusing single remove logic

* refactor: override getchildren
ugur-vaadin added a commit that referenced this pull request Oct 15, 2024
* feat: add dashboard packages (#6548)

* feat: add dashboard packages

* chore: use correct license

* refactor: comment out npm package temporarily

* refactor: add polymer legacy adapter

* chore: remove incorrect npm package

* fix: correct the inverted module names

* chore: add license to pom

* fix: add module to root level pom

* chore: run formatter

* feat: add packages for testbench and integration tests

* fix: update polymer legacy adapter version

* chore: remove unused dependency

* feat: add title API to dashboard widget (#6560)

* feat: add title for widget

* chore: run formatter

* refactor: use properties instead of attributes

* docs: fix the widget title property name

* feat: introduce add and remove widget functionality to dashboard (#6572)

* feat: introduce add and remove widget functionality to dashboard

* fix: add missing lines and run formatter

* fix: fix compilation error

* chore: run formatter

* test: remove first and last widgets and use clickelementswithjs

* refactor: make remove from parent use removevirtualchild for widgets

* refactor: use append and remove with virtual children and remove from parent before add

* chore: remove unused code

* refactor: merge attach handlers

* refactor: do not try to remove virtual child on detach

* refactor: use widgets list to update detach listeners

* test: add more unit tests for testing node ids on detach

* refactor: use dashboard remove when removing widget from parent

* test: use clickelementwithjs without locating element

* refactor: remove detach listeners

* test: add tests for moving widgets between parents

* test: add unit tests for moving widgets between components

* test: cleanup dashboard widget related unit tests

* refactor: use add remove directly instead of using virtual children

* refactor: simplify removing all widgets by reusing single remove logic

* refactor: override getchildren

* test: remove duplicate test and rename tests (#6585)

* fix: handle invalid widget index (#6584)

* feat: implement max col count feature (#6581)

* feat: implement max col count feature

* feat: add getter for maximum column count

* Update vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/Dashboard.java

Co-authored-by: Tomi Virkki <[email protected]>

* Update vaadin-dashboard-flow-parent/vaadin-dashboard-flow/src/main/java/com/vaadin/flow/component/dashboard/Dashboard.java

Co-authored-by: Tomi Virkki <[email protected]>

---------

Co-authored-by: Tomi Virkki <[email protected]>

* feat: add dashboard widget colspan support (#6591)

* feat: add dashboard widget colspan support

* test: add getter for colspan to dashboard widget element

* test: use computed styles for getting colspan from testbench element

* test: add its for getting and updating colspans

* test: updated wording for getting colspan from testbench element

* feat: add max min column width support (#6594)

* feat: add max min column width support

* test: remove its

* feat: add gap support to dashboard (#6596)

* feat: add min row height support to dashboard (#6613)

* feat: add dashboard sections support (#6606)

* feat: add dashboard sections support

* feat: use components to set items on the client side (#6610)

* refactor: restore patching virtual container to fix its

* test: add its that cover more cases updating the client

* refactor: make detach handler implement detach listener

* feat: add content support to dashboard widget (#6618)

* feat: add content related api to dashboard widget

* refactor: make set get content separate from slotted elements

* test: update testbench content to check for all slots

* feat: add content related api to dashboard widget

* refactor: make set get content separate from slotted elements

* test: update testbench content to check for all slots

* chore: run formatter

* test: move tests into appropriate classes

* feat: add rowspan support to dashboard widget (#6624)

* feat: add content related api to dashboard widget

* chore: run formatter

* test: move tests into appropriate classes

* feat: add rowspan support to dashboard widget

* feat: add header support to dashboard widget (#6617)

* feat: add content related api to dashboard widget

* feat: add header support to dashboard widget

* test: fix merge problems

* test: add missing buttons to test page

* feat: support drag drop for dashboard (#6633)

* feat: support drag drop for dashboard

* chore: run formatter

* test: fix unit test assertion

* test: update test route names to align with others

* test: add its that test the server client communication

* refactor: simplify js event workaround

* fix: do not remove widgets on detach

* refactor: remove item sanitization on drag reorder

* refactor: check children of element and remove workaround

* refactor: make dashboard not editable by default

* test: use selenium for drag drop and add tests for editable

* feat: add drag resize support to dashboard (#6643)

* feat: add drag resize support to dashboard

* refactor: make resize events return the item instead of node id

* refactor: return widget instead of component in resize events

* test: simplify resize it page and tests

* feat: support dashboard item remove using button (#6650)

* feat: support dashboard item remove using button

* test: remove tests about visibility of edit buttons

* refactor: do not handle clients events if dashboard is not editable (#6656)

* refactor: make dashboard implement hassize (#6661)

* refactor: throw exception when setting and getting visibility (#6658)

* refactor: throw exception when setting and getting visibility

* refactor: always return true when isvisible is called

* refactor: make section and widget return true for isvisible

* refactor: update events based on web component event changes (#6660)

* refactor: return reordered items and parent from event

* fix: handle the case where drag reorder returns the same items

* chore: remove unused code

* chore: rename incorrectly named test method

* refactor: update events based on web component event changes

* refactor: align event apis with web component

* chore: run formatter

* feat: implement i18n support (#6668)

* feat: implement i18n support

* test: do not check for default values

* refactor: update i18n property names

* docs: update wording for i18n methods

* feat: implement item mode changed events (#6672)

* refactor: use id instead of nodeid in client items array (#6671)

* test: add tests for keyboard move and resize

* fix: only update client items when necessary

* refactor: use id in items array instead of nodeid

* refactor: reintroduce removed client item updates

* refactor: use id instead of nodeid in item state changed events

* refactor: remove unnecessary equality check

* feat: add dense layout support to dashboard (#6678)

* feat: add dense layout support to dashboard

* test: remove dense layout its

* refactor: update dense property name

* chore: update setter wordings

* refactor: rename gap to spacing (#6687)

* refactor: rename gap to spacing

* docs: update spacing api javadocs

* refactor: rename header apis and use header content slot (#6683)

* test: fix tests

* refactor: use latest web components

* test: make test pages larger for consistency

* chore: update dashboard package versions

* fix: update pom versions

* refactor: combine internal remove methods for widget and section

* Update vaadin-dashboard-flow-parent/vaadin-dashboard-flow/pom.xml

Co-authored-by: Sascha Ißbrücker <[email protected]>

* docs: update event descriptions to specify when they are fired

* docs: add descriptions to dashboard classes

* docs: update javadocs to explain the index logic for adding widgets

* Update vaadin-dashboard-flow-parent/vaadin-dashboard-flow-integration-tests/pom.xml

Co-authored-by: Sascha Ißbrücker <[email protected]>

---------

Co-authored-by: Tomi Virkki <[email protected]>
Co-authored-by: Sascha Ißbrücker <[email protected]>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.6.0.alpha1 and is also targeting the upcoming stable 24.6.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants