#91 -- Add get markups form

This commit is contained in:
Anton Romanov 2023-03-03 11:10:35 +04:00
parent 0239b0afd4
commit 211a8b004c
5 changed files with 17 additions and 9 deletions

View File

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

View File

@ -31,7 +31,7 @@ public class TimeSeriesMarkupController {
@GetMapping("time-series-markup")
public String markupTs(Model model) {
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";
}

View File

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

View File

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

View File

@ -7,21 +7,23 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<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">
<thead class="thead-dark">
<tr>
<th scope="col" colspan="10">Разметка временных рядов</th>
<th scope="col" colspan="3">Разметка временных рядов</th>
</tr>
</thead>
<tbody>
<tr th:each="m: ${markupForm.markupRows}">
<td><span class="badge badge-success" th:text="${m.timeSeries.name}"></span></td>
<td><input type="text" th:value="${m.markup}"></input></td>
<tr th:each="m, itemStat: *{markupRows}">
<td><input type="hidden" th:field="*{markupRows[__${itemStat.index}__].timeSeries.id}"></span></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>
</tbody>
</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>
</div>
</html>