#91 -- Add markup page menu item #94
@ -21,6 +21,7 @@ public class Route {
|
||||
public static final String ADD_RULE = "addRule";
|
||||
public static final String ASSESSMENTS = "assessments";
|
||||
public static final String DELETE_RULE = "deleteRule";
|
||||
public static final String ADD_MARKUP = "addMarkup";
|
||||
|
||||
public static String getLIST_INDEXED_REPOSITORIES() {
|
||||
return LIST_INDEXED_REPOSITORIES;
|
||||
@ -45,4 +46,8 @@ public class Route {
|
||||
public static String getASSESSMENTS() {
|
||||
return ASSESSMENTS;
|
||||
}
|
||||
|
||||
public static String getADD_MARKUP() {
|
||||
return ADD_MARKUP;
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,16 @@ package ru.ulstu.extractor.markup.controller;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import ru.ulstu.extractor.markup.model.MarkupForm;
|
||||
import ru.ulstu.extractor.markup.model.MarkupRow;
|
||||
import ru.ulstu.extractor.ts.model.TimeSeries;
|
||||
import ru.ulstu.extractor.ts.service.TimeSeriesService;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@ApiIgnore
|
||||
@ -20,9 +25,13 @@ public class TimeSeriesMarkupController {
|
||||
|
||||
@GetMapping("time-series-markup")
|
||||
public String markupTs(Model model) {
|
||||
List<TimeSeries> ts = timeSeriesService.getAllTimeSeries();
|
||||
model.addAttribute("ts", ts);
|
||||
model.addAttribute("groupedTs", timeSeriesService.getGroupedTendencies(ts));
|
||||
List<TimeSeries> tss = timeSeriesService.getAllTimeSeries();
|
||||
model.addAttribute("markupForm", new MarkupForm(tss.stream().map(MarkupRow::new).collect(Collectors.toList())));
|
||||
return "markup";
|
||||
}
|
||||
|
||||
@PostMapping("addMarkups")
|
||||
public String addMarkups(@RequestBody MarkupForm markupForm) {
|
||||
return "markup";
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package ru.ulstu.extractor.markup.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MarkupForm {
|
||||
private List<MarkupRow> markupRows;
|
||||
|
||||
public MarkupForm(List<MarkupRow> markupRows) {
|
||||
this.markupRows = markupRows;
|
||||
}
|
||||
|
||||
public List<MarkupRow> getMarkupRows() {
|
||||
return markupRows;
|
||||
}
|
||||
}
|
28
src/main/java/ru/ulstu/extractor/markup/model/MarkupRow.java
Normal file
28
src/main/java/ru/ulstu/extractor/markup/model/MarkupRow.java
Normal file
@ -0,0 +1,28 @@
|
||||
package ru.ulstu.extractor.markup.model;
|
||||
|
||||
import ru.ulstu.extractor.ts.model.TimeSeries;
|
||||
|
||||
public class MarkupRow {
|
||||
private TimeSeries timeSeries;
|
||||
private String markup;
|
||||
|
||||
public MarkupRow(TimeSeries ts) {
|
||||
this.timeSeries = ts;
|
||||
}
|
||||
|
||||
public TimeSeries getTimeSeries() {
|
||||
return timeSeries;
|
||||
}
|
||||
|
||||
public void setTimeSeries(TimeSeries timeSeries) {
|
||||
this.timeSeries = timeSeries;
|
||||
}
|
||||
|
||||
public String getMarkup() {
|
||||
return markup;
|
||||
}
|
||||
|
||||
public void setMarkup(String markup) {
|
||||
this.markup = markup;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
<div class="container" layout:fragment="content">
|
||||
<form th:action="${@route.ADD_MARKUP}">
|
||||
<table class="table table-striped">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
@ -14,11 +15,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="t: ${groupedTs}">
|
||||
<td><span class="badge badge-success" th:text="${t.name}"></span></td>
|
||||
<td><span class="badge badge-success" th:text="${#lists.size(t.values)}"></span></td>
|
||||
<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>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user