Merge remote-tracking branch 'origin/master' into 12-heuristic
This commit is contained in:
commit
740c750988
@ -0,0 +1,21 @@
|
||||
package ru.ulstu.extractor.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import ru.ulstu.extractor.repository.RepositoryRepository;
|
||||
|
||||
@Controller
|
||||
public class BaseIndexingController {
|
||||
private final RepositoryRepository repositoryRepository;
|
||||
|
||||
public BaseIndexingController(RepositoryRepository repositoryRepository) {
|
||||
this.repositoryRepository = repositoryRepository;
|
||||
}
|
||||
|
||||
@GetMapping("/indexRepo")
|
||||
public String indexNewRepo(Model model) {
|
||||
model.addAttribute("repositories", repositoryRepository.findAll());
|
||||
return "indexRepo";
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package ru.ulstu.extractor.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.extractor.repository.BranchRepository;
|
||||
import ru.ulstu.extractor.repository.RepositoryRepository;
|
||||
|
||||
@Controller
|
||||
public class BranchController {
|
||||
private final RepositoryRepository repositoryRepository;
|
||||
private final BranchRepository branchRepository;
|
||||
|
||||
public BranchController(RepositoryRepository repositoryRepository, BranchRepository branchRepository) {
|
||||
this.repositoryRepository = repositoryRepository;
|
||||
this.branchRepository = branchRepository;
|
||||
}
|
||||
|
||||
@GetMapping("/details")
|
||||
public String indexBranch(
|
||||
Model model,
|
||||
@RequestParam int repositoryId) {
|
||||
model.addAttribute("branches", branchRepository.findByRepositoryId(repositoryId));
|
||||
model.addAttribute("repository", repositoryRepository.findById(repositoryId).get());
|
||||
return "indexBranch";
|
||||
}
|
||||
}
|
@ -4,6 +4,10 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import ru.ulstu.extractor.model.Branch;
|
||||
import ru.ulstu.extractor.model.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BranchRepository extends JpaRepository<Branch, Integer> {
|
||||
Branch findByRepositoryAndName(Repository repository, String name);
|
||||
|
||||
List<Branch> findByRepositoryId(Integer repositoryId);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
<a class="nav-link" href="/" th:text="#{messages.menu.new-repo}">Link</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" th:text="#{messages.menu.indexed-repos}">Link</a>
|
||||
<a class="nav-link" href="/indexRepo" th:text="#{messages.menu.indexed-repos}">Link</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
24
src/main/resources/templates/indexBranch.html
Normal file
24
src/main/resources/templates/indexBranch.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||
<html xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
<title>Проиндексированные репозитории</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<table class="table table-striped">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Ветки</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="branch: ${branches}">
|
||||
<td><a th:href="@{'/filtering?branchName='+${branch.name}+'&repositoryUrl='+${repository.url}}"
|
||||
th:text="${branch.name}"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</html>
|
23
src/main/resources/templates/indexRepo.html
Normal file
23
src/main/resources/templates/indexRepo.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||
<html xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
<title>Проиндексированные репозитории</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<table class="table table-striped">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">Репозиторий</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="repo: ${repositories}">
|
||||
<td><a th:href="@{'/details?repositoryId='+${repo.id}}" th:text="${repo.url}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user