#27 -- fix pagination

This commit is contained in:
Anton Romanov 2021-04-28 15:16:25 +04:00
parent 76c13d02f5
commit 97433f9e73
4 changed files with 30 additions and 10 deletions

View File

@ -69,12 +69,14 @@ public class GitFilteringController {
filterForm.setRepositoryUrl(notEmptyRepositoryUrl);
filterForm.setAuthor(author.orElse(null));
filterForm.setFilter(filter.orElse(null));
filterForm.setEntity(entity.orElse(false));
filterForm.setEntity(entity.orElse(null));
model.addAttribute("filterForm", filterForm);
model.addAttribute("authors", filteringService.getRepositoryAuthors(
notEmptyRepositoryUrl,
notEmptyBranchName
));
model.addAttribute("entityPresent", filteringService.getEntityPresent());
return FILTER_COMMITS;
}
}

View File

@ -13,7 +13,7 @@ public class FilterForm {
private String repositoryUrl;
private String branchName;
private String author;
private boolean entity;
private Boolean entity;
private Page<Commit> commitsPage;
public FilterForm() {
@ -63,11 +63,11 @@ public class FilterForm {
this.branchName = branchName;
}
public boolean getEntity() {
public Boolean getEntity() {
return entity;
}
public void setEntity(boolean entity) {
public void setEntity(Boolean entity) {
this.entity = entity;
}

View File

@ -15,6 +15,7 @@ import ru.ulstu.extractor.repository.CommitRepository;
import ru.ulstu.extractor.repository.RepositoryRepository;
import java.util.List;
import java.util.Map;
@Service
public class FilteringService {
@ -53,4 +54,9 @@ public class FilteringService {
entity
);
}
public Map<String, Boolean> getEntityPresent() {
return Map.of("Cодержит сущность", true,
"Не содержит сущность", false);
}
}

View File

@ -43,6 +43,7 @@
<script th:inline="javascript">
$('select[name=selValue]').val([[*{author}]]);
$('#select-author').selectpicker('refresh');
</script>
</div>
<div class="col-md-1 col-sm-12">
@ -70,14 +71,25 @@
<div class="col-md-2 col-sm-12">
Искать по тексту:
</div>
<div class="col-md-6 col-sm-12">
<div class="col-md-3 col-sm-12">
<input type="text" class="form-control" size="40" th:field="*{filter}">
</div>
<div class="col-md-2 col-sm-12">
Содержит сущность:
</div>
<div class="col-md-3 col-sm-12">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" th:field="*{entity}" th:checked="*{entity}"/>
<select id="select-entity-present" class="selectpicker" th:field="*{entity}"
data-width="90%">
<option value="">Не определено</option>
<option th:each="ep : ${entityPresent}"
th:value="${ep.value}"
th:utext="${ep.key}">
</option>
</select>
<script th:inline="javascript">
$('select[name=selValue]').val([[*{entity}]]);
$('#select-entity-present').selectpicker('refresh');
</script>
</div>
</div>
<div class="col-md-4 col-sm-12">
<input type="submit" class="btn btn-outline-success w-100" value="Применить фильтр"/>