Merge branch '2-web-pages' into 'master'
Resolve "Добавить верстку нужных страниц" Closes #2 See merge request romanov73/git-extractor!3merge-requests/6/merge
commit
ca75025d51
@ -1,15 +1,17 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.controller;
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.ulstu.extractor.model.Commit;
|
||||
import ru.ulstu.extractor.service.GitRepositoryService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static ru.ulstu.extractor.RepoController.URL;
|
||||
import static ru.ulstu.extractor.controller.RepoController.URL;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(URL)
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
public class LineChange {
|
||||
private boolean added;
|
@ -1,4 +1,4 @@
|
||||
package ru.ulstu.extractor;
|
||||
package ru.ulstu.extractor.model;
|
||||
|
||||
import org.eclipse.jgit.diff.DiffEntry;
|
||||
import org.eclipse.jgit.diff.DiffFormatter;
|
@ -1,40 +0,0 @@
|
||||
package ru.ulstu.extractor.mvc.model;
|
||||
|
||||
public class EmailForm {
|
||||
private String subject;
|
||||
private String to;
|
||||
private String message;
|
||||
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public String getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public void setTo(String to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EmailForm{" +
|
||||
"subject='" + subject + '\'' +
|
||||
", to='" + to + '\'' +
|
||||
", message='" + message + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package ru.ulstu.extractor.mvc.model;
|
||||
|
||||
public class FilterForm {
|
||||
private String filter;
|
||||
private String url;
|
||||
|
||||
public FilterForm() {
|
||||
}
|
||||
|
||||
public FilterForm(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FilterForm{" +
|
||||
"subject='" + filter +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package ru.ulstu.extractor.mvc.model;
|
||||
|
||||
public class RepoForm {
|
||||
private String repo;
|
||||
|
||||
public String getRepo() {
|
||||
return repo;
|
||||
}
|
||||
|
||||
public void setRepo(String repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RepoForm{" +
|
||||
"subject='" + repo +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package ru.ulstu.extractor.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.extractor.model.Commit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class FilteringService {
|
||||
|
||||
private final GitRepositoryService gitRepositoryService;
|
||||
|
||||
public FilteringService(GitRepositoryService gitRepositoryService) {
|
||||
this.gitRepositoryService = gitRepositoryService;
|
||||
}
|
||||
|
||||
public List<Commit> getCommits(String urlRepo) {
|
||||
return getCommits(urlRepo, null);
|
||||
}
|
||||
|
||||
public List<Commit> getCommits(String urlRepo, String filterCommitMessage) {
|
||||
if (filterCommitMessage != null) {
|
||||
return getCommits(urlRepo)
|
||||
.stream()
|
||||
.filter(commit -> commit.getMessage().contains(filterCommitMessage))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
return getCommits(urlRepo);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<!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>Простая обработка формы на Spring MVC</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<body>
|
||||
<form action="#" th:action="@{/sendRepo}" th:object="${repoForm}" method="post">
|
||||
<p style="color:red" th:text="${error}"></p>
|
||||
<p><b>Ваш git репозиторий:</b><br>
|
||||
<input type="text" size="40" th:field="*{repo}">
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Отправить"/>
|
||||
</p>
|
||||
</form>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>Простая обработка формы на Spring MVC</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Результат обработки формы</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Тема:</td>
|
||||
<td><p th:text="${emailForm.subject}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Кому:</td>
|
||||
<td><p th:text="${emailForm.to}"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Сообщение:</td>
|
||||
<td><p th:text="${emailForm.message}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="/">Отправить другое сообщение</a>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
|
||||
<html
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{default}">
|
||||
<head>
|
||||
<title>Простая обработка формы на Spring MVC</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<body>
|
||||
<form oninput="result">
|
||||
<p>Данные репозитория:</p>
|
||||
<p>
|
||||
<output name="result"></output>
|
||||
</form>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
Loading…
Reference in New Issue