#23 -- Add run project models
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 9m6s

This commit is contained in:
Anton Romanov 2025-03-04 12:45:06 +04:00
parent 6c14b5942a
commit 16aeb1e7e5
4 changed files with 47 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import ru.ulstu.fc.project.model.RunProjectForm;
import ru.ulstu.fc.project.service.ProjectRulesService;
import ru.ulstu.fc.project.service.ProjectService;
import ru.ulstu.fc.project.service.ProjectVariableService;
@ -32,6 +33,8 @@ public class ProjectRunController {
@GetMapping("init/{projectId}")
public String getProjects(@PathVariable(value = "projectId") Integer projectId, Model model) {
model.addAttribute("project", projectService.getById(projectId));
model.addAttribute("runProjectForm", new RunProjectForm());
model.addAttribute("variables", projectVariableService.getInputByProjectId(projectId));
return "project/init";
}
}

View File

@ -0,0 +1,13 @@
package ru.ulstu.fc.project.model;
public class RunProjectForm {
private Integer projectId;
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
}

View File

@ -21,6 +21,8 @@
<label th:text="'Дата создания: ' + ${#dates.format(project.createDate, 'dd.MM.yyyy HH:mm')}"></label>
</div>
<button name="save" type="submit" class="btn btn-outline-dark">Сохранить</button>
<a th:href="@{'/runProject/init/' + ${project.id}}" th:if="${project.id != null && project.id != 0}"
class="btn btn-outline-dark">Выполнить</a>
<button name="delete" type="submit" class="btn btn-outline-dark" onclick="return confirm('Удалить запись?')">
Удалить
</button>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.w3.org/1999/xhtml"
layout:decorate="~{default}">
<head>
<title>Ввод переменных</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script></script>
</head>
<div class="container" layout:fragment="content">
<h3>Ввод переменных:</h3>
<form th:action="@{/runProject/run}" th:object="${runProjectForm}" method="post">
<input type="hidden" id="projectId" th:field="*{projectId}">
<div class="form-group" th:each="v : ${variables}">
<label th:text="${v.name}"> </label>
<select class='selectpicker inputVar m-2' data-live-search='true' data-width='70%'>
<option th:each="t : ${v.fuzzyTerms}"
th:value="${t.crispValue}"
th:utext="${t.description}">
</option>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-outline-dark">Выполнить</button>
<a th:href="@{'/project/edit/' + ${projectId}}" class="btn btn-outline-dark">Назад</a>
</div>
</form>
</div>
</html>