Commit 6536a229d7faf4ee4b1cc5a6fa1e4452682e1514

Authored by sfeutrie
1 parent a0f630f2

modifications mineures

PFE06/src/main/java/com/PFE/ServerManager/AppConfig.java
... ... @@ -65,12 +65,12 @@ public class AppConfig {
65 65  
66 66 if(temp == null) {
67 67 customerRepository.save(n);
  68 + /* Partie sur les groupes */
  69 + Team g = new Team();
  70 + g.setTeamId((int)(teamRepository.count() +1));
  71 + g.setTeam("Labo1");
  72 + g.addCustomer(n);
  73 + teamRepository.save(g);
68 74 }
69   - /* Partie sur les groupes */
70   - Team g = new Team();
71   - g.setTeamId((int)(teamRepository.count() +1));
72   - g.setTeam("Labo1");
73   - g.addCustomer(n);
74   - teamRepository.save(g);
75 75 }
76 76 }
77 77 \ No newline at end of file
... ...
PFE06/src/main/java/com/PFE/ServerManager/Customer.java
... ... @@ -30,11 +30,6 @@ public class Customer{
30 30 @JoinTable(name = "customer_role", joinColumns = @JoinColumn(name = "customerId"), inverseJoinColumns = @JoinColumn(name = "roleId"))
31 31 private Set<Role> roles;
32 32  
33   - @ManyToMany(cascade = CascadeType.ALL)
34   - @JoinTable(name = "customer_update", joinColumns = @JoinColumn(name = "customerId"), inverseJoinColumns = @JoinColumn(name = "updateId"))
35   - private Set<Update> update;
36   -
37   -
38 33 public void setRoles(Set<Role> roles) { this.roles = roles; }
39 34 public void addRole(Role role){
40 35 if(roles == null){
... ... @@ -47,12 +42,6 @@ public class Customer{
47 42 return roles.iterator().next().getRole();
48 43 }
49 44  
50   - public void setUpdate(Set<Update> update) {
51   - this.update = update;
52   - }
53   - public Set<Update> getUpdate() {
54   - return update;
55   - }
56 45  
57 46 public void setCustomerId(Integer id) {
58 47 this.customerId = id;
... ...
PFE06/src/main/java/com/PFE/ServerManager/MainController.java
... ... @@ -149,7 +149,6 @@ public class MainController {
149 149 Role userRole = roleRepository.findByRole(role);
150 150 n.addRole(userRole);
151 151 customerRepository.save(n);
152   - System.out.println("team found : " + team);
153 152 Team temp = teamRepository.findByTeam(team);
154 153 temp.addCustomer(n);
155 154 teamRepository.save(temp);
... ... @@ -312,7 +311,6 @@ public class MainController {
312 311 }
313 312 }
314 313 List<ArrayList<String>> table = new ArrayList<>();
315   - System.out.println("size = " + updateYAMLS.size());
316 314 int i=0, j=0, k=0;
317 315  
318 316 for(Node node : nodes){
... ... @@ -326,7 +324,6 @@ public class MainController {
326 324 LocalDateTime updateDate = LocalDateTime.parse(update.getDate(),formatter_date);
327 325 LocalDateTime now = LocalDateTime.now();
328 326 if(state_sensor.get(k).equals("started")){
329   - System.out.println("Time : " + update.getTime());
330 327 System.out.println("duration between in minutes " + Duration.between(now,updateDate).toMinutes());
331 328 LocalTime duration = LocalTime.parse(update.getTime(),formatter_time);
332 329 updateDate = updateDate.plusMinutes(duration.getMinute());
... ... @@ -342,7 +339,6 @@ public class MainController {
342 339 }
343 340 k=0;
344 341 if(table.get(i).size()==j){
345   - System.out.println("fonctionne");
346 342 table.get(i).add(j,"disponible");
347 343 }
348 344 j++;
... ...
PFE06/src/main/resources/application.properties
... ... @@ -2,20 +2,13 @@
2 2 #-----------------------------------------------#
3 3 #---------- Spring Database management ---------#
4 4 #-----------------------------------------------#
5   -spring.jpa.hibernate.ddl-auto=create-drop
6   -#update
7   -#"create" ajoute les tables qui n'existent pas encore à la base de données à chaque lancement
8   -#"create-drop" supprime tout à la fin de la session donc tout est recréé à la suivante
9   -#"update" met à jour la base données
  5 +spring.jpa.hibernate.ddl-auto=update
10 6  
11 7 #Postgres config :
12   -spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only
  8 +spring.datasource.url=jdbc:postgresql://localhost:5432/nodes_manager
13 9 spring.datasource.username=postgres
14 10 spring.datasource.password=glopglop
15 11  
16   -# montre les communications JPA avec la BDD
17   -# spring.jpa.show-sql = true
18   -
19 12 # exécute le fichier data.sql pour préciser le role ADMIN
20 13 spring.datasource.initialization-mode=always
21 14  
... ...
PFE06/src/main/resources/static/js/update.js
... ... @@ -34,70 +34,43 @@ $(document).ready(function() {
34 34 }
35 35 })
36 36  
37   -
38   - /********** Configuration file ***********/
39   -
40   -
41   -
42   -
43   -
44   -
45   -
46   - /*
47   - var configName = document.getElementById("config_name");
48   - var configSend = document.getElementById("config_send");
49   - var file = document.getElementById("configInputFile");
50   - var readyToSend = false;
51   - var formData = new FormData();
52   -
53   - if(file != null) {
54   - file.addEventListener('change', function () {
55   - delete formData;
56   - formData = new FormData();
57   - configName.innerHTML = this.files[0].name;
58   - formData.append("file", this.files[0]);
59   - readyToSend = true;
60   - }, false)
61   -
62   - configSend.addEventListener('click', function () {
63   - var modalContent = document.getElementById("modal-content");
64   - var modalTitle = document.getElementById("modal-title");
65   - if (readyToSend) {
66   - var request = new XMLHttpRequest();
67   - request.open("POST", "/config");
68   -
69   - request.onreadystatechange = function () {
70   - if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
71   - var modalButton = document.getElementById("modal-button");
72   - modalButton.addEventListener('click', function (e) {
73   - location.reload();
74   - })
75   - modalContent.innerHTML = "Upload terminé !";
76   - modalTitle.innerHTML = "Félicitations";
77   - $("#warningFilesNumber").modal();
78   - }
79   - }
80   -
81   - request.send(formData);
82   - }
83   - else {
84   - modalContent.innerHTML = "Veuillez sélectionner un fichier !";
85   - $("#warningFilesNumber").modal()
86   - }
87   -
88   - })
89   - }
90   -
91   -*/
92   -
93 37 /********** Tableau **********/
94 38  
95 39 var tableNodes = $('#nodes-table').DataTable( {
96   - responsive: true,
97   - select: {
98   - style: 'multi'
99   - }
100   - } );
  40 + "language":{
  41 + "sProcessing": "Traitement en cours...",
  42 + "sSearch": "Rechercher&nbsp;:",
  43 + "sLengthMenu": "Afficher _MENU_ &eacute;l&eacute;ments",
  44 + "sInfo": "Affichage de l'&eacute;l&eacute;ment _START_ &agrave; _END_ sur _TOTAL_ &eacute;l&eacute;ments",
  45 + "sInfoEmpty": "Affichage de l'&eacute;l&eacute;ment 0 &agrave; 0 sur 0 &eacute;l&eacute;ment",
  46 + "sInfoFiltered": "(filtr&eacute; de _MAX_ &eacute;l&eacute;ments au total)",
  47 + "sInfoPostFix": "",
  48 + "sLoadingRecords": "Chargement en cours...",
  49 + "sZeroRecords": "Aucun &eacute;l&eacute;ment &agrave; afficher",
  50 + "sEmptyTable": "Aucune donn&eacute;e disponible dans le tableau",
  51 + "oPaginate": {
  52 + "sFirst": "Premier",
  53 + "sPrevious": "Pr&eacute;c&eacute;dent",
  54 + "sNext": "Suivant",
  55 + "sLast": "Dernier"
  56 + },
  57 + "oAria": {
  58 + "sSortAscending": ": activer pour trier la colonne par ordre croissant",
  59 + "sSortDescending": ": activer pour trier la colonne par ordre d&eacute;croissant"
  60 + },
  61 + "select": {
  62 + "rows": {
  63 + _: "%d lignes séléctionnées",
  64 + 0: "Aucune ligne séléctionnée",
  65 + 1: "1 ligne séléctionnée"
  66 + }
  67 + }
  68 + },
  69 + responsive: true,
  70 + select: {
  71 + style: 'multi'
  72 + }
  73 + });
101 74  
102 75 var nodeSet = new Set();
103 76 var arch = "";
... ... @@ -114,6 +87,8 @@ $(document).ready(function() {
114 87 tableNodes.rows().deselect();
115 88 nodeSet.clear();
116 89 first = true;
  90 + arch = "";
  91 + return;
117 92 }
118 93 first = false;
119 94 } );
... ...
PFE06/src/main/resources/templates/all.html
... ... @@ -79,8 +79,7 @@
79 79 </tr>
80 80 </table>
81 81 </div>
82   -
83   -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
  82 +
84 83 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
85 84 <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>
86 85 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
... ...
PFE06/src/main/resources/templates/history.html
... ... @@ -76,7 +76,6 @@
76 76 </table>
77 77 </div>
78 78  
79   -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
80 79 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
81 80 <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>
82 81 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
... ...
PFE06/src/main/resources/templates/home.html
... ... @@ -96,7 +96,6 @@
96 96 </div>
97 97  
98 98 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
99   -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
100 99 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
101 100 <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script>
102 101 <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script>
... ...
PFE06/src/main/resources/templates/login.html
... ... @@ -43,7 +43,6 @@
43 43 </div>
44 44 </div>
45 45  
46   - <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
47 46 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
48 47 <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>
49 48 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
... ...
PFE06/src/main/resources/templates/update.html
... ... @@ -46,98 +46,54 @@
46 46 </nav>
47 47  
48 48 <div class="container" style="padding-bottom: 50px;">
49   -
50   - <!--
51   -
52   - <div th:remove="tag" th:if="${customerRole} == 'ADMIN'">
53   - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Changer la configuration réseau</h1>
54   - <div class="input-team mb-3">
55   - <div class="input-team-prepend">
56   - <button id="config_send" class="btn btn-outline-secondary" type="button">Envoyer</button>
  49 + <div th:if="${customerRole}=='ADMIN'">
  50 + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Paramétrer le réseau</h1>
  51 + <div class="input-group mb-3">
  52 + <div class="input-group-prepend">
  53 + <span class="input-group-text">Nom</span>
57 54 </div>
58   - <div class="custom-file">
59   - <input type="file" class="custom-file-input" id="configInputFile">
60   - <label id="config_name" class="custom-file-label" for="configInputFile">Choisir un fichier</label>
61   - </div>
62   - </div>
63   -
64   - <div class="form-team">
65   - <label for="comment">Exemple :</label>
66   - <textarea readonly class="form-control" rows="5" id="comment">
67   -nodes:
68   - - name: AT-001
69   - ip: '85.10.201.246'
70   - arch: ARM
71   - - name: AT-002
72   - ip: '85.10.201.247'
73   - arch: ARM
74   - - name: AT-003
75   - ip: '85.10.201.248'
76   - arch: ARM
77   - </textarea>
  55 + <input id="nodeName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
78 56 </div>
79   - </div>
80   -
81   - -->
82   -
83   - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Paramétrer le réseau</h1>
84   -
85   - <div class="input-group mb-3">
86   - <div class="input-group-prepend">
87   - <span class="input-group-text">Nom</span>
88   - </div>
89   - <input id="nodeName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
90   - </div>
91   -
92   - <div class="input-group mb-3">
93   - <div class="input-group-prepend">
94   - <span class="input-group-text">IP</span>
  57 + <div class="input-group mb-3">
  58 + <div class="input-group-prepend">
  59 + <span class="input-group-text">IP</span>
  60 + </div>
  61 + <input id="nodeIP" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
95 62 </div>
96   - <input id="nodeIP" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
97   - </div>
98   -
99   - <div class="input-group mb-3">
100   - <div class="input-group-prepend">
101   - <span class="input-group-text">Architecture</span>
  63 + <div class="input-group mb-3">
  64 + <div class="input-group-prepend">
  65 + <span class="input-group-text">Architecture</span>
  66 + </div>
  67 + <input id="nodeArch" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
102 68 </div>
103   - <input id="nodeArch" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
104   - </div>
105   -
106   - <h3>Capteurs</h3><br/>
107   -
108   - <div class="input-group mb-3">
109   - <div class="input-group-prepend">
110   - <span class="input-group-text">Nom</span>
  69 + <h3>Capteurs</h3><br/>
  70 + <div class="input-group mb-3">
  71 + <div class="input-group-prepend">
  72 + <span class="input-group-text">Nom</span>
  73 + </div>
  74 + <input id="sensorName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
111 75 </div>
112   - <input id="sensorName" type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
  76 + <button id="addSensor" type="button" class="btn btn-primary" style="margin-bottom:50px;">Ajouter un capteur</button>
  77 + <table id="sensorsTable" class="table" style="margin-bottom:50px;">
  78 + </table>
  79 + <button id="addNode" type="button" class="btn btn-success" style="margin-bottom:50px;">Ajouter ce noeud</button>
  80 + <button id="editNode" type="button" class="btn btn-warning" style="margin-bottom:50px;">Appliquer les modifications</button>
  81 + <button id="delNode" type="button" class="btn btn-danger" style="margin-bottom:50px;">Supprimer ce noeud</button>
  82 + <button type="button" class="btn btn-info" data-toggle="modal" data-target="#networkDisplay" style="margin-bottom:50px;">
  83 + Afficher le réseau en création
  84 + </button>
  85 + <br/>
  86 + <button id="prevNode" type="button" class="btn btn-secondary"><</button>
  87 + <button id="allDone" type="button" class="btn btn-primary">Terminer</button>
  88 + <button id="nextNode" type="button" class="btn btn-secondary">></button>
113 89 </div>
114   -
115   - <button id="addSensor" type="button" class="btn btn-primary" style="margin-bottom:50px;">Ajouter un capteur</button>
116   -
117   - <table id="sensorsTable" class="table" style="margin-bottom:50px;">
118   - </table>
119   -
120   - <button id="addNode" type="button" class="btn btn-success" style="margin-bottom:50px;">Ajouter ce noeud</button>
121   - <button id="editNode" type="button" class="btn btn-warning" style="margin-bottom:50px;">Appliquer les modifications</button>
122   - <button id="delNode" type="button" class="btn btn-danger" style="margin-bottom:50px;">Supprimer ce noeud</button>
123   - <button type="button" class="btn btn-info" data-toggle="modal" data-target="#networkDisplay" style="margin-bottom:50px;">
124   - Afficher le réseau en création
125   - </button>
126   -
127   - <br/>
128   -
129   - <button id="prevNode" type="button" class="btn btn-secondary"><</button>
130   - <button id="allDone" type="button" class="btn btn-primary">Terminer</button>
131   - <button id="nextNode" type="button" class="btn btn-secondary">></button>
132   -
133   -
134 90 <!-- The Modal -->
135 91 <div class="modal fade" id="networkDisplay">
136 92 <div class="modal-dialog modal-dialog-centered">
137 93 <div class="modal-content">
138 94 <!-- Modal Header -->
139 95 <div class="modal-header">
140   - <h4 class="modal-title">Apercu de réseau en création</h4>
  96 + <h4 class="modal-title">Apercu du réseau en création</h4>
141 97 <button type="button" class="close" data-dismiss="modal">&times;</button>
142 98 </div>
143 99 <!-- Modal body -->
... ... @@ -244,7 +200,6 @@ nodes:
244 200 </div>
245 201  
246 202 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
247   - <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
248 203 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
249 204 <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script>
250 205 <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script>
... ...
PFE06/src/main/resources/templates/upload.html
... ... @@ -80,7 +80,6 @@
80 80 </div>
81 81 </div>
82 82 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
83   -<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
84 83 <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
85 84 <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script>
86 85 <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script>
... ...