mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-06-08 21:38:21 +00:00
Categorical filter is now mutually exclusive
This commit is contained in:
parent
e72fcda5fe
commit
bb3f9e7bcb
@ -2,7 +2,6 @@ package tech.ailef.dbadmin.internal.model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.datetime.standard.DateTimeFormatterFactory;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
@ -11,9 +10,6 @@ import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Lob;
|
||||
import jakarta.persistence.Transient;
|
||||
import tech.ailef.dbadmin.external.DbAdmin;
|
||||
import tech.ailef.dbadmin.external.dbmapping.DbObjectSchema;
|
||||
|
||||
/**
|
||||
* An action executed by any user from the web UI.
|
||||
|
@ -49,11 +49,17 @@
|
||||
<!--/*--> Handle non categorical filter <!--*/-->
|
||||
<th:block th:if="${!field.isFilterableCategorical()}">
|
||||
<form action="" method="GET">
|
||||
<!--/*--> Propagate queryParams containing other filters with hidden fields <!--*/-->
|
||||
<th:block th:each="p : ${queryParams.keySet()}">
|
||||
<input th:each="v : ${queryParams.get(p)}"
|
||||
th:name="${p}" th:value="${v}" type="hidden"
|
||||
th:if="${p.startsWith('filter_')}">
|
||||
<!--/*--> Propagate query filters with hidden fields <!--*/-->
|
||||
<th:block th:each="filter : ${activeFilters}">
|
||||
<input type="hidden"
|
||||
name="filter_field"
|
||||
th:value="${filter.getField().getJavaName()}">
|
||||
<input type="hidden"
|
||||
name="filter_op"
|
||||
th:value="${filter.getOp()}">
|
||||
<input type="hidden"
|
||||
name="filter_value"
|
||||
th:value="${filter.getValue()}">
|
||||
</th:block>
|
||||
|
||||
<div class="input-group pe-2">
|
||||
@ -103,11 +109,20 @@
|
||||
<ul class="categorical-select">
|
||||
<li th:each="categoricalValue : ${field.getConnectedSchema().findAll()}">
|
||||
<form action="" method="GET">
|
||||
<!--/*--> Propagate queryParams containing other filters with hidden fields <!--*/-->
|
||||
<th:block th:each="p : ${queryParams.keySet()}">
|
||||
<input th:each="v : ${queryParams.get(p)}"
|
||||
th:name="${p}" th:value="${v}" type="hidden"
|
||||
th:if="${p.startsWith('filter_')}">
|
||||
<!--/*--> Propagate query filters with hidden fields <!--*/-->
|
||||
<th:block th:each="filter : ${activeFilters}">
|
||||
<!--/*--> This field is categorical so we don't propagate it, to make it mutually exclusive <!--*/-->
|
||||
<th:block th:unless="${field.getJavaName() == filter.getField().getJavaName()}">
|
||||
<input type="hidden"
|
||||
name="filter_field"
|
||||
th:value="${filter.getField().getJavaName()}">
|
||||
<input type="hidden"
|
||||
name="filter_op"
|
||||
th:value="${filter.getOp()}">
|
||||
<input type="hidden"
|
||||
name="filter_value"
|
||||
th:value="${filter.getValue()}">
|
||||
</th:block>
|
||||
</th:block>
|
||||
|
||||
<!-- Reset page when applying filter to start back at page 1 -->
|
||||
@ -130,11 +145,20 @@
|
||||
<ul class="categorical-select">
|
||||
<li th:each="categoricalValue : ${field.getAllValues()}">
|
||||
<form action="" method="GET">
|
||||
<!--/*--> Propagate queryParams containing other filters with hidden fields <!--*/-->
|
||||
<th:block th:each="p : ${queryParams.keySet()}">
|
||||
<input th:each="v : ${queryParams.get(p)}"
|
||||
th:name="${p}" th:value="${v}" type="hidden"
|
||||
th:if="${p.startsWith('filter_')}">
|
||||
<!--/*--> Propagate query filters with hidden fields <!--*/-->
|
||||
<th:block th:each="filter : ${activeFilters}">
|
||||
<!--/*--> This field is categorical so we don't propagate it, to make it mutually exclusive <!--*/-->
|
||||
<th:block th:unless="${field.getJavaName() == filter.getField().getJavaName()}">
|
||||
<input type="hidden"
|
||||
name="filter_field"
|
||||
th:value="${filter.getField().getJavaName()}">
|
||||
<input type="hidden"
|
||||
name="filter_op"
|
||||
th:value="${filter.getOp()}">
|
||||
<input type="hidden"
|
||||
name="filter_value"
|
||||
th:value="${filter.getValue()}">
|
||||
</th:block>
|
||||
</th:block>
|
||||
|
||||
<!-- Reset page when applying filter to start back at page 1 -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user