#17 - Add some pages
This commit is contained in:
parent
736ee1b3d8
commit
e868bcee54
@ -0,0 +1,36 @@
|
||||
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.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import ru.ulstu.extractor.model.mvc.IndexRepoForm;
|
||||
import ru.ulstu.extractor.model.mvc.RepoForm;
|
||||
import ru.ulstu.extractor.service.GitRepositoryService;
|
||||
|
||||
@Controller
|
||||
public class BaseIndexingController {
|
||||
private final GitRepositoryService gitRepositoryService;
|
||||
|
||||
public BaseIndexingController(GitRepositoryService gitRepositoryService) {
|
||||
this.gitRepositoryService = gitRepositoryService;
|
||||
}
|
||||
|
||||
@GetMapping("/indexRepo")
|
||||
public String indexNewRepo(Model model) {
|
||||
model.addAttribute(new RepoForm());
|
||||
return "indexRepo";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/indexRepo", method = RequestMethod.POST, params = "send")
|
||||
public String getBranch(@ModelAttribute IndexRepoForm indexRepoForm, Model model) {
|
||||
try {
|
||||
return "indexRepo";
|
||||
} catch (Exception ex) {
|
||||
model.addAttribute("error", ex.getMessage());
|
||||
return "indexRepo";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package ru.ulstu.extractor.model.mvc;
|
||||
|
||||
public class IndexRepoForm {
|
||||
private String repo;
|
||||
|
||||
public String getRepo() {
|
||||
return repo;
|
||||
}
|
||||
|
||||
public void setRepo(String repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IndexRepoForm{" +
|
||||
"repo='" + repo + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
25
src/main/resources/templates/indexRepo.html
Normal file
25
src/main/resources/templates/indexRepo.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!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">
|
||||
<form action="#" th:action="@{/indexRepo}" th:object="${indexRepoForm}" method="post">
|
||||
<table class="table table-striped">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col" style="width: 30%">Url</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="url: ${urls}">
|
||||
<td th:text="${commit.url}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user