Skip to content
Snippets Groups Projects
Commit 5d7df56d authored by Ondřej Trojan's avatar Ondřej Trojan
Browse files

restart button in control bugfix

parent 2a6f4ac8
No related branches found
No related tags found
No related merge requests found
......@@ -58,9 +58,9 @@ public class ApliVlcController {
"Video set to pause", HttpStatus.OK);
}
@RequestMapping(value = "/shutdown/{id}", produces = "application/json", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity shutdown(@PathVariable("id") String clientId) {
@PostMapping(value = "/shutdown/{clientId}", produces = "application/json")
// @ResponseBody
public ResponseEntity shutdown(@PathVariable("clientId") String clientId) {
controlService.shutdownById(clientId);
return new ResponseEntity<>(
"Client " + clientId + " set to shutdown", HttpStatus.OK);
......
package com.museum.projection.controller;
import com.museum.projection.config.AsyncConfiguration;
import com.museum.projection.config.CustomConfig;
import com.museum.projection.dao.ResponseData;
import com.museum.projection.dto.*;
import com.museum.projection.dto.other.VideoFileItem;
......@@ -59,6 +60,8 @@ public class WebController implements WebMvcConfigurer {
public SynchronizationService synchronizationService;
@Resource()
public UserService userService;
@Resource
public CustomConfig customConfig;
private final Logger log = LoggerFactory.getLogger(WebController.class);
......@@ -119,6 +122,7 @@ public class WebController implements WebMvcConfigurer {
modelViewService.populateHeader(principal, model);
model.addAttribute("activeTab", "control");
model.addAttribute("displaySets", displaySetService.getAllDisplaySets());
model.addAttribute("clientCount", customConfig.getClientCount());
return "control";
}
......
......@@ -44,7 +44,7 @@ function controlPause() {
}
function controlShutdown(btn, client) {
sendHttpRequest('POST', serverUrl + apiVlcPrefix + '/shutdown/?clientId=' + client)
sendHttpRequest('POST', serverUrl + apiVlcPrefix + '/shutdown/' + client)
.then(responseData => {
handeResponseAlert(responseData);
}).catch(err => {
......
......@@ -56,10 +56,22 @@
<br>
<h2>Emergency</h2>
<p class="lead">By restarting the application running on client will shutdown and restart automaticaly</p>
<button id="shutdown1" type="button" class="btn btn-danger">Restart 1</button>
<button id="shutdown2" type="button" class="btn btn-danger">Restart 2</button>
<div th:if="${clientCount==0}">
<a> Wrong configuration, client count = 0</a>
</div>
<div th:unless="${clientCount==0}">
<button th:id="${'shutdown' + client}" type="button" class="btn btn-danger my-2"
th:text="${'Restart ' + client}" th:each="client:${#numbers.sequence(1,clientCount)}"></button>
</div>
<!-- <button id="shutdown1" type="button" class="btn btn-danger">Restart 1</button>-->
<!-- <button id="shutdown2" type="button" class="btn btn-danger">Restart 2</button>-->
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment