#27 -- fix pagination

merge-requests/27/head
Anton Romanov 3 years ago
parent 76c13d02f5
commit 97433f9e73

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

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

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

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

Loading…
Cancel
Save