WIP: страницы для правил #62

Closed
Ghost wants to merge 132 commits from master into 61-rules-pages
5 changed files with 17 additions and 9 deletions
Showing only changes of commit 211a8b004c - Show all commits

View File

@ -26,5 +26,4 @@ public class GitExtractorApplication {
public void doSomethingAfterStartup() { public void doSomethingAfterStartup() {
indexService.indexFailedBranchesOnStart(); indexService.indexFailedBranchesOnStart();
} }
} }

View File

@ -31,7 +31,7 @@ public class TimeSeriesMarkupController {
@GetMapping("time-series-markup") @GetMapping("time-series-markup")
public String markupTs(Model model) { public String markupTs(Model model) {
List<TimeSeries> tss = timeSeriesService.getAllTimeSeries(); List<TimeSeries> tss = timeSeriesService.getAllTimeSeries();
model.addAttribute("markupForm", new MarkupForm(tss.stream().map(MarkupRow::new).collect(Collectors.toList()))); model.addAttribute("markupForm", new MarkupForm(tss.stream().map(MarkupRow::new).limit(200).collect(Collectors.toList())));
return "markup"; return "markup";
} }

View File

@ -1,9 +1,13 @@
package ru.ulstu.extractor.markup.model; package ru.ulstu.extractor.markup.model;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class MarkupForm { public class MarkupForm {
private List<MarkupRow> markupRows; private List<MarkupRow> markupRows = new ArrayList<>();
public MarkupForm() {
}
public MarkupForm(List<MarkupRow> markupRows) { public MarkupForm(List<MarkupRow> markupRows) {
this.markupRows = markupRows; this.markupRows = markupRows;

View File

@ -6,6 +6,9 @@ public class MarkupRow {
private TimeSeries timeSeries; private TimeSeries timeSeries;
private String markup; private String markup;
public MarkupRow() {
}
public MarkupRow(TimeSeries ts) { public MarkupRow(TimeSeries ts) {
this.timeSeries = ts; this.timeSeries = ts;
} }

View File

@ -7,21 +7,23 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head> </head>
<div class="container" layout:fragment="content"> <div class="container" layout:fragment="content">
<form th:action="${@route.ADD_MARKUP}" method="post"> <form action="#" th:action="${@route.ADD_MARKUP}" method="post" th:object="${markupForm}">
<table class="table table-striped"> <table class="table table-striped">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th scope="col" colspan="10">Разметка временных рядов</th> <th scope="col" colspan="3">Разметка временных рядов</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr th:each="m: ${markupForm.markupRows}"> <tr th:each="m, itemStat: *{markupRows}">
<td><span class="badge badge-success" th:text="${m.timeSeries.name}"></span></td> <td><input type="hidden" th:field="*{markupRows[__${itemStat.index}__].timeSeries.id}"></span></td>
<td><input type="text" th:value="${m.markup}"></input></td> <td><span class="badge badge-success"
th:text="*{markupRows[__${itemStat.index}__].timeSeries.name}"></span></td>
<td><input type="text" th:field="*{markupRows[__${itemStat.index}__].markup}"></input></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<input type="submit" class="btn btn-outline-success w-100" name="next" value="Сохранить"/> <input type="submit" class="btn btn-outline-success w-100" value="Сохранить"/>
</form> </form>
</div> </div>
</html> </html>