Skip to content

Commit

Permalink
fix issue with validation error thrown, when searching for just two c…
Browse files Browse the repository at this point in the history
…haracters

improve css styling
  • Loading branch information
nitram509 committed Dec 27, 2024
1 parent e881c30 commit 6aafad1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import jakarta.validation.constraints.Size;
import org.camunda.bpm.model.xml.instance.ModelElementInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
Expand Down Expand Up @@ -63,9 +62,9 @@ public String index(final Map<String, Object> model, final Pageable pageable) {
}

@GetMapping("/views/processes")
public String processList(final Map<String, Object> model, final Pageable pageable, @RequestParam("bpmnProcessId") Optional<@Size(min = 3) String> bpmnProcessId) {
public String processList(final Map<String, Object> model, final Pageable pageable, @RequestParam(value = "bpmnProcessId", required = false) Optional<String> bpmnProcessId) {

if (bpmnProcessId.isPresent()) {
if (bpmnProcessId.isPresent() && bpmnProcessId.get().length() >= 3) {
final List<ProcessDto> processes = new ArrayList<>();
for (final ProcessEntity processEntity : processRepository.findByBpmnProcessIdStartsWith(bpmnProcessId.get())) {
final ProcessDto dto = toDto(processEntity);
Expand All @@ -88,7 +87,7 @@ public String processList(final Map<String, Object> model, final Pageable pageab
}

model.put("processes", processes);
model.remove("bpmnProcessId");
model.put("bpmnProcessId", "");
model.put("count", count);

addPaginationToModel(model, pageable, count);
Expand Down
15 changes: 7 additions & 8 deletions src/main/resources/templates/process-list-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
New Deployment
</button>

<form method="get" action="{{context-path}}views/processes">
<label for="bpmn-search-input">
Search by BPMN Process ID
</label>
<input id="bpmn-search-input" placeholder="BPMN process id" name="bpmnProcessId" type="text" title="Type in a bpmnId" minlength="3" />
<button type="submit">Search</button>
<form class="form-inline" method="get" action="{{context-path}}views/processes">
<div class="form-group mb-2 col-sm-3">
<label class="mx-sm-2" for="bpmn-search-input" >Search by</label>
<input class="col-sm-9 form-control" id="bpmn-search-input" placeholder="BPMN process id (min 3 characters)" name="bpmnProcessId" type="text" title="BPMN process id (min 3 characters)" value="{{bpmnProcessId}}" />
</div>
<button class="btn btn-secondary mb-2" type="submit">Search</button>
</form>

</div>

<div class="col-md-12">
<div class="col-md-12 border-top">

<span>{{count}} process definitions</span>

Expand Down

0 comments on commit 6aafad1

Please sign in to comment.