Skip to content

Commit

Permalink
Merge branch 'develop' into initial-state-reset-button-not-disabled-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesRabauer committed Nov 12, 2024
2 parents 3e56609 + 539c442 commit 6b2ae19
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 45 deletions.
7 changes: 7 additions & 0 deletions .config/pmd/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,12 @@
<exclude name="UseStringBufferForStringAppends"/>
</rule>

<rule ref="category/java/performance.xml/TooFewBranchesForSwitch">
<properties>
<!-- If you have one case only please use a if -->
<property name="minimumNumberCaseForASwitch" value="2"/>
</properties>
</rule>

<rule ref="category/java/security.xml"/>
</ruleset>
3 changes: 3 additions & 0 deletions .github/workflows/broken-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissions:
jobs:
link-checker:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

Expand All @@ -19,6 +20,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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ env:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
Expand Down Expand Up @@ -73,6 +74,7 @@ jobs:
checkstyle:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
timeout-minutes: 15

strategy:
matrix:
Expand All @@ -95,6 +97,7 @@ jobs:
pmd:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
timeout-minutes: 15

strategy:
matrix:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ permissions:
jobs:
check-code:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -112,6 +114,7 @@ jobs:
publish-maven:
runs-on: ubuntu-latest
needs: [prepare-release]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -143,6 +146,7 @@ jobs:
publish-pages:
runs-on: ubuntu-latest
needs: [prepare-release]
timeout-minutes: 15
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -172,6 +176,7 @@ jobs:
after-release:
runs-on: ubuntu-latest
needs: [publish-maven]
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ permissions:
jobs:
labels:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
jobs:
publish-maven:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/update-from-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.18.2</version>
<version>10.20.0</version>
</dependency>
</dependencies>
<configuration>
Expand All @@ -70,7 +70,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.25.0</version>
<version>3.26.0</version>
<configuration>
<includeTests>true</includeTests>
<printFailingErrors>true</printFailingErrors>
Expand All @@ -82,12 +82,12 @@
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>7.6.0</version>
<version>7.7.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>7.6.0</version>
<version>7.7.0</version>
</dependency>
</dependencies>
</plugin>
Expand All @@ -99,7 +99,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</plugin>
</plugins>
</reporting>
Expand Down
4 changes: 2 additions & 2 deletions vaadin-simple-grid-filter-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<mainClass>software.xdev.vaadin.Application</mainClass>

<!-- Dependency-Versions -->
<vaadin.version>24.4.13</vaadin.version>
<vaadin.version>24.5.3</vaadin.version>

<org.springframework.boot.version>3.3.4</org.springframework.boot.version>
<org.springframework.boot.version>3.3.5</org.springframework.boot.version>
</properties>

<dependencyManagement>
Expand Down
18 changes: 9 additions & 9 deletions vaadin-simple-grid-filter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<!-- Dependency-Versions -->
<vaadin.version>24.4.13</vaadin.version>
<vaadin.version>24.5.3</vaadin.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -122,7 +122,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
</plugin>
</plugins>
</pluginManagement>
Expand Down Expand Up @@ -185,7 +185,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -308,12 +308,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.18.2</version>
<version>10.20.0</version>
</dependency>
</dependencies>
<configuration>
Expand All @@ -338,7 +338,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.25.0</version>
<version>3.26.0</version>
<configuration>
<includeTests>true</includeTests>
<printFailingErrors>true</printFailingErrors>
Expand All @@ -350,12 +350,12 @@
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>7.6.0</version>
<version>7.7.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>7.6.0</version>
<version>7.7.0</version>
</dependency>
</dependencies>
</plugin>
Expand All @@ -367,7 +367,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</plugin>
</plugins>
</reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -369,19 +370,24 @@ 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;

// 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.editingBadgeId != null)
{
// Get customization rating from initial condition
customizationDegree = this.initialChipBadges
.stream()
.filter(e -> e.getBadgeId().equals(this.editingBadgeId))
.toList()
.get(0)
.getCustomizationRating();
}
}
else
{
Expand Down Expand Up @@ -461,17 +467,15 @@ private void onAcceptFilter()
// Make the cancel button invisible
this.btnCancelFilter.setVisible(false);

// 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
// 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();
// Needed for the acceptFilterBtn
this.editingBadgeEnabled = badge.isBtnEditEnabled();
this.deletingBadgeEnabled = badge.isBtnDeleteEnabled();
}
this.editingBadgeId = badge.getBadgeId();

// Remove filter, update grid
this.removeChipBadgeCondition(badge);
Expand Down Expand Up @@ -1319,26 +1323,35 @@ private void addQueryParameter(final ChipBadgeExtension<FilterCondition<T, ?>> 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
.getPage()
.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())));
});
}

Expand Down

0 comments on commit 6b2ae19

Please sign in to comment.