From 19677120b4d32e04a41b3d19089c9431afadd2b2 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Wed, 9 Oct 2024 02:32:36 +0000 Subject: [PATCH 01/51] Update lycheeverse/lychee-action action to v2 --- .github/workflows/broken-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index 96af798..c17c397 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -18,7 +18,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1 + uses: lycheeverse/lychee-action@v2 - name: Find already existing issue id: find-issue From 33b4a73a5e922f9d640e7ff0036059c5b0bd4d59 Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:27:19 +0200 Subject: [PATCH 02/51] Update README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index e113cb9..63c715e 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,29 @@ A simple Vaadin Flow component for filtering Grids. ![demo](assets/demo.png) +> [!NOTE] +> If you are looking for a more advanced component you may check out our [grid-filter](https://github.com/xdev-software/vaadin-grid-filter). + +## Usage + +Here is a very simple example how the FilterComponent can be used: +```java +Grid grid = createGrid(); + +FilterComponent filter = new FilterComponent<>(grid) + .withFilter(new SimpleFilterField<>(Person::getLastName, "Lastname")); + +this.add(filter, grid); +``` + +To get started further it's recommended to have a look at the [demo](./vaadin-simple-grid-filter-demo).
+A description how to get it running can be found [below](#run-the-demo). + +> [!IMPORTANT] +> This component is designed for "in memory" filtering of small to medium sized amounts of data. + +> [!NOTE] +> Filtering multiple thousand items with complex filtering conditions can drastically impact performance and make the UI unresponsive!
In these cases it's recommended to use backend filtering solutions like database queries or search engines like [ElasticSearch](https://en.wikipedia.org/wiki/Elasticsearch) in combination with a customized UI search framework. If you need help in implementing these feel free to [contact us](https://xdev.software/en/services/support). ## Installation [Installation guide for the latest release](https://github.com/xdev-software/vaadin-simple-grid-filter/releases/latest#Installation) From 8c747ff3ff3143693df18be2b3cc101db2458b61 Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:31:12 +0200 Subject: [PATCH 03/51] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63c715e..187f32c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/grid-filter-for-vaadin) +[![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0?logo=vaadin)](https://vaadin.com/directory/component/simple-grid-filter-for-vaadin) [![Latest version](https://img.shields.io/maven-central/v/software.xdev/vaadin-simple-grid-filter?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/vaadin-simple-grid-filter) [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/vaadin-simple-grid-filter/check-build.yml?branch=develop)](https://github.com/xdev-software/vaadin-simple-grid-filter/actions/workflows/check-build.yml?query=branch%3Adevelop) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_vaadin-simple-grid-filter&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_vaadin-simple-grid-filter) From 9c4a76b9528c8e4b206b433084ab2b643bf67113 Mon Sep 17 00:00:00 2001 From: Luis Carrasco Date: Fri, 18 Oct 2024 09:40:40 +0200 Subject: [PATCH 04/51] Added CustomizationDegree. Extended ChipBadgeExtension with new customization degree property. Added the customization degree to the filter component. Adjusted demo. --- .../software/xdev/vaadin/ui/MainView.java | 6 +- .../software/xdev/vaadin/FilterComponent.java | 98 +++++++++++++++++-- .../xdev/vaadin/model/ChipBadgeExtension.java | 12 +++ .../vaadin/model/CustomizationDegree.java | 23 +++++ 4 files changed, 128 insertions(+), 11 deletions(-) create mode 100644 vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java diff --git a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java index 3596c42..f25b9fa 100644 --- a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java +++ b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java @@ -19,6 +19,7 @@ import software.xdev.vaadin.comparators.NotEqualComparator; import software.xdev.vaadin.daterange_picker.business.DateRangeModel; import software.xdev.vaadin.daterange_picker.business.SimpleDateRanges; +import software.xdev.vaadin.model.CustomizationDegree; import software.xdev.vaadin.model.Department; import software.xdev.vaadin.model.Person; import software.xdev.vaadin.model.SimpleFilterField; @@ -85,7 +86,7 @@ private void initUI() .withDatePickerI18n(datePickerI18n) .withDateTimePickerLocale(Locale.GERMANY) .withFilterButtonText("Add filter") - .withUrlParameters("filter1") + // .withUrlParameters("filter1") .withCustomDateRangeModel( new DateRangeModel<>(LocalDate.now(), LocalDate.now().plusDays(5), SimpleDateRanges.FREE), List.of(SimpleDateRanges.allValues())) @@ -100,7 +101,8 @@ private void initUI() EqualComparator.getInstance(), "true", false, - true + true, + CustomizationDegree.INPUT_VALUE ); this.add(filterComponent, this.dataGrid); diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index 0b843b8..c3ac6e8 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -76,6 +76,7 @@ import software.xdev.vaadin.daterange_picker.ui.DateRangePicker; import software.xdev.vaadin.model.ChipBadge; import software.xdev.vaadin.model.ChipBadgeExtension; +import software.xdev.vaadin.model.CustomizationDegree; import software.xdev.vaadin.model.FilterCondition; import software.xdev.vaadin.model.FilterField; import software.xdev.vaadin.model.FilterFieldEnumExtension; @@ -296,9 +297,6 @@ else if(this.selOperations.getValue() != null) private void onShowFilterInput() { - // Needed if the previous condition was an editable initial condition - // The editable initial condition makes the cancel button invisible - this.btnCancelFilter.setVisible(true); if(this.hlFilter.getChildren().findAny().isEmpty()) { @@ -307,8 +305,10 @@ private void onShowFilterInput() this.btnCancelFilter.setVisible(true); this.selFields.setValue(null); + this.selFields.setReadOnly(false); this.selOperations.setItems(Collections.emptyList()); this.selOperations.setEnabled(false); + this.selOperations.setReadOnly(false); this.btnAcceptFilter.setEnabled(false); this.txtSearchQuery.clear(); this.nmbSearchQuery.clear(); @@ -318,7 +318,6 @@ private void onShowFilterInput() this.setInputComponentVisibility(String.class); this.hlFilter.add( - this.selFields, this.selOperations, this.txtSearchQuery, @@ -333,6 +332,30 @@ private void onShowFilterInput() } } + /** + * Method used to make the select field and select condition dependent on the customization degree readonly. + * + * @param usedCustomizationDegree Used to set which input field is readonly. + */ + private void setUsedCustomizationDegreeForComponents(final CustomizationDegree usedCustomizationDegree) + { + if(usedCustomizationDegree.equals(CustomizationDegree.INPUT_VALUE)) + { + this.selFields.setReadOnly(true); + this.selOperations.setReadOnly(true); + } + else if(usedCustomizationDegree.equals(CustomizationDegree.CONDITION_AND_INPUT_VALUE)) + { + this.selFields.setReadOnly(true); + this.selOperations.setReadOnly(false); + } + else + { + this.selFields.setReadOnly(false); + this.selOperations.setReadOnly(false); + } + } + /** * Clicking on the accept filter button. */ @@ -341,6 +364,7 @@ private void onAcceptFilter() final String userInput = this.getValueFromVisibleComponent(); final ChipBadgeExtension> badge; + CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING; final boolean deletable; final boolean editable; @@ -349,6 +373,14 @@ private void onAcceptFilter() { deletable = this.deletingBadgeEnabled; editable = this.editingBadgeEnabled; + + // Get customization rating from initial condition + customizationDegree = this.initialChipBadges + .stream() + .filter(e -> e.getBadgeId().equals(this.editingBadgeId)) + .toList() + .get(0) + .getCustomizationRating(); } else { @@ -361,7 +393,8 @@ private void onAcceptFilter() this.selOperations.getValue(), userInput, deletable, - editable); + editable, + customizationDegree); if(!this.identifier.isBlank()) { @@ -390,7 +423,8 @@ private void onAcceptFilter() final FilterComparator selOperation, final String userInput, final boolean deletableCondition, - final boolean editableCondition) + final boolean editableCondition, + final CustomizationDegree customizationDegree) { final ChipBadgeExtension> badge = new ChipBadgeExtension<>( new FilterCondition<>( @@ -426,6 +460,9 @@ private void onAcceptFilter() // Make the cancel button invisible this.btnCancelFilter.setVisible(false); + // Set the customization rating for the filter select and condition select + this.setUsedCustomizationDegreeForComponents(customizationDegree); + // Just activated when the url parameters are activated if(!this.identifier.isBlank()) { @@ -841,15 +878,30 @@ private void createConditionsFromQueryParameters() { if(!this.queryBadgeIdList.get(i).equals(DELETED_INITIAL_CONDITION_STRING)) { + final String badgeId = this.queryBadgeIdList.get(i); + CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING; + + // Check if it's an initial condition + final List>> cD = this.initialChipBadges + .stream() + .filter(e -> e.getBadgeId().equals(badgeId)) + .toList(); + + if(!cD.isEmpty()) + { + customizationDegree = cD.get(0).getCustomizationRating(); + } + final ChipBadgeExtension> chipBadgeExtension = this.createBadgeConditionAndApplyFilter( filterField, comparatorOptional.get(), this.queryInputFieldList.get(i), Boolean.parseBoolean(this.queryBadgeDeletableList.get(i)), - Boolean.parseBoolean(this.queryBadgeEditableList.get(i))); + Boolean.parseBoolean(this.queryBadgeEditableList.get(i)), + customizationDegree); - chipBadgeExtension.setBadgeId(this.queryBadgeIdList.get(i)); + chipBadgeExtension.setBadgeId(badgeId); } else { @@ -1349,6 +1401,7 @@ public FilterComponent withInitialFilter( final String searchQuery, final boolean conditionDeletable, final boolean conditionEditable, + final CustomizationDegree customizationDegree, final String badgeId) { FilterField finalFilterField = filterField; @@ -1381,11 +1434,14 @@ public FilterComponent withInitialFilter( selectedCondition, searchQuery, conditionDeletable, - conditionEditable); + conditionEditable, + customizationDegree); // Just needed if the url parameters are activated chipBadge.setBadgeId(badgeId); + chipBadge.setCustomizationRating(customizationDegree); + // Needed for resetting the conditions this.initialChipBadges.add(chipBadge); @@ -1414,6 +1470,30 @@ public FilterComponent withInitialFilter( searchQuery, conditionDeletable, conditionEditable, + CustomizationDegree.EVERYTHING, + String.valueOf(this.initialConditionIdCounter)); + + this.initialConditionIdCounter++; + + return filterComponent; + } + + public FilterComponent withInitialFilter( + final FilterField filterField, + final FilterComparator selectedCondition, + final String searchQuery, + final boolean conditionDeletable, + final boolean conditionEditable, + final CustomizationDegree customizationDegree) + { + final FilterComponent filterComponent = + this.withInitialFilter( + filterField, + selectedCondition, + searchQuery, + conditionDeletable, + conditionEditable, + customizationDegree, String.valueOf(this.initialConditionIdCounter)); this.initialConditionIdCounter++; diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java index de5049a..80a2a7f 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/ChipBadgeExtension.java @@ -30,6 +30,8 @@ public class ChipBadgeExtension extends ChipBadge protected final Button btnEdit = new Button(VaadinIcon.PENCIL.create()); + private CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING; + public ChipBadgeExtension(final T item) { super(item); @@ -76,6 +78,16 @@ public boolean isBtnDeleteEnabled() return this.btnDelete.isEnabled(); } + public CustomizationDegree getCustomizationRating() + { + return this.customizationDegree; + } + + public void setCustomizationRating(final CustomizationDegree customizationDegree) + { + this.customizationDegree = customizationDegree; + } + public Registration addBtnEditClickListener(final ComponentEventListener> listener) { return this.btnEdit.addClickListener(listener); diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java new file mode 100644 index 0000000..7e66581 --- /dev/null +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java @@ -0,0 +1,23 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.vaadin.model; + +public enum CustomizationDegree +{ + EVERYTHING, + CONDITION_AND_INPUT_VALUE, + INPUT_VALUE +} From d79050cf15b11cbfa169377e0202a59944abf4dd Mon Sep 17 00:00:00 2001 From: Luis Carrasco Date: Fri, 18 Oct 2024 10:07:36 +0200 Subject: [PATCH 05/51] Added doc in CustomizationDegree. Removed commented line of code in demo. --- .../src/main/java/software/xdev/vaadin/ui/MainView.java | 2 +- .../java/software/xdev/vaadin/model/CustomizationDegree.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java index f25b9fa..457daff 100644 --- a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java +++ b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/ui/MainView.java @@ -86,7 +86,7 @@ private void initUI() .withDatePickerI18n(datePickerI18n) .withDateTimePickerLocale(Locale.GERMANY) .withFilterButtonText("Add filter") - // .withUrlParameters("filter1") + .withUrlParameters("filter1") .withCustomDateRangeModel( new DateRangeModel<>(LocalDate.now(), LocalDate.now().plusDays(5), SimpleDateRanges.FREE), List.of(SimpleDateRanges.allValues())) diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java index 7e66581..8e5f23f 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/model/CustomizationDegree.java @@ -15,6 +15,9 @@ */ package software.xdev.vaadin.model; +/** + * When editing a condition, the developer can specify how much of the condition can be edited. + */ public enum CustomizationDegree { EVERYTHING, From 05bb267832a3159afc2ba13e7116912e73f4b495 Mon Sep 17 00:00:00 2001 From: Luis Carrasco Date: Fri, 18 Oct 2024 10:52:22 +0200 Subject: [PATCH 06/51] The variables for saving the state of a condition if it was editable/deletable before editing are now used even if url parameters are not enabled. --- .../software/xdev/vaadin/FilterComponent.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index 0b843b8..fb57933 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -344,11 +344,13 @@ private void onAcceptFilter() final boolean deletable; final boolean editable; - // Check if it's an initial condition - if(this.editingBadgeId != null && !this.editingBadgeId.equals(NO_BADGE_ID_STRING)) + if(this.deletingBadgeEnabled != null && this.editingBadgeEnabled != null) { deletable = this.deletingBadgeEnabled; editable = this.editingBadgeEnabled; + + this.deletingBadgeEnabled = null; + this.editingBadgeEnabled = null; } else { @@ -426,13 +428,14 @@ private void onAcceptFilter() // Make the cancel button invisible this.btnCancelFilter.setVisible(false); - // Just activated when the url parameters are activated + // Needed to save state of the condition if it was editable/deletable before editing + this.editingBadgeEnabled = badge.isBtnEditEnabled(); + this.deletingBadgeEnabled = badge.isBtnDeleteEnabled(); + + // Just activated when the url parameters are enabled if(!this.identifier.isBlank()) { this.editingBadgeId = badge.getBadgeId(); - // Needed for the acceptFilterBtn - this.editingBadgeEnabled = badge.isBtnEditEnabled(); - this.deletingBadgeEnabled = badge.isBtnDeleteEnabled(); } // Remove filter, update grid From 1435036aa4bdeeba8a16af10f15dcea97798841b Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 18 Oct 2024 11:19:44 +0200 Subject: [PATCH 07/51] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d5441b..6f5bc13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,6 @@ +# 1.0.1 +* Added customization degree + * Makes it possible that certain filters or parts of them are read-only + # 1.0.0 _Initial release_ From d2e35652bf9f13d4c9355bff4f4b2d109fe4c776 Mon Sep 17 00:00:00 2001 From: Luis Carrasco Date: Fri, 18 Oct 2024 11:34:26 +0200 Subject: [PATCH 08/51] Modified query parameter construction in the addQueryParameter method. --- .../software/xdev/vaadin/FilterComponent.java | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index c3ac6e8..ff0d08c 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -64,6 +64,7 @@ import com.vaadin.flow.data.value.ValueChangeMode; import com.vaadin.flow.router.BeforeEnterEvent; import com.vaadin.flow.router.BeforeEnterObserver; +import com.vaadin.flow.router.Location; import com.vaadin.flow.router.QueryParameters; import software.xdev.vaadin.builder.CustomizableFilterBuilder; @@ -1303,11 +1304,17 @@ private void addQueryParameter(final ChipBadgeExtension> c this.ui.getPage().fetchCurrentURL(currentUrl -> { - String separator = "?"; + final String questionMarkCharacter = "?"; + String querySeperator = ""; + String currentQuery = currentUrl.getQuery(); - if(currentUrl.getQuery() != null) + if(currentQuery != null) + { + querySeperator = "&"; + } + else { - separator = "&"; + currentQuery = ""; } this.ui @@ -1315,14 +1322,17 @@ private void addQueryParameter(final ChipBadgeExtension> c .getHistory() .replaceState( null, - currentUrl - + separator - + QueryParameterUtil.createQueryParameterString( - this.identifier, - filterCondition, - chipBadge.getBadgeId(), - chipBadge.isBtnDeleteEnabled(), - chipBadge.isBtnEditEnabled())); + new Location( + currentUrl.getPath() + + questionMarkCharacter + + currentQuery + + querySeperator + + QueryParameterUtil.createQueryParameterString( + this.identifier, + filterCondition, + chipBadge.getBadgeId(), + chipBadge.isBtnDeleteEnabled(), + chipBadge.isBtnEditEnabled()))); }); } From 3e566095ec3502aa437da9da3b113e715884663a Mon Sep 17 00:00:00 2001 From: Luis Carrasco Date: Fri, 18 Oct 2024 11:59:05 +0200 Subject: [PATCH 09/51] Adjusted doc. Added FilterComponentUtl. The reset button will now be deactivated if the initial state was restored. --- .../software/xdev/vaadin/FilterComponent.java | 22 ++++++- .../xdev/vaadin/utl/FilterComponentUtl.java | 62 +++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index c3ac6e8..859ec84 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -81,6 +81,7 @@ import software.xdev.vaadin.model.FilterField; import software.xdev.vaadin.model.FilterFieldEnumExtension; import software.xdev.vaadin.model.SimpleFilterField; +import software.xdev.vaadin.utl.FilterComponentUtl; import software.xdev.vaadin.utl.QueryParameterUtil; @@ -515,8 +516,23 @@ private void deactivateDeleteButtonFromChipComponents( this.addQueryParameter(badge); } - // Activate the reset button - this.btnResetFilter.setEnabled(true); + // When no initial filter is existing + if(this.initialChipBadges.isEmpty() && this.chipBadges.isEmpty()) + { + this.btnResetFilter.setEnabled(false); + } + else + { + final List>> initialChipBadgesCopy + = new ArrayList<>(this.initialChipBadges); + final List>> chipBadgesCopy + = new ArrayList<>(this.chipBadges); + + // Check if just the initial filter are currently applied. Then enable/disable the reset button as + // appropriate. + this.btnResetFilter.setEnabled( + !new FilterComponentUtl().equalLists(initialChipBadgesCopy, chipBadgesCopy)); + } }); } } @@ -1289,7 +1305,7 @@ private String createMultipleQueryParameterString() /** * Method for adding a specific filter condition as query parameter. * - * @param filterCondition The condition which should be converted to query parameter. + * @param chipBadge The condition which should be converted to query parameter. */ private void addQueryParameter(final ChipBadgeExtension> chipBadge) { diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java new file mode 100644 index 0000000..26b62de --- /dev/null +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java @@ -0,0 +1,62 @@ +/* + * Copyright © 2024 XDEV Software (https://xdev.software) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package software.xdev.vaadin.utl; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +import software.xdev.vaadin.model.ChipBadge; +import software.xdev.vaadin.model.ChipBadgeExtension; +import software.xdev.vaadin.model.FilterCondition; + + +public final class FilterComponentUtl +{ + public FilterComponentUtl() + { + } + + /** + * Check if the lists contains the same chip badges objects + * + * @param one List one + * @param two List two + * @return True if the lists contains the same objects + */ + public boolean equalLists( + final List>> one, + final List>> two) + { + if(one == null && two == null) + { + return true; + } + + if(one == null || two == null || one.size() != two.size()) + { + return false; + } + + // to avoid messing the order of the lists we will use a copy + final List>> oneCopy = new ArrayList<>(one); + final List>> twoCopy = new ArrayList<>(two); + + oneCopy.sort(Comparator.comparing(ChipBadge::getBadgeId)); + twoCopy.sort(Comparator.comparing(ChipBadge::getBadgeId)); + return one.equals(two); + } +} From e72c4f5fd4a4c7ef2ea693b50b5b6bc1b1f4b67e Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 18 Oct 2024 14:04:25 +0200 Subject: [PATCH 10/51] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f5bc13..aeeba3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # 1.0.1 * Added customization degree * Makes it possible that certain filters or parts of them are read-only +* Correctly set url when handling query parameters # 1.0.0 _Initial release_ From 029bf2fcedbcfd9186ce49a8de7a7ab7c3b09ea6 Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 21 Oct 2024 08:56:12 +0200 Subject: [PATCH 11/51] Don't fail on broken links --- .github/workflows/broken-links.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index c17c397..48265e8 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -19,6 +19,8 @@ jobs: - name: Link Checker id: lychee uses: lycheeverse/lychee-action@v2 + with: + fail: false # Don't fail on broken links, create an issue instead - name: Find already existing issue id: find-issue From 9ad20ee188ec4d6f55b3ae187386009ed58a8f81 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 22 Oct 2024 02:34:23 +0000 Subject: [PATCH 12/51] Update dependency org.apache.maven.plugins:maven-project-info-reports-plugin to v3.8.0 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index fa36839..e963c1b 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -95,7 +95,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.7.0 + 3.8.0 From 009f795f2baf9ac819c4891d297ae5cc2c78534a Mon Sep 17 00:00:00 2001 From: Alex B <45384811+AB-xdev@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:04:20 +0200 Subject: [PATCH 13/51] Initial commit --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From efcd43e6d935ffb84ea540561128bc5173923517 Mon Sep 17 00:00:00 2001 From: AB Date: Thu, 24 Oct 2024 14:14:33 +0200 Subject: [PATCH 14/51] Init --- .gitattributes | 5 + .github/.lycheeignore | 2 + .github/ISSUE_TEMPLATE/bug_report.yml | 68 +++++ .github/ISSUE_TEMPLATE/config.yml | 4 + .github/ISSUE_TEMPLATE/enhancement.yml | 32 +++ .github/ISSUE_TEMPLATE/question.yml | 31 ++ .github/labels.yml | 38 +++ .github/workflows/broken-links.yml | 45 +++ .github/workflows/sync-labels.yml | 24 ++ .github/workflows/update-from-template.yml | 318 +++++++++++++++++++++ CHANGELOG.md | 0 LICENSE | 2 +- SECURITY.md | 5 + renovate.json5 | 4 + 14 files changed, 577 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 .github/.lycheeignore create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/enhancement.yml create mode 100644 .github/ISSUE_TEMPLATE/question.yml create mode 100644 .github/labels.yml create mode 100644 .github/workflows/broken-links.yml create mode 100644 .github/workflows/sync-labels.yml create mode 100644 .github/workflows/update-from-template.yml create mode 100644 CHANGELOG.md create mode 100644 SECURITY.md create mode 100644 renovate.json5 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0f9f33e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Force sh files to have LF +*.sh text eol=lf diff --git a/.github/.lycheeignore b/.github/.lycheeignore new file mode 100644 index 0000000..972ca61 --- /dev/null +++ b/.github/.lycheeignore @@ -0,0 +1,2 @@ +# Ignorefile for broken link check +localhost diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..68299d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,68 @@ +name: 🐞 Bug +description: Create a bug report for something that is broken +labels: [bug] +body: + - type: markdown + attributes: + value: | + Thank you for reporting a bug. + + Please fill in as much information as possible about your bug so that we don't have to play "information ping-pong" and can help you immediately. + + - type: checkboxes + id: checklist + attributes: + label: "Checklist" + options: + - label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)" + required: true + - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." + required: true + - label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise." + required: true + - label: "This issue contains only one bug." + required: true + + - type: input + id: app-version + attributes: + label: Affected version + description: "In which version did you encounter the bug?" + placeholder: "x.x.x" + validations: + required: true + + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to reproduce the bug + description: | + What did you do for the bug to show up? + + If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug. + placeholder: | + 1. Use '...' + 2. Do '...' + validations: + required: true + + - type: textarea + id: expected-behavior + attributes: + label: Expected behavior + description: | + Tell us what you expect to happen. + + - type: textarea + id: actual-behavior + attributes: + label: Actual behavior + description: | + Tell us what happens with the steps given above. + + - type: textarea + id: additional-information + attributes: + label: Additional information + description: | + Any other relevant information you'd like to include diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..b6fb79b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: 💬 Contact support + url: https://xdev.software/en/services/support + about: "If you need support as soon as possible or/and you can't wait for any pull request" diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml new file mode 100644 index 0000000..7523129 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement.yml @@ -0,0 +1,32 @@ +name: ✨ Feature/Enhancement +description: Suggest a new feature or enhancement +labels: [enhancement] +body: + - type: markdown + attributes: + value: | + Thank you for suggesting a new feature/enhancement. + + - type: checkboxes + id: checklist + attributes: + label: "Checklist" + options: + - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." + required: true + - label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise." + required: true + - label: "This issue contains only one feature request/enhancement." + required: true + + - type: textarea + id: description + attributes: + label: Description + validations: + required: true + + - type: textarea + id: additional-information + attributes: + label: Additional information diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..6ecd6ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,31 @@ +name: ❓ Question +description: Ask a question +labels: [question] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this form! + + - type: checkboxes + id: checklist + attributes: + label: "Checklist" + options: + - label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to." + required: true + - label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise." + required: true + + - type: textarea + id: what-is-the-question + attributes: + label: What is/are your question(s)? + validations: + required: true + + - type: textarea + id: additional-information + attributes: + label: Additional information + description: "Any other information you'd like to include - for instance logs, screenshots, etc." diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..325f4ce --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,38 @@ +# Default +## Required for template +- name: bug + description: "Something isn't working" + color: 'd73a4a' +- name: enhancement + description: New feature or request + color: '#a2eeef' +- name: question + description: Information is requested + color: '#d876e3' +## Others +- name: duplicate + description: This already exists + color: '#cfd3d7' +- name: good first issue + description: Good for newcomers + color: '#7057ff' +- name: help wanted + description: Extra attention is needed + color: '#008672' +- name: invalid + description: "This doesn't seem right" + color: '#e4e669' +# Custom +- name: automated + description: Created by an automation + color: '#000000' +- name: "can't reproduce" + color: '#e95f2c' +- name: customer-requested + description: Was requested by a customer of us + color: '#068374' +- name: stale + color: '#ededed' +- name: waiting-for-response + description: If no response is received after a certain time the issue will be closed + color: '#202020' diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml new file mode 100644 index 0000000..48265e8 --- /dev/null +++ b/.github/workflows/broken-links.yml @@ -0,0 +1,45 @@ +name: Broken links + +on: + workflow_dispatch: + schedule: + - cron: "23 23 * * 0" + +permissions: + issues: write + +jobs: + link-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: mv .github/.lycheeignore .lycheeignore + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: false # Don't fail on broken links, create an issue instead + + - name: Find already existing issue + id: find-issue + run: | + echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title \"Link Checker Report\"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ github.token }} + + - name: Close issue if everything is fine + if: env.lychee_exit_code == 0 && steps.find-issue.outputs.number != '' + run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }} + env: + GH_TOKEN: ${{ github.token }} + + - name: Create Issue From File + if: env.lychee_exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + issue-number: ${{ steps.find-issue.outputs.number }} + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: bug, automated diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml new file mode 100644 index 0000000..ff880f0 --- /dev/null +++ b/.github/workflows/sync-labels.yml @@ -0,0 +1,24 @@ +name: Sync labels + +on: + push: + branches: develop + paths: + - .github/labels.yml + + workflow_dispatch: + +permissions: + issues: write + +jobs: + labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: .github/labels.yml + + - uses: EndBug/label-sync@v2 + with: + config-file: .github/labels.yml diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml new file mode 100644 index 0000000..3ad8e88 --- /dev/null +++ b/.github/workflows/update-from-template.yml @@ -0,0 +1,318 @@ +name: Update from Template + +# This workflow keeps the repo up to date with changes from the template repo (REMOTE_URL) +# It duplicates the REMOTE_BRANCH (into UPDATE_BRANCH) and tries to merge it into +# this repos default branch (which is checked out here) +# Note that this requires a PAT (Personal Access Token) - at best from a servicing account +# PAT permissions: read:discussion, read:org, repo, workflow +# Also note that you should have at least once merged the template repo into the current repo manually +# otherwise a "refusing to merge unrelated histories" error might occur. + +on: + schedule: + - cron: '55 2 * * 1' + workflow_dispatch: + inputs: + no_automatic_merge: + type: boolean + description: 'No automatic merge' + default: false + +env: + UPDATE_BRANCH: update-from-template + UPDATE_BRANCH_MERGED: update-from-template-merged + REMOTE_URL: https://github.com/xdev-software/base-template.git + REMOTE_BRANCH: master + +permissions: + contents: write + pull-requests: write + +jobs: + update: + runs-on: ubuntu-latest + outputs: + update_branch_merged_commit: ${{ steps.manage-branches.outputs.update_branch_merged_commit }} + create_update_branch_merged_pr: ${{ steps.manage-branches.outputs.create_update_branch_merged_pr }} + steps: + - uses: actions/checkout@v4 + with: + # Required because otherwise there are always changes detected when executing diff/rev-list + fetch-depth: 0 + # If no PAT is used the following error occurs on a push: + # refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission + token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + + - name: Init Git + run: | + git config --global user.email "111048771+xdev-gh-bot@users.noreply.github.com" + git config --global user.name "XDEV Bot" + + - name: Manage branches + id: manage-branches + run: | + echo "Adding remote template-repo" + git remote add template ${{ env.REMOTE_URL }} + + echo "Fetching remote template repo" + git fetch template + + echo "Deleting local branches that will contain the updates - if present" + git branch -D ${{ env.UPDATE_BRANCH }} || true + git branch -D ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "Checking if the remote template repo has new commits" + git rev-list ..template/${{ env.REMOTE_BRANCH }} + + if [ $(git rev-list --count ..template/${{ env.REMOTE_BRANCH }}) -eq 0 ]; then + echo "There are no commits new commits on the template repo" + + echo "Deleting origin branch(es) that contain the updates - if present" + git push -f origin --delete ${{ env.UPDATE_BRANCH }} || true + git push -f origin --delete ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "create_update_branch_pr=0" >> $GITHUB_OUTPUT + echo "create_update_branch_merged_pr=0" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Found new commits on the template repo" + + echo "Creating update branch" + git branch ${{ env.UPDATE_BRANCH }} template/${{ env.REMOTE_BRANCH }} + git branch --unset-upstream ${{ env.UPDATE_BRANCH }} + + echo "Pushing update branch" + git push -f -u origin ${{ env.UPDATE_BRANCH }} + + echo "Getting base branch" + base_branch=$(git branch --show-current) + echo "Base branch is $base_branch" + echo "base_branch=$base_branch" >> $GITHUB_OUTPUT + + echo "Trying to create auto-merged branch ${{ env.UPDATE_BRANCH_MERGED }}" + git branch ${{ env.UPDATE_BRANCH_MERGED }} ${{ env.UPDATE_BRANCH }} + git checkout ${{ env.UPDATE_BRANCH_MERGED }} + + echo "Merging branch $base_branch into ${{ env.UPDATE_BRANCH_MERGED }}" + git merge $base_branch && merge_exit_code=$? || merge_exit_code=$? + if [ $merge_exit_code -ne 0 ]; then + echo "Auto merge failed! Manual merge required" + echo "::notice ::Auto merge failed - Manual merge required" + + echo "Cleaning up failed merge" + git merge --abort + git checkout $base_branch + git branch -D ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "Deleting auto-merge branch - if present" + git push -f origin --delete ${{ env.UPDATE_BRANCH_MERGED }} || true + + echo "create_update_branch_pr=1" >> $GITHUB_OUTPUT + echo "create_update_branch_merged_pr=0" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Post processing: Trying to automatically fill in template variables" + find . -type f \ + -not -path "./.git/**" \ + -not -path "./.github/workflows/update-from-template.yml" -print0 \ + | xargs -0 sed -i "s/template-placeholder/${GITHUB_REPOSITORY#*/}/g" + + git status + git add --all + + if [[ "$(git status --porcelain)" != "" ]]; then + echo "Filled in template; Committing" + + git commit -m "Fill in template" + fi + + echo "Pushing auto-merged branch" + git push -f -u origin ${{ env.UPDATE_BRANCH_MERGED }} + + echo "update_branch_merged_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT + + echo "Restoring base branch $base_branch" + git checkout $base_branch + + echo "create_update_branch_pr=0" >> $GITHUB_OUTPUT + echo "create_update_branch_merged_pr=1" >> $GITHUB_OUTPUT + echo "try_close_update_branch_pr=1" >> $GITHUB_OUTPUT + + - name: Create/Update PR update_branch + if: steps.manage-branches.outputs.create_update_branch_pr == 1 + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + gh_pr_up() { + gh pr create -H "${{ env.UPDATE_BRANCH }}" "$@" || (git checkout "${{ env.UPDATE_BRANCH }}" && gh pr edit "$@") + } + gh_pr_up -B "${{ steps.manage-branches.outputs.base_branch }}" \ + --title "Update from template" \ + --body "An automated PR to sync changes from the template into this repo" + + # Ensure that only a single PR is open (otherwise confusion and spam) + - name: Close PR update_branch + if: steps.manage-branches.outputs.try_close_update_branch_pr == 1 + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + gh pr close "${{ env.UPDATE_BRANCH }}" || true + + - name: Create/Update PR update_branch_merged + if: steps.manage-branches.outputs.create_update_branch_merged_pr == 1 + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + gh_pr_up() { + gh pr create -H "${{ env.UPDATE_BRANCH_MERGED }}" "$@" || (git checkout "${{ env.UPDATE_BRANCH_MERGED }}" && gh pr edit "$@") + } + gh_pr_up -B "${{ steps.manage-branches.outputs.base_branch }}" \ + --title "Update from template (auto-merged)" \ + --body "An automated PR to sync changes from the template into this repo" + + # Wait a moment so that checks of PR have higher prio than following job + sleep 3 + + # Split into two jobs to help with executor starvation + auto-merge: + needs: [update] + if: needs.update.outputs.create_update_branch_merged_pr == 1 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # Required because otherwise there are always changes detected when executing diff/rev-list + fetch-depth: 0 + # If no PAT is used the following error occurs on a push: + # refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission + token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + + - name: Init Git + run: | + git config --global user.email "111048771+xdev-gh-bot@users.noreply.github.com" + git config --global user.name "XDEV Bot" + + - name: Checking if auto-merge for PR update_branch_merged can be done + id: auto-merge-check + env: + GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} + run: | + not_failed_conclusion="skipped|neutral|success" + not_relevant_app_slug="dependabot|github-pages|sonarcloud" + + echo "Waiting for checks to start..." + sleep 40s + + for i in {1..20}; do + echo "Checking if PR can be auto-merged. Try: $i" + + echo "Checking if update-branch-merged exists" + git fetch + if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then + echo "Branch still exists; Continuing..." + else + echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing" + exit 0 + fi + + echo "Fetching checks" + cs_response=$(curl -sL \ + --fail-with-body \ + --connect-timeout 60 \ + --max-time 120 \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GH_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/commits/${{ needs.update.outputs.update_branch_merged_commit }}/check-suites) + + cs_data=$(echo $cs_response | jq '.check_suites[] | { conclusion: .conclusion, slug: .app.slug, check_runs_url: .check_runs_url }') + echo $cs_data + + if [[ -z "$cs_data" ]]; then + echo "No check suite data - Assuming that there are no checks to run" + + echo "perform=1" >> $GITHUB_OUTPUT + exit 0 + fi + + cs_failed=$(echo $cs_data | jq --arg x "$not_failed_conclusion" 'select ((.conclusion == null or (.conclusion | test($x))) | not)') + if [[ -z "$cs_failed" ]]; then + echo "No check failed so far; Checking if relevant checks are still running" + + cs_relevant_still_running=$(echo $cs_data | jq --arg x "$not_relevant_app_slug" 'select (.conclusion == null and (.slug | test($x) | not))') + if [[ -z $cs_relevant_still_running ]]; then + echo "All relevant checks finished - PR can be merged" + + echo "perform=1" >> $GITHUB_OUTPUT + exit 0 + else + echo "Relevant checks are still running" + echo $cs_relevant_still_running + fi + else + echo "Detected failed check" + echo $cs_failed + + echo "perform=0" >> $GITHUB_OUTPUT + exit 0 + fi + + echo "Waiting before next run..." + sleep 30s + done + + echo "Timed out - Assuming executor starvation - Forcing merge" + echo "perform=1" >> $GITHUB_OUTPUT + + - name: Auto-merge update_branch_merged + if: steps.auto-merge-check.outputs.perform == 1 + run: | + echo "Getting base branch" + base_branch=$(git branch --show-current) + echo "Base branch is $base_branch" + + echo "Fetching..." + git fetch + if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then + echo "Branch still exists; Continuing..." + else + echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing" + exit 0 + fi + + expected_commit="${{ needs.update.outputs.update_branch_merged_commit }}" + actual_commit=$(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) + if [[ "$expected_commit" != "$actual_commit" ]]; then + echo "Branch ${{ env.UPDATE_BRANCH_MERGED }} contains unexpected commit $actual_commit" + echo "Expected: $expected_commit" + + exit 0 + fi + + echo "Ensuring that current branch $base_branch is up-to-date" + git pull + + echo "Merging origin/${{ env.UPDATE_BRANCH_MERGED }} into $base_branch" + git merge origin/${{ env.UPDATE_BRANCH_MERGED }} && merge_exit_code=$? || merge_exit_code=$? + if [ $merge_exit_code -ne 0 ]; then + echo "Unexpected merge failure $merge_exit_code - Requires manual resolution" + + exit 0 + fi + + if [[ "${{ inputs.no_automatic_merge }}" == "true" ]]; then + echo "Exiting due no_automatic_merge" + + exit 0 + fi + + echo "Pushing" + git push + + echo "Cleaning up" + git branch -D ${{ env.UPDATE_BRANCH }} || true + git branch -D ${{ env.UPDATE_BRANCH_MERGED }} || true + git push -f origin --delete ${{ env.UPDATE_BRANCH }} || true + git push -f origin --delete ${{ env.UPDATE_BRANCH_MERGED }} || true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE index 261eeb9..ccaa2b3 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright 2024 XDEV Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..34b9514 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +# Security Policy + +## Reporting a Vulnerability + +Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new). diff --git a/renovate.json5 b/renovate.json5 new file mode 100644 index 0000000..11a77b2 --- /dev/null +++ b/renovate.json5 @@ -0,0 +1,4 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "rebaseWhen": "behind-base-branch" +} From 473ce31f9b4826136dd560129d55c54039760e22 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 26 Oct 2024 02:32:51 +0000 Subject: [PATCH 15/51] Update dependency org.apache.maven.plugins:maven-checkstyle-plugin to v3.6.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..a032933 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.5.0 + 3.6.0 com.puppycrawl.tools diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..e669be0 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -242,7 +242,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.5.0 + 3.6.0 com.puppycrawl.tools From f2c6db40b00a1554cae8eacb6eaec25bc8dbd039 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 26 Oct 2024 02:32:52 +0000 Subject: [PATCH 16/51] Update dependency org.apache.maven.plugins:maven-jxr-plugin to v3.6.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..aa6b8cb 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ org.apache.maven.plugins maven-jxr-plugin - 3.5.0 + 3.6.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..323c61d 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -301,7 +301,7 @@ org.apache.maven.plugins maven-jxr-plugin - 3.5.0 + 3.6.0 From 216f4650d7cd90671ddb7513de3934300bac3dd4 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 26 Oct 2024 02:32:54 +0000 Subject: [PATCH 17/51] Update net.sourceforge.pmd to v7.7.0 --- pom.xml | 4 ++-- template-placeholder/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..e68ab40 100644 --- a/pom.xml +++ b/pom.xml @@ -82,12 +82,12 @@ net.sourceforge.pmd pmd-core - 7.6.0 + 7.7.0 net.sourceforge.pmd pmd-java - 7.6.0 + 7.7.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..63c5a41 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -284,12 +284,12 @@ net.sourceforge.pmd pmd-core - 7.6.0 + 7.7.0 net.sourceforge.pmd pmd-java - 7.6.0 + 7.7.0 From f798625deb74bec76b0e070dd7c3fd7ecacea34b Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sun, 27 Oct 2024 02:38:11 +0000 Subject: [PATCH 18/51] Update dependency com.puppycrawl.tools:checkstyle to v10.19.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 035f475..ae44704 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.18.2 + 10.19.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e963c1b..eba8ad3 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.18.2 + 10.19.0 From d13b2dee2e89f9270e954d48669fe2f506248e4a Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 28 Oct 2024 15:09:18 +0100 Subject: [PATCH 19/51] Changes for PMD 7.7 --- .config/pmd/ruleset.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.config/pmd/ruleset.xml b/.config/pmd/ruleset.xml index 667f74e..7a03f17 100644 --- a/.config/pmd/ruleset.xml +++ b/.config/pmd/ruleset.xml @@ -151,5 +151,12 @@ + + + + + + + From a2d6ebcb76f8c23a6bcf35da8f98d2905f425d3c Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 29 Oct 2024 02:39:53 +0000 Subject: [PATCH 20/51] Update dependency org.apache.maven.plugins:maven-pmd-plugin to v3.26.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 97e1ff1..a62886a 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.25.0 + 3.26.0 true true diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 62a6b63..454ddcc 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -272,7 +272,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.25.0 + 3.26.0 true true From 572b34a84fe1848fa972c612a14ed22f41690b56 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 29 Oct 2024 02:41:37 +0000 Subject: [PATCH 21/51] Update org.springframework.boot.version to v3.3.5 --- template-placeholder-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder-demo/pom.xml b/template-placeholder-demo/pom.xml index 5c0e324..02d62d6 100644 --- a/template-placeholder-demo/pom.xml +++ b/template-placeholder-demo/pom.xml @@ -31,7 +31,7 @@ 24.4.13 - 3.3.4 + 3.3.5 From b91f8d8aaf1fbae446256afce1d8993e570337ec Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 29 Oct 2024 02:41:41 +0000 Subject: [PATCH 22/51] Update vaadin.version to v24.5.2 --- template-placeholder-demo/pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template-placeholder-demo/pom.xml b/template-placeholder-demo/pom.xml index 5c0e324..53c931f 100644 --- a/template-placeholder-demo/pom.xml +++ b/template-placeholder-demo/pom.xml @@ -29,7 +29,7 @@ software.xdev.vaadin.Application - 24.4.13 + 24.5.2 3.3.4 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 03d2472..ba4dd48 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -49,7 +49,7 @@ UTF-8 - 24.4.13 + 24.5.2 From 9e9f2a9ee7866ba0f992e87cb0678ab7c4ebbc7f Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 30 Oct 2024 09:11:40 +0100 Subject: [PATCH 23/51] Tighten timeouts --- .github/workflows/broken-links.yml | 1 + .github/workflows/sync-labels.yml | 1 + .github/workflows/update-from-template.yml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index 48265e8..8f98f1a 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -11,6 +11,7 @@ permissions: jobs: link-checker: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index ff880f0..c9d7ec7 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -14,6 +14,7 @@ permissions: jobs: labels: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml index ba0bf09..cb31845 100644 --- a/.github/workflows/update-from-template.yml +++ b/.github/workflows/update-from-template.yml @@ -31,6 +31,7 @@ permissions: jobs: update: runs-on: ubuntu-latest + timeout-minutes: 60 outputs: update_branch_merged_commit: ${{ steps.manage-branches.outputs.update_branch_merged_commit }} create_update_branch_merged_pr: ${{ steps.manage-branches.outputs.create_update_branch_merged_pr }} @@ -180,6 +181,7 @@ jobs: needs: [update] if: needs.update.outputs.create_update_branch_merged_pr == 1 runs-on: ubuntu-latest + timeout-minutes: 60 steps: - uses: actions/checkout@v4 with: From 02fc7af8377fd12b1d825b378cdd4d0c0a3e3b3d Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 30 Oct 2024 09:13:09 +0100 Subject: [PATCH 24/51] Tighten timeouts --- .github/workflows/check-build.yml | 3 +++ .github/workflows/release.yml | 5 +++++ .github/workflows/sonar.yml | 2 ++ .github/workflows/test-deploy.yml | 1 + 4 files changed, 11 insertions(+) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index 2ac6530..c8966a7 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -26,6 +26,7 @@ env: jobs: build: runs-on: ubuntu-latest + timeout-minutes: 30 strategy: matrix: @@ -72,6 +73,7 @@ jobs: checkstyle: runs-on: ubuntu-latest + timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} strategy: @@ -94,6 +96,7 @@ jobs: pmd: runs-on: ubuntu-latest + timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} strategy: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bf3805..236c0f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ permissions: jobs: check-code: runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4 @@ -48,6 +49,7 @@ jobs: prepare-release: runs-on: ubuntu-latest needs: [check-code] + timeout-minutes: 10 outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: @@ -109,6 +111,7 @@ jobs: publish-maven: runs-on: ubuntu-latest needs: [prepare-release] + timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -140,6 +143,7 @@ jobs: publish-pages: runs-on: ubuntu-latest needs: [prepare-release] + timeout-minutes: 15 steps: - uses: actions/checkout@v4 @@ -169,6 +173,7 @@ jobs: after-release: runs-on: ubuntu-latest needs: [publish-maven] + timeout-minutes: 10 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index b38f0d8..df6dbb7 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -27,6 +27,7 @@ jobs: token-check: runs-on: ubuntu-latest if: ${{ !(github.event_name == 'pull_request' && startsWith(github.head_ref, 'renovate/')) }} + timeout-minutes: 5 outputs: hasToken: ${{ steps.check-token.outputs.has }} steps: @@ -40,6 +41,7 @@ jobs: runs-on: ubuntu-latest needs: token-check if: ${{ needs.token-check.outputs.hasToken }} + timeout-minutes: 30 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index e3ed038..03f5339 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -9,6 +9,7 @@ env: jobs: publish-maven: runs-on: ubuntu-latest + timeout-minutes: 60 steps: - uses: actions/checkout@v4 From 89a6b057d3436a931931105459f573100590d250 Mon Sep 17 00:00:00 2001 From: AB Date: Wed, 30 Oct 2024 10:30:45 +0100 Subject: [PATCH 25/51] Update check-build.yml --- .github/workflows/check-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index c8966a7..0818116 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -73,8 +73,8 @@ jobs: checkstyle: runs-on: ubuntu-latest - timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} + timeout-minutes: 15 strategy: matrix: @@ -96,8 +96,8 @@ jobs: pmd: runs-on: ubuntu-latest - timeout-minutes: 15 if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }} + timeout-minutes: 15 strategy: matrix: From 71f1b1dab2fbc93df1efd3870c88ea14f82de9d5 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Fri, 1 Nov 2024 02:39:13 +0000 Subject: [PATCH 26/51] Update dependency com.puppycrawl.tools:checkstyle to v10.20.0 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a62886a..8e85bad 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.19.0 + 10.20.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 454ddcc..08cadb5 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.19.0 + 10.20.0 From d7b7b8a7dc4f464a641062cd3ff41b9af4394302 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sun, 3 Nov 2024 02:38:33 +0000 Subject: [PATCH 27/51] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.1 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 454ddcc..e1b6b3c 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -143,7 +143,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.10.1 + 3.11.1 attach-javadocs From 2ba6ca1feb8a402fc716d000511e76af9e645235 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Tue, 5 Nov 2024 07:38:58 +0000 Subject: [PATCH 28/51] Update vaadin.version to v24.5.3 --- template-placeholder-demo/pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template-placeholder-demo/pom.xml b/template-placeholder-demo/pom.xml index f38b8fa..207d75c 100644 --- a/template-placeholder-demo/pom.xml +++ b/template-placeholder-demo/pom.xml @@ -29,7 +29,7 @@ software.xdev.vaadin.Application - 24.5.2 + 24.5.3 3.3.5 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index b4e0af8..cfc858a 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -49,7 +49,7 @@ UTF-8 - 24.5.2 + 24.5.3 From 39f622898239f1116a8b7758eb7941f7c243eb2c Mon Sep 17 00:00:00 2001 From: AB Date: Tue, 5 Nov 2024 09:32:01 +0100 Subject: [PATCH 29/51] Change scope of vaadin-core to prevent conflicts --- template-placeholder/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index cfc858a..e30a9de 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -103,6 +103,8 @@ com.vaadin vaadin-core + + provided From d7926e6ce40ec7ee03e218a4eb8433b15d6c1c7e Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Fri, 8 Nov 2024 02:32:23 +0000 Subject: [PATCH 30/51] Update dependency com.puppycrawl.tools:checkstyle to v10.20.1 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8e85bad..d069dc6 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.20.0 + 10.20.1 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e595715..2155875 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.20.0 + 10.20.1 From 8d16f5b86c6eb6a269cddd1fa31671f920a90c94 Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 11 Nov 2024 08:55:26 +0100 Subject: [PATCH 31/51] Update CheckStyle version --- .idea/checkstyle-idea.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index eb3fcd8..5f35e01 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,7 +1,7 @@ - 10.15.0 + 10.20.1 JavaOnlyWithTests true true From e904641998d8b1721d015c879b51c8cb0f83af75 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Mon, 11 Nov 2024 12:52:15 +0100 Subject: [PATCH 32/51] Fix Exception when editing item --- .../software/xdev/vaadin/FilterComponent.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index 38a4fa8..9797ff5 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -374,13 +374,19 @@ private void onAcceptFilter() deletable = this.deletingBadgeEnabled; editable = this.editingBadgeEnabled; - // Get customization rating from initial condition - customizationDegree = this.initialChipBadges - .stream() - .filter(e -> e.getBadgeId().equals(this.editingBadgeId)) - .toList() - .get(0) - .getCustomizationRating(); + this.deletingBadgeEnabled = null; + this.editingBadgeEnabled = null; + + if(this.editingBadgeEnabled != null) + { + // Get customization rating from initial condition + customizationDegree = this.initialChipBadges + .stream() + .filter(e -> e.getBadgeId().equals(this.editingBadgeId)) + .toList() + .get(0) + .getCustomizationRating(); + } } else { @@ -468,11 +474,7 @@ private void onAcceptFilter() // Set the customization rating for the filter select and condition select this.setUsedCustomizationDegreeForComponents(customizationDegree); - // Just activated when the url parameters are activated - if(!this.identifier.isBlank()) - { - this.editingBadgeId = badge.getBadgeId(); - } + this.editingBadgeId = badge.getBadgeId(); // Remove filter, update grid this.removeChipBadgeCondition(badge); From caa2cf8827bc05b700e6246b9b32d8757fc9c2f7 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Mon, 11 Nov 2024 12:55:47 +0100 Subject: [PATCH 33/51] Update FilterComponent.java --- .../src/main/java/software/xdev/vaadin/FilterComponent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index 9797ff5..58a46d4 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -377,7 +377,7 @@ private void onAcceptFilter() this.deletingBadgeEnabled = null; this.editingBadgeEnabled = null; - if(this.editingBadgeEnabled != null) + if(this.editingBadgeId != null) { // Get customization rating from initial condition customizationDegree = this.initialChipBadges From 92e17bd3b40c73865aaa3c400b8f067548e9ca4b Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 11 Nov 2024 13:14:27 +0100 Subject: [PATCH 34/51] Revert "Change scope of vaadin-core to prevent conflicts" This reverts commit 39f622898239f1116a8b7758eb7941f7c243eb2c. This is not working as the Vaadin Maven Plugin otherwise throws errors during prepare-frontend like: ``Failed to execute goal com.vaadin:vaadin-maven-plugin:24.5.3:prepare-frontend (default) on project vaadin-simple-grid-filter: Could not execute prepare-frontend goal. Error occured during goal execution: Cannot invoke "java.lang.Class.isInterface()" because the return value of "org.reflections.Reflections.forClass(String, java.lang.ClassLoader[])" is null`` Fixes https://github.com/xdev-software/vaadin-simple-grid-filter/issues/20 --- template-placeholder/pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index e30a9de..cfc858a 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -103,8 +103,6 @@ com.vaadin vaadin-core - - provided From fe4f39b27c9b1ad6e86097d0bfe5a097e6ba99a6 Mon Sep 17 00:00:00 2001 From: JohannesRabauer Date: Tue, 12 Nov 2024 08:28:56 +0100 Subject: [PATCH 35/51] Update FilterComponentUtl.java --- .../xdev/vaadin/utl/FilterComponentUtl.java | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java index 26b62de..40e3341 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/FilterComponentUtl.java @@ -15,9 +15,8 @@ */ package software.xdev.vaadin.utl; -import java.util.ArrayList; -import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; import software.xdev.vaadin.model.ChipBadge; import software.xdev.vaadin.model.ChipBadgeExtension; @@ -41,22 +40,11 @@ public boolean equalLists( final List>> one, final List>> two) { - if(one == null && two == null) - { - return true; - } - - if(one == null || two == null || one.size() != two.size()) - { - return false; - } - - // to avoid messing the order of the lists we will use a copy - final List>> oneCopy = new ArrayList<>(one); - final List>> twoCopy = new ArrayList<>(two); - - oneCopy.sort(Comparator.comparing(ChipBadge::getBadgeId)); - twoCopy.sort(Comparator.comparing(ChipBadge::getBadgeId)); - return one.equals(two); + return one.stream() + .map(ChipBadge::getBadgeId) + .collect(Collectors.toSet()) + .equals(two.stream() + .map(ChipBadge::getBadgeId) + .collect(Collectors.toSet())); } } From 0c403ee9031ac3160c3e40f5b20e4e64c7677bf3 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Wed, 13 Nov 2024 02:33:23 +0000 Subject: [PATCH 36/51] Update vaadin.version to v24.5.4 --- template-placeholder-demo/pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template-placeholder-demo/pom.xml b/template-placeholder-demo/pom.xml index 207d75c..4668047 100644 --- a/template-placeholder-demo/pom.xml +++ b/template-placeholder-demo/pom.xml @@ -29,7 +29,7 @@ software.xdev.vaadin.Application - 24.5.3 + 24.5.4 3.3.5 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index ef2a15a..548ad71 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -49,7 +49,7 @@ UTF-8 - 24.5.3 + 24.5.4 From d12ec222a2886eae2ba545ce8f58f27e01bb99f8 Mon Sep 17 00:00:00 2001 From: AB Date: Fri, 22 Nov 2024 13:22:07 +0100 Subject: [PATCH 37/51] Generate sources and javadoc during package and not verify This should prevent javadoc problems during release or similar situations --- template-placeholder/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 2155875..3a5bc8e 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -147,7 +147,7 @@ attach-javadocs - verify + package jar @@ -165,7 +165,7 @@ attach-sources - verify + package jar-no-fork From f77e826e68172378b54556547c1e386afa1c6abf Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 23 Nov 2024 02:35:51 +0000 Subject: [PATCH 38/51] Update org.springframework.boot.version to v3.4.0 --- template-placeholder-demo/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder-demo/pom.xml b/template-placeholder-demo/pom.xml index 4668047..c2a2313 100644 --- a/template-placeholder-demo/pom.xml +++ b/template-placeholder-demo/pom.xml @@ -31,7 +31,7 @@ 24.5.4 - 3.3.5 + 3.4.0 From 976063d2a46ac5fcb748af514cc3662bd7597793 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Wed, 27 Nov 2024 02:38:41 +0000 Subject: [PATCH 39/51] Update vaadin.version to v24.5.6 --- template-placeholder-demo/pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/template-placeholder-demo/pom.xml b/template-placeholder-demo/pom.xml index 4668047..2add59e 100644 --- a/template-placeholder-demo/pom.xml +++ b/template-placeholder-demo/pom.xml @@ -29,7 +29,7 @@ software.xdev.vaadin.Application - 24.5.4 + 24.5.6 3.3.5 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index dc4bd10..7543f25 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -49,7 +49,7 @@ UTF-8 - 24.5.4 + 24.5.6 From 2ec98d3be8a62afc571859f21eb96015ac636bc2 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sat, 30 Nov 2024 02:36:45 +0000 Subject: [PATCH 40/51] Update net.sourceforge.pmd to v7.8.0 --- pom.xml | 4 ++-- template-placeholder/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index d069dc6..0c03cd5 100644 --- a/pom.xml +++ b/pom.xml @@ -82,12 +82,12 @@ net.sourceforge.pmd pmd-core - 7.7.0 + 7.8.0 net.sourceforge.pmd pmd-java - 7.7.0 + 7.8.0 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 3a5bc8e..2269f3f 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -284,12 +284,12 @@ net.sourceforge.pmd pmd-core - 7.7.0 + 7.8.0 net.sourceforge.pmd pmd-java - 7.7.0 + 7.8.0 From 6b853f13e48fc5e15d102f56523929a7f1ffd22a Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sun, 1 Dec 2024 02:47:14 +0000 Subject: [PATCH 41/51] Update dependency com.puppycrawl.tools:checkstyle to v10.20.2 --- pom.xml | 2 +- template-placeholder/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d069dc6..5068c8f 100644 --- a/pom.xml +++ b/pom.xml @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.20.1 + 10.20.2 diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 3a5bc8e..8a9db79 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -247,7 +247,7 @@ com.puppycrawl.tools checkstyle - 10.20.1 + 10.20.2 From 07c48c88ff590329bd1a38e2a384845a71ad5791 Mon Sep 17 00:00:00 2001 From: XDEV Renovate Bot Date: Sun, 8 Dec 2024 02:43:59 +0000 Subject: [PATCH 42/51] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.11.2 --- template-placeholder/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-placeholder/pom.xml b/template-placeholder/pom.xml index 9ac769d..abbbb53 100644 --- a/template-placeholder/pom.xml +++ b/template-placeholder/pom.xml @@ -143,7 +143,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.11.1 + 3.11.2 attach-javadocs From 94e21493243c3cc4812c260af202249351c15fd1 Mon Sep 17 00:00:00 2001 From: AB Date: Mon, 9 Dec 2024 09:27:36 +0100 Subject: [PATCH 43/51] Remove duplicated save action Does the same/less as ``localCanBeFinal`` --- .idea/saveactions_settings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.idea/saveactions_settings.xml b/.idea/saveactions_settings.xml index 506f17e..848c311 100644 --- a/.idea/saveactions_settings.xml +++ b/.idea/saveactions_settings.xml @@ -9,7 +9,6 @@