Commit e7370ebe1fe55b935a935a62c353452aa792c093
1 parent
51db1937
Backend - Configuration du réseau
* Quelques modifications front sur la page /registration * La page /update a été mise à jour et contient maintenant la nouvelle méthode pour modifier le réseau * La configuration est envoyée en JSON * Le tableau des noeuds fait maintenant la distinction avec les capteurs
Showing
17 changed files
with
248 additions
and
235 deletions
Show diff stats
PFE06/pom.xml
... | ... | @@ -35,6 +35,10 @@ |
35 | 35 | <version>1.21</version> |
36 | 36 | </dependency> |
37 | 37 | <dependency> |
38 | + <groupId>com.fasterxml.jackson.core</groupId> | |
39 | + <artifactId>jackson-databind</artifactId> | |
40 | + </dependency> | |
41 | + <dependency> | |
38 | 42 | <groupId>org.springframework.boot</groupId> |
39 | 43 | <artifactId>spring-boot-starter-web</artifactId> |
40 | 44 | </dependency> | ... | ... |
PFE06/src/main/java/com/PFE/ServerManager/ConfigNodes.java deleted
... | ... | @@ -1,16 +0,0 @@ |
1 | -package com.PFE.ServerManager; | |
2 | - | |
3 | -import java.util.List; | |
4 | - | |
5 | -public class ConfigNodes { | |
6 | - | |
7 | - private List<NodeYAML> nodes; | |
8 | - | |
9 | - public List<NodeYAML> getNodes() { | |
10 | - return nodes; | |
11 | - } | |
12 | - | |
13 | - public void setNodes(List<NodeYAML> nodes) { | |
14 | - this.nodes = nodes; | |
15 | - } | |
16 | -} |
PFE06/src/main/java/com/PFE/ServerManager/MainController.java
1 | 1 | package com.PFE.ServerManager; |
2 | 2 | |
3 | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | -import org.springframework.data.repository.query.Param; | |
4 | +import org.springframework.http.HttpEntity; | |
5 | 5 | import org.springframework.http.HttpStatus; |
6 | 6 | import org.springframework.stereotype.Controller; |
7 | 7 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -19,6 +19,7 @@ import org.yaml.snakeyaml.Yaml; |
19 | 19 | import org.yaml.snakeyaml.constructor.Constructor; |
20 | 20 | |
21 | 21 | import javax.servlet.annotation.MultipartConfig; |
22 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
22 | 23 | |
23 | 24 | @Controller |
24 | 25 | @MultipartConfig(fileSizeThreshold = 20971520) //à changer, taille max des fichiers |
... | ... | @@ -198,35 +199,40 @@ public class MainController { |
198 | 199 | } |
199 | 200 | } |
200 | 201 | |
201 | - @RequestMapping(value = "/config", method = RequestMethod.POST) | |
202 | + @RequestMapping(value = "/updatenodes", method = RequestMethod.POST) | |
202 | 203 | @ResponseStatus(value = HttpStatus.OK) |
203 | - public void submitConfig(@RequestParam MultipartFile file) { | |
204 | + public void submitConfig(HttpEntity<String> httpEntity) { | |
204 | 205 | |
205 | - Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | |
206 | - Customer customer = customerRepository.findByEmail(auth.getName()); | |
207 | - InputStream inputStream = null; | |
206 | + nodeRepository.deleteAll(); | |
207 | + String json = httpEntity.getBody(); | |
208 | + ObjectMapper objectMapper = new ObjectMapper(); | |
209 | + NodeJSON[] nodes = null; | |
208 | 210 | try { |
209 | - inputStream = file.getInputStream(); | |
210 | - } | |
211 | - catch (IOException e) { | |
211 | + nodes = objectMapper.readValue(json, NodeJSON[].class); | |
212 | + } catch (IOException e) { | |
212 | 213 | e.printStackTrace(); |
213 | 214 | } |
214 | 215 | |
215 | - nodeRepository.deleteAll(); | |
216 | - Yaml yaml = new Yaml(new Constructor(ConfigNodes.class)); | |
217 | - ConfigNodes conf = yaml.load(inputStream); | |
218 | - | |
219 | - Iterator<NodeYAML> iter = conf.getNodes().iterator(); | |
220 | - while (iter.hasNext()) { | |
221 | - NodeYAML element = iter.next(); | |
216 | + for (NodeJSON n : nodes) { | |
222 | 217 | Node node = new Node(); |
223 | - node.setName(element.getName()); | |
224 | - node.setArch(element.getArch()); | |
225 | - node.setIp(element.getIp()); | |
218 | + node.setName(n.getName()); | |
219 | + node.setArch(n.getArch()); | |
220 | + node.setIp(n.getIp()); | |
221 | + List<SensorJSON> sensors = n.getSensors(); | |
222 | + Set<Sensor> sensorsReal = new HashSet<Sensor>(); | |
223 | + for(SensorJSON s : sensors) | |
224 | + { | |
225 | + Sensor ss = new Sensor(); | |
226 | + ss.setName(s.getName()); | |
227 | + sensorsReal.add(ss); | |
228 | + } | |
229 | + node.setSensors(sensorsReal); | |
226 | 230 | nodeRepository.save(node); |
227 | 231 | } |
232 | + | |
228 | 233 | } |
229 | 234 | |
235 | + | |
230 | 236 | @GetMapping(path="/login") |
231 | 237 | public ModelAndView login() { |
232 | 238 | ModelAndView modelAndView = new ModelAndView(); |
... | ... | @@ -290,7 +296,7 @@ public class MainController { |
290 | 296 | Yaml yaml = new Yaml(); |
291 | 297 | FileWriter writer = null; |
292 | 298 | try { |
293 | - writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + update_c.getUpdate() + ".yaml"); | |
299 | + writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + update_c.getUpdate() + ".yml"); | |
294 | 300 | } catch (IOException e) { |
295 | 301 | e.printStackTrace(); |
296 | 302 | } |
... | ... | @@ -313,21 +319,11 @@ public class MainController { |
313 | 319 | Yaml yaml = new Yaml(); |
314 | 320 | FileWriter writer = null; |
315 | 321 | try { |
316 | - writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + update.getUpdate() + ".yaml"); | |
322 | + writer = new FileWriter("toflash/" + customer.getEmail().split("@")[0] + "_" + update.getUpdate() + ".yml"); | |
317 | 323 | } catch (IOException e) { |
318 | 324 | e.printStackTrace(); |
319 | 325 | } |
320 | 326 | yaml.dump(data, writer); |
321 | 327 | } |
322 | 328 | |
323 | - @GetMapping(value="/nodesconf") | |
324 | - public ModelAndView nodesconf() { | |
325 | - ModelAndView modelAndView = new ModelAndView(); | |
326 | - Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | |
327 | - Customer customer = customerRepository.findByEmail(auth.getName()); | |
328 | - modelAndView.addObject("customerName", customer.getEmail().split("@")[0]); | |
329 | - modelAndView.addObject("customerRole", customer.getRole()); | |
330 | - modelAndView.setViewName("nodesconf"); | |
331 | - return modelAndView; | |
332 | - } | |
333 | 329 | } |
334 | 330 | \ No newline at end of file | ... | ... |
PFE06/src/main/java/com/PFE/ServerManager/Node.java
1 | 1 | package com.PFE.ServerManager; |
2 | 2 | |
3 | 3 | import javax.persistence.*; |
4 | +import java.util.Set; | |
4 | 5 | |
5 | 6 | @Entity |
6 | 7 | @Table(name = "node") |
... | ... | @@ -19,6 +20,14 @@ public class Node { |
19 | 20 | @Column(name = "arch") |
20 | 21 | private String arch; |
21 | 22 | |
23 | + @ManyToMany(cascade = CascadeType.ALL) | |
24 | + @JoinTable(name = "nodes_sensor", joinColumns = @JoinColumn(name = "node_id"), inverseJoinColumns = @JoinColumn(name = "sensorId")) | |
25 | + private Set<Sensor> sensors; | |
26 | + | |
27 | + public void setSensors(Set<Sensor> sensors) { | |
28 | + this.sensors = sensors; | |
29 | + } | |
30 | + | |
22 | 31 | public void setNode_id(Integer node_id) { |
23 | 32 | this.node_id = node_id; |
24 | 33 | } |
... | ... | @@ -51,4 +60,8 @@ public class Node { |
51 | 60 | return arch; |
52 | 61 | } |
53 | 62 | |
63 | + public Set<Sensor> getSensors() { | |
64 | + return sensors; | |
65 | + } | |
66 | + | |
54 | 67 | } | ... | ... |
PFE06/src/main/java/com/PFE/ServerManager/NodeYAML.java renamed to PFE06/src/main/java/com/PFE/ServerManager/NodeJSON.java
1 | 1 | package com.PFE.ServerManager; |
2 | 2 | |
3 | -public class NodeYAML { | |
3 | +import java.util.List; | |
4 | + | |
5 | +public class NodeJSON { | |
4 | 6 | |
5 | 7 | private String name; |
6 | 8 | private String ip; |
7 | 9 | private String arch; |
10 | + private List<SensorJSON> sensors; | |
8 | 11 | |
9 | 12 | public void setName(String name) { |
10 | 13 | this.name = name; |
... | ... | @@ -18,6 +21,8 @@ public class NodeYAML { |
18 | 21 | this.arch = arch; |
19 | 22 | } |
20 | 23 | |
24 | + public void setSensors(List<SensorJSON> sensors) { this.sensors = sensors; } | |
25 | + | |
21 | 26 | public String getName() { |
22 | 27 | return name; |
23 | 28 | } |
... | ... | @@ -30,4 +35,6 @@ public class NodeYAML { |
30 | 35 | return arch; |
31 | 36 | } |
32 | 37 | |
38 | + public List<SensorJSON> getSensors() { return sensors; } | |
39 | + | |
33 | 40 | } | ... | ... |
PFE06/src/main/java/com/PFE/ServerManager/NodesJSON.java
0 → 100644
... | ... | @@ -0,0 +1,12 @@ |
1 | +package com.PFE.ServerManager; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +public class NodesJSON { | |
6 | + private List<NodeJSON> nodes; | |
7 | + | |
8 | + public void setNodes(List<NodeJSON> nodes) { this.nodes = nodes; } | |
9 | + | |
10 | + public List<NodeJSON> getNodes() { return nodes; } | |
11 | + | |
12 | +} | ... | ... |
PFE06/src/main/java/com/PFE/ServerManager/Sensor.java
0 → 100644
... | ... | @@ -0,0 +1,23 @@ |
1 | +package com.PFE.ServerManager; | |
2 | + | |
3 | +import javax.persistence.*; | |
4 | + | |
5 | +@Entity | |
6 | +@Table(name = "sensor") | |
7 | +public class Sensor { | |
8 | + @Id | |
9 | + @Column(name = "sensorId", columnDefinition = "serial") | |
10 | + @GeneratedValue(strategy = GenerationType.AUTO) | |
11 | + private Integer sensorId; | |
12 | + | |
13 | + @Column(name = "name") | |
14 | + private String name; | |
15 | + | |
16 | + public void setSensorId(Integer sensorId) { this.sensorId = sensorId; } | |
17 | + public Integer getSensorId() { return sensorId; } | |
18 | + | |
19 | + public void setName(String name) { | |
20 | + this.name = name; | |
21 | + } | |
22 | + public String getName() { return name; } | |
23 | +} | ... | ... |
PFE06/src/main/java/com/PFE/ServerManager/SensorJSON.java
0 → 100644
PFE06/src/main/resources/static/js/nodes.js
... | ... | @@ -74,7 +74,18 @@ function clearAll() { |
74 | 74 | |
75 | 75 | allDone.addEventListener('click', function() { |
76 | 76 | if(nodes.length !== 0) { |
77 | - console.log(JSON.stringify(nodes)); | |
77 | + var xhr = new XMLHttpRequest(); | |
78 | + var url = "/updatenodes"; | |
79 | + xhr.open("POST", url, true); | |
80 | + xhr.setRequestHeader("Content-Type", "application/json"); | |
81 | + xhr.onreadystatechange = function () { | |
82 | + if (xhr.readyState === 4 && xhr.status === 200) { | |
83 | + location.reload(); | |
84 | + } | |
85 | + }; | |
86 | + var data = JSON.stringify(nodes); | |
87 | + console.log(data); | |
88 | + xhr.send(data); | |
78 | 89 | } |
79 | 90 | }) |
80 | 91 | ... | ... |
PFE06/src/main/resources/static/js/update.js
... | ... | @@ -37,6 +37,13 @@ $(document).ready(function() { |
37 | 37 | |
38 | 38 | /********** Configuration file ***********/ |
39 | 39 | |
40 | + | |
41 | + | |
42 | + | |
43 | + | |
44 | + | |
45 | + | |
46 | + /* | |
40 | 47 | var configName = document.getElementById("config_name"); |
41 | 48 | var configSend = document.getElementById("config_send"); |
42 | 49 | var file = document.getElementById("configInputFile"); |
... | ... | @@ -81,6 +88,8 @@ $(document).ready(function() { |
81 | 88 | }) |
82 | 89 | } |
83 | 90 | |
91 | +*/ | |
92 | + | |
84 | 93 | /********** Tableau **********/ |
85 | 94 | |
86 | 95 | var tableNodes = $('#nodes-table').DataTable( { |
... | ... | @@ -94,12 +103,15 @@ $(document).ready(function() { |
94 | 103 | |
95 | 104 | tableNodes.on('select', function (e, dt, type, indexes) { |
96 | 105 | var rowData = tableNodes.rows(indexes).data().toArray()[0]; |
97 | - nodeSet.add(rowData[0]); | |
106 | + console.log(rowData); | |
107 | + nodeSet.add(rowData[0] + "@" + rowData[3]); | |
108 | + console.log(nodeSet); | |
98 | 109 | } ); |
99 | 110 | |
100 | 111 | tableNodes.on('deselect', function (e, dt, type, indexes) { |
101 | 112 | var rowData = tableNodes.rows(indexes).data().toArray()[0]; |
102 | - nodeSet.delete(rowData[0]); | |
113 | + nodeSet.delete(rowData[0] + "@" + rowData[3]); | |
114 | + console.log(nodeSet); | |
103 | 115 | } ); |
104 | 116 | |
105 | 117 | var sendInfoMaj = function(action) { | ... | ... |
PFE06/src/main/resources/templates/all.html
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | <th scope="col">Nom</th> |
64 | 64 | <th scope="col">ID</th> |
65 | 65 | <th scope="col">Utilisateurs</th> |
66 | - <th scope="col">Mises à jours</th> | |
66 | + <th scope="col">Mises à jour</th> | |
67 | 67 | </tr> |
68 | 68 | <tr th:each="prod : ${team}"> |
69 | 69 | <td th:text="${prod.getTeam()}">Team</td> | ... | ... |
PFE06/src/main/resources/templates/nodesconf.html deleted
... | ... | @@ -1,129 +0,0 @@ |
1 | -<!DOCTYPE html> | |
2 | -<html xmlns:th="http://www.thymeleaf.org"> | |
3 | -<head> | |
4 | - <meta charset="utf-8"> | |
5 | - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
6 | - <link rel="stylesheet" th:href="@{/css/all.css}"> | |
7 | - <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | |
8 | - <title>Configuration des noeuds</title> | |
9 | -</head> | |
10 | -<body> | |
11 | -<!-- NAV BAR --> | |
12 | -<nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | |
13 | - <div class="container"> | |
14 | - <a th:href="@{/home}"><span class="navbar-brand"><img style="max-width:32px;" src="/pfelogo.png"></span></a> | |
15 | - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | |
16 | - <span class="navbar-toggler-icon"></span> | |
17 | - </button> | |
18 | - <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | |
19 | - <div class="navbar-nav mr-auto"> | |
20 | - <a class="nav-item nav-link" th:href="@{/upload}">Uploader un fichier</a> | |
21 | - <div th:remove="tag" th:switch="${customerRole}"> | |
22 | - <div th:remove="tag" th:case="'ADMIN'"> | |
23 | - <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a> | |
24 | - <a class="nav-item nav-link" th:href="@{/all}">Liste des utilisateurs</a> | |
25 | - <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> | |
26 | - </div> | |
27 | - <div th:remove="tag" th:case="'USER'"> | |
28 | - <a class="nav-item nav-link" th:href="@{/update}">Paramétrer une mise à jour</a> | |
29 | - </div> | |
30 | - </div> | |
31 | - </div> | |
32 | - </div> | |
33 | - <div class="collapse navbar-collapse ml-3" id="navbarNavAltMarkup2" > | |
34 | - <div class="navbar-nav ml-auto"> | |
35 | - <a class="nav-item nav-link btn btn-danger active" th:href="@{/logout}">Déconnexion</a> | |
36 | - </div> | |
37 | - </div> | |
38 | - </div> | |
39 | -</nav> | |
40 | - | |
41 | - | |
42 | -<!-- TABLE PART --> | |
43 | -<div class="container"> | |
44 | - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Configuration des noeuds</h1> | |
45 | - | |
46 | - <div class="input-group mb-3"> | |
47 | - <div class="input-group-prepend"> | |
48 | - <span class="input-group-text">Nom</span> | |
49 | - </div> | |
50 | - <input id="nodeName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
51 | - </div> | |
52 | - | |
53 | - <div class="input-group mb-3"> | |
54 | - <div class="input-group-prepend"> | |
55 | - <span class="input-group-text">IP</span> | |
56 | - </div> | |
57 | - <input id="nodeIP" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
58 | - </div> | |
59 | - | |
60 | - <div class="input-group mb-3"> | |
61 | - <div class="input-group-prepend"> | |
62 | - <span class="input-group-text">Architecture</span> | |
63 | - </div> | |
64 | - <input id="nodeArch" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
65 | - </div> | |
66 | - | |
67 | - <h3>Capteurs</h3><br/> | |
68 | - | |
69 | - <div class="input-group mb-3"> | |
70 | - <div class="input-group-prepend"> | |
71 | - <span class="input-group-text">Nom</span> | |
72 | - </div> | |
73 | - <input id="sensorName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
74 | - </div> | |
75 | - | |
76 | - <button id="addSensor" type="button" class="btn btn-primary" style="margin-bottom:50px;">Ajouter un capteur</button> | |
77 | - | |
78 | - <table id="sensorsTable" class="table" style="margin-bottom:50px;"> | |
79 | - </table> | |
80 | - | |
81 | - <button id="addNode" type="button" class="btn btn-success" style="margin-bottom:50px;">Ajouter ce noeud</button> | |
82 | - <button id="editNode" type="button" class="btn btn-warning" style="margin-bottom:50px;">Modifier ce noeud</button> | |
83 | - <button id="delNode" type="button" class="btn btn-danger" style="margin-bottom:50px;">Supprimer ce noeud</button> | |
84 | - | |
85 | - <div class="container"> | |
86 | - <div class="row"> | |
87 | - <div class="col-sm" style="text-align:left;"> | |
88 | - <button id="prevNode" type="button" class="btn btn-secondary"><</button> | |
89 | - </div> | |
90 | - <div class="col-sm" style="text-align:center;"> | |
91 | - <button id="allDone" type="button" class="btn btn-primary btn-lg btn-block">Terminer</button> | |
92 | - </div> | |
93 | - <div class="col-sm" style="text-align:right"> | |
94 | - <button id="nextNode" type="button" class="btn btn-secondary">></button> | |
95 | - </div> | |
96 | - </div> | |
97 | - </div> | |
98 | - | |
99 | - | |
100 | -</div> | |
101 | - | |
102 | - | |
103 | -<div class="modal fade" id="warningConf" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> | |
104 | - <div class="modal-dialog modal-dialog-centered" role="document"> | |
105 | - <div class="modal-content"> | |
106 | - <div class="modal-header"> | |
107 | - <h5 class="modal-title" id="modal-title">Attention</h5> | |
108 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
109 | - <span aria-hidden="true">×</span> | |
110 | - </button> | |
111 | - </div> | |
112 | - <div id="modal-content" class="modal-body"> | |
113 | - Certains champs sont vides ! | |
114 | - </div> | |
115 | - <div class="modal-footer"> | |
116 | - <button id="modal-button" type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button> | |
117 | - </div> | |
118 | - </div> | |
119 | - </div> | |
120 | -</div> | |
121 | - | |
122 | - | |
123 | -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> | |
124 | -<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | |
125 | -<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> | |
126 | -<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | |
127 | -<script th:src="@{/js/nodes.js}"></script> | |
128 | -</body> | |
129 | -</html> |
PFE06/src/main/resources/templates/registration.html
... | ... | @@ -4,11 +4,10 @@ |
4 | 4 | <head> |
5 | 5 | <meta charset="utf-8"> |
6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=0.8, shrink-to-fit=no"> |
7 | - <link rel="stylesheet" th:href="@{/css/registration.css}"> | |
8 | 7 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> |
9 | 8 | <title>Enregistrement de nouveaux utilisateurs</title> |
10 | 9 | </head> |
11 | -<body> | |
10 | + | |
12 | 11 | <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> |
13 | 12 | <div class="container"> |
14 | 13 | <a th:href="@{/home}"><span class="navbar-brand"><img style="max-width:32px;" src="/pfelogo.png"></span></a> |
... | ... | @@ -39,11 +38,21 @@ |
39 | 38 | </nav> |
40 | 39 | |
41 | 40 | <div class="container"> |
41 | + | |
42 | + <div th:if="${succeed == 1}"> | |
43 | + <div class="alert alert-success" style="margin-top:50px" role="alert"> | |
44 | + <span th:utext="${message + ' a été ajouté'}"></span> | |
45 | + </div> | |
46 | + </div> | |
47 | + | |
48 | + <div th:if="${succeed == -1}"> | |
49 | + <div class="alert alert-danger" style="margin-top:50px" role="alert"> | |
50 | + <span th:utext="${message + ' existe déjà'}"></span> | |
51 | + </div> | |
52 | + </div> | |
53 | + | |
42 | 54 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Formulaire d'ajout d'un utilisateur</h1> |
43 | - <p>Merci d'entrer le login et le mot de passe du nouvel utilisateur</p> | |
44 | - </div> | |
45 | - <div class="login-form"> | |
46 | - <div class="main-div"> | |
55 | + <div class="login-form"> | |
47 | 56 | <form id="Login" th:action="@{/addUser}" method="POST"> |
48 | 57 | <div class="form-team"> |
49 | 58 | <input type="email" class="form-control" id="username" placeholder="Entrer l'email" name="email" minlength="6" required> |
... | ... | @@ -70,35 +79,16 @@ |
70 | 79 | <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button> |
71 | 80 | </form> |
72 | 81 | </div> |
73 | - </div> | |
74 | - <div style="max-width:38%; margin:50px auto; padding:10px 70px 10px 71px"> | |
75 | - <div th:if="${succeed == 1}"> | |
76 | - <div class="alert alert-success" role="alert"> | |
77 | - <span th:utext="${message + ' a été ajouté'}"></span> | |
78 | - </div> | |
79 | - </div> | |
80 | - | |
81 | - <div th:if="${succeed == -1}"> | |
82 | - <div class="alert alert-danger" role="alert"> | |
83 | - <span th:utext="${message + ' existe déjà'}"></span> | |
84 | - </div> | |
85 | - </div> | |
86 | - </div> | |
87 | 82 | |
88 | - <div class="container"> | |
89 | 83 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Formulaire d'ajout d'un groupe de travail</h1> |
90 | - <p>Merci d'entrer le nom du nouveau groupe</p> | |
91 | - </div> | |
92 | - <div class="login-form"> | |
93 | - <div class="main-div"> | |
94 | - <form id="addTeam" th:action="@{/addTeam}" method="POST"> | |
95 | - <div class="form-team"> | |
96 | - <input type="text" class="form-control" id="teamName" placeholder="Entrer le nom du groupe" name="teamName" required> | |
97 | - </div> | |
98 | - <br/> | |
99 | - <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button> | |
100 | - </form> | |
101 | - </div> | |
84 | + <div class="login-form"> | |
85 | + <form id="addTeam" th:action="@{/addTeam}" method="POST"> | |
86 | + <div class="form-team"> | |
87 | + <input type="text" class="form-control" id="teamName" placeholder="Entrer le nom du groupe" name="teamName" required> | |
88 | + </div> | |
89 | + <br/> | |
90 | + <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button> | |
91 | + </form> | |
102 | 92 | </div> |
103 | 93 | </div> |
104 | 94 | ... | ... |
PFE06/src/main/resources/templates/update.html
... | ... | @@ -45,6 +45,8 @@ |
45 | 45 | |
46 | 46 | <div class="container" style="padding-bottom: 50px;"> |
47 | 47 | |
48 | + <!-- | |
49 | + | |
48 | 50 | <div th:remove="tag" th:if="${customerRole} == 'ADMIN'"> |
49 | 51 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Changer la configuration réseau</h1> |
50 | 52 | <div class="input-team mb-3"> |
... | ... | @@ -74,6 +76,57 @@ nodes: |
74 | 76 | </div> |
75 | 77 | </div> |
76 | 78 | |
79 | + --> | |
80 | + | |
81 | + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Paramétrer le réseau</h1> | |
82 | + | |
83 | + <div class="input-group mb-3"> | |
84 | + <div class="input-group-prepend"> | |
85 | + <span class="input-group-text">Nom</span> | |
86 | + </div> | |
87 | + <input id="nodeName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
88 | + </div> | |
89 | + | |
90 | + <div class="input-group mb-3"> | |
91 | + <div class="input-group-prepend"> | |
92 | + <span class="input-group-text">IP</span> | |
93 | + </div> | |
94 | + <input id="nodeIP" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
95 | + </div> | |
96 | + | |
97 | + <div class="input-group mb-3"> | |
98 | + <div class="input-group-prepend"> | |
99 | + <span class="input-group-text">Architecture</span> | |
100 | + </div> | |
101 | + <input id="nodeArch" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
102 | + </div> | |
103 | + | |
104 | + <h3>Capteurs</h3><br/> | |
105 | + | |
106 | + <div class="input-group mb-3"> | |
107 | + <div class="input-group-prepend"> | |
108 | + <span class="input-group-text">Nom</span> | |
109 | + </div> | |
110 | + <input id="sensorName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> | |
111 | + </div> | |
112 | + | |
113 | + <button id="addSensor" type="button" class="btn btn-primary" style="margin-bottom:50px;">Ajouter un capteur</button> | |
114 | + | |
115 | + <table id="sensorsTable" class="table" style="margin-bottom:50px;"> | |
116 | + </table> | |
117 | + | |
118 | + <button id="addNode" type="button" class="btn btn-success" style="margin-bottom:50px;">Ajouter ce noeud</button> | |
119 | + <button id="editNode" type="button" class="btn btn-warning" style="margin-bottom:50px;">Modifier ce noeud</button> | |
120 | + <button id="delNode" type="button" class="btn btn-danger" style="margin-bottom:50px;">Supprimer ce noeud</button> | |
121 | + | |
122 | + <br/> | |
123 | + | |
124 | + <button id="prevNode" type="button" class="btn btn-secondary"><</button> | |
125 | + <button id="allDone" type="button" class="btn btn-primary">Terminer</button> | |
126 | + <button id="nextNode" type="button" class="btn btn-secondary">></button> | |
127 | + | |
128 | + | |
129 | + | |
77 | 130 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Relancer une mise à jour</h1> |
78 | 131 | <div class="form-team"> |
79 | 132 | <select multiple id="maj_name" class="form-control"> |
... | ... | @@ -90,22 +143,28 @@ nodes: |
90 | 143 | <th>Nom</th> |
91 | 144 | <th>IP</th> |
92 | 145 | <th>Architecture</th> |
146 | + <th>Capteur</th> | |
93 | 147 | </tr> |
94 | 148 | </thead> |
95 | 149 | <tbody> |
96 | - <tr th:each="node : ${nodes}"> | |
97 | - <td th:text="${node.getName()}">name</td> | |
98 | - <td th:text="${node.getIp()}">ip</td> | |
99 | - <td th:text="${node.getArch()}">arch</td> | |
100 | - </tr> | |
150 | + <div th:each="node : ${nodes}"> | |
151 | + <tr th:each="sensor : ${node.getSensors()}"> | |
152 | + <td th:text="${node.getName()}">name</td> | |
153 | + <td th:text="${node.getIp()}">ip</td> | |
154 | + <td th:text="${node.getArch()}">arch</td> | |
155 | + <td th:text="${sensor.getName()}">sensor</td> | |
156 | + </tr> | |
157 | + </div> | |
101 | 158 | </tbody> |
102 | 159 | </table> |
103 | 160 | <div class="form-team"> |
104 | 161 | <input type="text" class="form-control" id="majName" placeholder="Nom de la update" name="update" style="margin-top:20px;"> |
105 | 162 | </div> |
163 | + <br/> | |
106 | 164 | <div class="form-team"> |
107 | 165 | <input type="date" class="form-control" id="majDate" placeholder="Date de la mise à jour" name="date"> |
108 | 166 | </div> |
167 | + <br/> | |
109 | 168 | <select multiple class="form-control" style="margin-bottom:20px;" id="file_choice"> |
110 | 169 | <option value="--">--</option> |
111 | 170 | <option th:each="file : ${customerFiles}" th:value="${file}" th:utext="${file}"/> |
... | ... | @@ -133,13 +192,34 @@ nodes: |
133 | 192 | </div> |
134 | 193 | </div> |
135 | 194 | |
136 | -<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | |
137 | -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> | |
138 | -<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | |
139 | -<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script> | |
140 | -<script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script> | |
141 | -<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script> | |
142 | -<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script> | |
143 | -<script th:src="@{/js/update.js}"></script> | |
195 | + <div class="modal fade" id="warningConf" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> | |
196 | + <div class="modal-dialog modal-dialog-centered" role="document"> | |
197 | + <div class="modal-content"> | |
198 | + <div class="modal-header"> | |
199 | + <h5 class="modal-title" id="modal-title">Attention</h5> | |
200 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
201 | + <span aria-hidden="true">×</span> | |
202 | + </button> | |
203 | + </div> | |
204 | + <div id="modal-content" class="modal-body"> | |
205 | + Certains champs sont vides ! | |
206 | + </div> | |
207 | + <div class="modal-footer"> | |
208 | + <button id="modal-button" type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button> | |
209 | + </div> | |
210 | + </div> | |
211 | + </div> | |
212 | + </div> | |
213 | + | |
214 | + <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | |
215 | + <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> | |
216 | + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | |
217 | + <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script> | |
218 | + <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script> | |
219 | + <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script> | |
220 | + <script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script> | |
221 | + <script th:src="@{/js/update.js}"></script> | |
222 | + <script th:src="@{/js/nodes.js}"></script> | |
223 | + | |
144 | 224 | </body> |
145 | 225 | </html> | ... | ... |
PFE06/toflash/pfe_admin_maj.yaml deleted
PFE06/toflash/pfe_coucou.yaml deleted