Skip to content

Commit afba8df

Browse files
committed
[Fix] - Fixed label update.
1 parent 5628213 commit afba8df

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/main/java/com/smartlogger/smartclient/Principale.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ public String labelForm(@PathVariable String id, Model model) {
7676
return "label";
7777
}
7878

79-
@PutMapping("/label/{id}")
80-
public String labelSubmitted(@PathVariable String id,
79+
@PutMapping("/label/")
80+
public String labelSubmitted(
8181
@ModelAttribute("log") @Valid LogEntity entity,
8282
BindingResult result, Model model) {
8383
logger.info("Update log : {}", entity);
8484
if (result.hasErrors()) {
8585
logger.error("Error occurred during log update : {}", entity);
86-
return this.labelForm(id, model);
86+
return this.labelForm(entity.getId(), model);
8787
}
8888
logger.info("Update log {} ", entity);
8989
this.logRepository.save(entity);

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# DataSource settings: Define url, username and password.
22
spring.datasource.url = jdbc:mysql://localhost/TEST1?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
33
spring.datasource.username = root
4-
spring.datasource.password = root
4+
spring.datasource.password =
55

66
# Keep the connection alive if idle for a long time (needed in production)
77
spring.datasource.testWhileIdle = true

src/main/resources/templates/label.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@
4646
<!-- Main panel -->
4747
<h2>Modification du label</h2>
4848
<div class="panel panel-primary">
49-
<form action="#" th:action="@{/smartlogger/label}" th:object="${log}" th:method="PUT">
49+
<form action="#" th:action="@{/smartlogger/label/}" th:object="${log}" th:method="PUT" style="padding: 5px">
5050
<div class="form-group row">
5151
<label for="identifier" class="col-lg-2">Identifiant : </label>
52-
<textarea type="text" id="identifier" th:text="${log.id}" th:field="*{id}" disabled="disabled" cols="250"></textarea>
52+
<div class="col-lg-10">
53+
<input class="form-control" type="text" id="identifier" th:field="*{id}" />
54+
</div>
5355
</div>
5456

5557
<div class="form-group row">
@@ -62,7 +64,9 @@ <h2>Modification du label</h2>
6264

6365
<div class="form-group row">
6466
<label for="content" class="col-lg-2">Contenu : </label>
65-
<textarea id="content" th:text="${log.content}" th:field="*{content}" disabled="disabled" cols="250"></textarea>
67+
<div class="col-lg-10">
68+
<input class="form-control" type="text" maxlength="524288" id="content" th:field="*{content}" />
69+
</div>
6670
</div>
6771

6872
<div class="form-group">

0 commit comments

Comments
 (0)