Commit b7ef4a2ead1d8f058ee9f069696bf4eac432f286

Authored by Unknown
2 parents 127ac924 f1c88101

Merge remote-tracking branch 'origin/master'

PFE06/src/main/java/com/PFE/ServerManager/MainController.java
... ... @@ -35,8 +35,8 @@ public class MainController {
35 35 BCryptPasswordEncoder bCryptPasswordEncoder;
36 36  
37 37 @GetMapping(value="/")
38   - public String homeRedirection(){
39   - return "redirect:home";
  38 + public String uploadRedirection(){
  39 + return "redirect:upload";
40 40 }
41 41  
42 42 @GetMapping(value="/home")
... ... @@ -50,6 +50,17 @@ public class MainController {
50 50 return modelAndView;
51 51 }
52 52  
  53 + @GetMapping(value="/upload")
  54 + public ModelAndView upload() {
  55 + ModelAndView modelAndView = new ModelAndView();
  56 + Authentication auth = SecurityContextHolder.getContext().getAuthentication();
  57 + Customer customer = customerRepository.findByEmail(auth.getName());
  58 + modelAndView.addObject("customerName", customer.getEmail().split("@")[0]);
  59 + modelAndView.addObject("customerRole", customer.getRole());
  60 + modelAndView.setViewName("upload");
  61 + return modelAndView;
  62 + }
  63 +
53 64 @GetMapping(value="/session")
54 65 public ModelAndView session() {
55 66 ModelAndView modelAndView = new ModelAndView();
... ... @@ -76,8 +87,8 @@ public class MainController {
76 87 }
77 88  
78 89 modelAndView.addObject("customerFiles", filesName);
79   -
80 90 modelAndView.setViewName("session");
  91 +
81 92 return modelAndView;
82 93 }
83 94  
... ... @@ -109,6 +120,7 @@ public class MainController {
109 120 Customer temp = customerRepository.findByEmail(email);
110 121 Role userRole = roleRepository.findByRole(role);
111 122 n.setRoles(new HashSet<Role>(Arrays.asList(userRole)));
  123 +
112 124 //utilisé uniquement pour continuer à afficher l'utilisateur connecté//
113 125 Authentication auth = SecurityContextHolder.getContext().getAuthentication();
114 126 Customer customer = customerRepository.findByEmail(auth.getName());
... ... @@ -116,6 +128,9 @@ public class MainController {
116 128 modelAndView.addObject("customerRole", customer.getRole());
117 129 modelAndView.setViewName("registration");
118 130  
  131 + List<Customer> list = customerRepository.findAll(); // attention : la méthode findAll() de JpaRepository retourne une liste alors que celle de CrudRepository retourne un itérable
  132 + modelAndView.addObject("list", list);
  133 +
119 134 if(temp != null) {
120 135 modelAndView.addObject("message", "L'utilisateur existe déjà !");
121 136 modelAndView.addObject("fail", true);
... ... @@ -140,7 +155,6 @@ public class MainController {
140 155 dirs.mkdirs();
141 156 OutputStream outputStream = null;
142 157 InputStream inputStream = null;
143   -
144 158 try {
145 159 inputStream = file.getInputStream();
146 160 File newFile = new File(dirs.getPath() + "/" + file.getOriginalFilename());
... ... @@ -155,17 +169,14 @@ public class MainController {
155 169 outputStream.write(bytes, 0, read);
156 170 }
157 171 }
158   -
159 172 catch (IOException e) {
160 173 e.printStackTrace();
161 174 }
162   -
163 175 finally {
164 176 try {
165 177 outputStream.close();
166 178 }
167 179 catch(IOException e) {
168   -
169 180 }
170 181 }
171 182 }
... ... @@ -193,32 +204,24 @@ public class MainController {
193 204 return modelAndView;
194 205 }
195 206  
196   -
197   - @GetMapping(value="/success")
198   - public String success(){
199   - return "success";
200   - }
201   -
202   - @GetMapping(path="/test")
203   - public String testGet() {
204   - return "test";
205   - }
206   -
207 207 @PostMapping(path="/savemaj")
208 208 public String saveMaj(@RequestParam String name, @RequestParam String date, @RequestParam String nodes, @RequestParam String file){
209 209 Authentication auth = SecurityContextHolder.getContext().getAuthentication();
210 210 Customer customer = customerRepository.findByEmail(auth.getName());
  211 +
211 212 Maj maj_c = new Maj();
212 213 maj_c.setMaj(name);
213 214 maj_c.setDate(date);
214 215 maj_c.setNodes(nodes);
215 216 maj_c.setFile(file);
216 217 maj_c.setMaj_id((int)(majRepository.count() + 1));
  218 +
217 219 majRepository.save(maj_c); // ajouter la mise a jour dans la table
218 220 HashSet<Maj> majs = new HashSet<Maj>(Arrays.asList(maj_c));
219 221 majs.addAll(customer.getMaj());
220 222 customer.setMaj(majs);
221 223 customerRepository.save(customer); // permet de rendre effective la jointure entre customer et maj
  224 +
222 225 return "redirect:/session";
223 226 }
224 227 }
225 228 \ No newline at end of file
... ...
PFE06/src/main/resources/application.properties
... ... @@ -8,9 +8,9 @@ spring.jpa.hibernate.ddl-auto=create
8 8 #"update" met à jour la base données
9 9  
10 10 #Postgres config :
11   -spring.datasource.url=jdbc:postgresql://localhost:3306/sql_only
  11 +spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only
12 12 spring.datasource.username=postgres
13   -spring.datasource.password=admin
  13 +spring.datasource.password=glopglop
14 14  
15 15  
16 16 # montre les communications JPA avec la BDD
... ...
PFE06/src/main/resources/static/css/upload.css 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +body { background-color: #FFF; }
  2 +
  3 +.upload-drop-zone {
  4 + height: 200px;
  5 + border-width: 2px;
  6 + margin-bottom: 20px;
  7 + color: #ccc;
  8 + border-style: dashed;
  9 + border-color: #ccc;
  10 + line-height: 200px;
  11 + text-align: center
  12 +}
  13 +
  14 +.theme-dropdown .dropdown-menu {
  15 + position: static;
  16 + display: block;
  17 + margin-bottom: 20px;
  18 +}
  19 +
  20 +.theme-showcase > p > .btn {
  21 + margin: 5px 0;
  22 +}
  23 +
  24 +.theme-showcase .navbar .container {
  25 + width: auto;
  26 +}
... ...
PFE06/src/main/resources/static/js/upload.js 0 → 100644
... ... @@ -0,0 +1,101 @@
  1 +$(document).ready(function() {
  2 +
  3 +/********** Drop Zone **********/
  4 +
  5 + var formData = new FormData();
  6 + var dropZone = document.querySelector("#drop-zone");
  7 + dropZone.style.cursor = "pointer";
  8 + var file = document.getElementById("filesExplorer");
  9 + var fileProgress = document.getElementById("file-progress");
  10 + var readyToSend = false;
  11 +
  12 + dropZone.addEventListener('click', function() {
  13 + delete formData;
  14 + formData = new FormData();
  15 + file.click();
  16 + })
  17 +
  18 + file.addEventListener('change', function() {
  19 + dropZone.innerHTML = this.files[0].name;
  20 + formData.append("file", this.files[0]);
  21 + readyToSend = true;
  22 + }, false)
  23 +
  24 + dropZone.addEventListener('drop', function(e) {
  25 + e.preventDefault();
  26 + delete formData;
  27 + formData = new FormData();
  28 + dropZone.style.borderWidth = '2px';
  29 + var files = e.dataTransfer.files;
  30 +
  31 + if(files.length > 1) {
  32 + $("#warningFilesNumber").modal()
  33 + return;
  34 + }
  35 + dropZone.innerHTML = files[0].name;
  36 + formData.append("file", files[0]);
  37 + readyToSend = true;
  38 + }, false)
  39 +
  40 + dropZone.addEventListener('dragenter', function(e) {
  41 + console.log("Enter");
  42 + dropZone.style.borderWidth = '5px';
  43 + }, false);
  44 +
  45 + dropZone.addEventListener('dragleave', function(e) {
  46 + console.log("Leave");
  47 + dropZone.style.borderWidth = '2px';
  48 + }, false);
  49 +
  50 + dropZone.addEventListener('dragover', function(e) {
  51 + e.preventDefault();
  52 + }, false);
  53 +
  54 + document.getElementById("sendButton").addEventListener('click', function() {
  55 + var modalContent = document.getElementById("modal-content");
  56 + var modalTitle = document.getElementById("modal-title");
  57 + if(readyToSend) {
  58 + var request = new XMLHttpRequest();
  59 + request.open("POST", "/file");
  60 +
  61 + request.upload.onloadstart = function(e) {
  62 + fileProgress.style.display = 'block';
  63 + fileProgress.style.width = 0 + "px"
  64 + fileProgress.innerHTML = "0%";
  65 + }
  66 +
  67 + request.upload.onprogress = function(e) {
  68 + var p = 100 - ((e.total - e.loaded) / e.total * 100);
  69 + fileProgress.style.width = Math.ceil(p) + "%"
  70 + fileProgress.innerHTML = Math.ceil(p) + "%";
  71 + }
  72 +
  73 + request.upload.onloadend = function(e) {
  74 + fileProgress.style.width = 100 + "%"
  75 + fileProgress.innerHTML = "100%";
  76 + var modalButton = document.getElementById("modal-button");
  77 +
  78 + modalButton.addEventListener('click', function(e) {
  79 + location.reload();
  80 + })
  81 +
  82 + modalContent.innerHTML = "Upload terminé !";
  83 + modalTitle.innerHTML = "Félicitations";
  84 + $("#warningFilesNumber").modal()
  85 + }
  86 +
  87 + request.onreadystatechange = function() {
  88 + if(this.readyState === XMLHttpRequest.DONE && this.status === 200) {
  89 + formData = new FormData();
  90 + }
  91 + }
  92 +
  93 + request.send(formData);
  94 +
  95 + }
  96 + else {
  97 + modalContent.innerHTML = "Veuillez choisir un fichier !";
  98 + }
  99 + })
  100 +
  101 +} );
... ...
PFE06/src/main/resources/templates/all.html
1 1 <!DOCTYPE html>
2 2 <html xmlns:th="http://www.thymeleaf.org">
3 3 <head>
4   -
5 4 <meta charset="utf-8">
6 5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7   -
8 6 <link rel="stylesheet" th:href="@{/css/all.css}">
9 7 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
10   -
11   - <title>Listes des utilisateurs dans la base de donnée</title>
  8 + <title>Listes des utilisateurs dans la base de données</title>
12 9 </head>
13 10 <body>
14   -
15   -<div id="app">
16 11 <!-- NAV BAR -->
17   - <div id="app">
18   - <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
19   - <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
20   - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
21   - <span class="navbar-toggler-icon"></span>
22   - </button>
23   - <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
24   - <div class="navbar-nav">
25   - <a class="nav-item nav-link active" th:href="@{/home}">Gestion des noeuds <span class="sr-only">(current)</span></a>
26   - <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a>
27   - <li class="nav-item dropdown">
28   - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a>
29   - <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
30   - <div th:switch="${customerRole}">
31   - <div th:case="'ADMIN'">
32   - <a class="dropdown-item" th:href="@{/registration}">Enregistrer des utilisateurs</a>
33   - <a class="dropdown-item" th:href="@{/all}">Listes des utilisateurs</a>
34   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
35   - </div>
36   - <div th:case="'USER'">
37   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
38   - </div>
39   - </div>
40   - <a class="dropdown-item" href="#">A ajouter...</a>
41   - </div>
42   - </li>
43   - <a class="nav-item nav-link disabled" href="#">Documentations</a>
  12 + <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  13 + <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
  14 + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
  15 + <span class="navbar-toggler-icon"></span>
  16 + </button>
  17 + <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
  18 + <div class="navbar-nav mr-auto">
  19 + <a class="nav-item nav-link" th:href="@{/home}">Accueil</a>
  20 + <a class="nav-item nav-link" th:href="@{/upload}">Gestion des noeuds</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 active" th:href="@{/all}">Listes des utilisateurs</a>
  25 + <a class="nav-item nav-link" th:href="@{/session}">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="@{/session}">Paramétrer une mise à jour</a>
  29 + </div>
44 30 </div>
45 31 </div>
46   - </nav>
47   -
48   - <!-- TABLE PART -->
49   -
50   - <div class="container">
51   -
52   - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Liste des utilisateurs</h1>
53   -
54   - <table class="table table-striped table-bordered">
55   - <tr>
56   - <th scope="col">Email</th>
57   - <th scope="col">Role</th>
58   - <th scope="col">ID</th>
59   - </tr>
60   - <tr th:each="prod : ${list}">
61   - <td th:text="${prod.getEmail()}">Email</td>
62   - <td th:text="${prod.getRole()}">Role</td>
63   - <td th:text="${prod.customer_id}">ID</td>
64   - </tr>
65   - </table>
66 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 + </nav>
67 39  
68   -</div>
  40 + <!-- TABLE PART -->
  41 + <div class="container">
  42 + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Liste des utilisateurs</h1>
  43 + <table class="table table-striped table-bordered">
  44 + <tr>
  45 + <th scope="col">Email</th>
  46 + <th scope="col">Role</th>
  47 + <th scope="col">ID</th>
  48 + </tr>
  49 + <tr th:each="prod : ${list}">
  50 + <td th:text="${prod.getEmail()}">Email</td>
  51 + <td th:text="${prod.getRole()}">Role</td>
  52 + <td th:text="${prod.customer_id}">ID</td>
  53 + </tr>
  54 + </table>
  55 + </div>
69 56  
70 57 <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
71 58 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
... ...
PFE06/src/main/resources/templates/home.html
1 1 <!DOCTYPE html>
2 2 <html xmlns:th="http://www.thymeleaf.org">
3 3 <html lang="en">
4   - <head>
5   -
  4 +<head>
6 5 <meta charset="utf-8">
7 6 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
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 <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
10   -
11 9 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
12 10 <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css">
13 11 <link rem="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css">
14   - <link rel="stylesheet" th:href="@{/css/home.css}">
  12 + <link rel="stylesheet" th:href="@{/css/upload.css}">
15 13 <title>Accueil</title>
16   - </head>
17   -
18   - <body>
19   - <div id="app">
20   - <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
21   - <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
22   - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
23   - <span class="navbar-toggler-icon"></span>
24   - </button>
25   - <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
26   - <div class="navbar-nav">
27   - <a class="nav-item nav-link active" th:href="@{/home}">Gestion des noeuds <span class="sr-only">(current)</span></a>
28   - <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a>
29   - <li class="nav-item dropdown">
30   - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a>
31   - <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
32   - <div th:switch="${customerRole}">
33   - <div th:case="'ADMIN'">
34   - <a class="dropdown-item" th:href="@{/registration}">Enregistrer des utilisateurs</a>
35   - <a class="dropdown-item" th:href="@{/all}">Listes des utilisateurs</a>
36   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
37   - </div>
38   - <div th:case="'USER'">
39   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
40   - </div>
41   - </div>
42   - <a class="dropdown-item" href="#">A ajouter...</a>
43   - </div>
44   - </li>
45   - <a class="nav-item nav-link disabled" href="#">Documentations</a>
46   - </div>
47   - </div>
48   - </nav>
  14 +</head>
49 15  
50   - <div class="container" style="padding-bottom: 50px;">
51   - <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Uploader un fichier</h1>
52   - <div class="panel panel-default">
53   - <h4>Choix du fichier</h4>
54   - <input id="filesExplorer" type="file" style="display:none"></input>
55   - <div class="upload-drop-zone" id="drop-zone">
56   - Clic ou dépose un fichier ici
57   - </div>
58   - <div class="progress">
59   - <div id="file-progress" class="progress-bar" role="progressbar" style="width: 75%; display:none">25%</div>
  16 +<body>
  17 + <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  18 + <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
  19 + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
  20 + <span class="navbar-toggler-icon"></span>
  21 + </button>
  22 + <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
  23 + <div class="navbar-nav mr-auto">
  24 + <a class="nav-item nav-link active" th:href="@{/home}">Accueil</a>
  25 + <a class="nav-item nav-link" th:href="@{/upload}">Gestion des noeuds</a>
  26 + <div th:remove="tag" th:switch="${customerRole}">
  27 + <div th:remove="tag" th:case="'ADMIN'">
  28 + <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a>
  29 + <a class="nav-item nav-link" th:href="@{/all}">Listes des utilisateurs</a>
  30 + <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a>
  31 + </div>
  32 + <div th:remove="tag" th:case="'USER'">
  33 + <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a>
  34 + </div>
60 35 </div>
61   - </div>
62   - <button id="sendButton" type="button" class="btn btn-secondary btn-lg btn-block"style="margin-top:50px;">Envoyer</button>
63 36 </div>
64   - </div>
65   -
66   - <div class="modal fade" id="warningFilesNumber" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
67   - <div class="modal-dialog modal-dialog-centered" role="document">
68   - <div class="modal-content">
69   - <div class="modal-header">
70   - <h5 class="modal-title" id="modal-title">Attention</h5>
71   - <button type="button" class="close" data-dismiss="modal" aria-label="Close">
72   - <span aria-hidden="true">&times;</span>
73   - </button>
74   - </div>
75   - <div id="modal-content" class="modal-body">
76   - Un seul fichier peut être envoyé !
77   - </div>
78   - <div class="modal-footer">
79   - <button id="modal-button" type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
  37 + </div>
  38 + <div class="collapse navbar-collapse ml-3" id="navbarNavAltMarkup2" >
  39 + <div class="navbar-nav ml-auto">
  40 + <a class="nav-item nav-link btn btn-danger active" th:href="@{/logout}">Déconnexion</a>
80 41 </div>
81   - </div>
82 42 </div>
83   - </div>
  43 + </nav>
84 44  
  45 + <div class="container" style="padding-bottom: 50px;">
  46 + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Accueil</h1>
85 47 </div>
86   - <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
87   - <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
88   - <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
89   - <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script>
90   - <script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script>
91   - <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script>
92   - <script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script>
93   - <script th:src="@{/js/home.js}"></script>
94   - </body>
  48 +
  49 +<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  50 +<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
  51 +<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  52 +<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script>
  53 +<script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script>
  54 +<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script>
  55 +<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script>
  56 +<script th:src="@{/js/upload.js}"></script>
  57 +</body>
95 58 </html>
... ...
PFE06/src/main/resources/templates/registration.html
... ... @@ -2,42 +2,37 @@
2 2 <html xmlns:th="http://www.thymeleaf.org">
3 3 <html lang="fr">
4 4 <head>
5   - <title>Enregistrement de nouveaux utilisateurs</title>
6 5 <meta charset="utf-8">
7 6 <meta name="viewport" content="width=device-width, initial-scale=0.8, shrink-to-fit=no">
8 7 <link rel="stylesheet" th:href="@{/css/registration.css}">
9 8 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  9 + <title>Enregistrement de nouveaux utilisateurs</title>
10 10 </head>
11 11 <body>
12   -
13   -<div id="app">
14   -
15 12 <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
16 13 <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
17 14 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
18 15 <span class="navbar-toggler-icon"></span>
19 16 </button>
20 17 <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
21   - <div class="navbar-nav">
22   - <a class="nav-item nav-link active" th:href="@{/home}">Gestion des noeuds <span class="sr-only">(current)</span></a>
23   - <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a>
24   - <li class="nav-item dropdown">
25   - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a>
26   - <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
27   - <div th:switch="${customerRole}">
28   - <div th:case="'ADMIN'">
29   - <a class="dropdown-item" th:href="@{/registration}">Enregistrer des utilisateurs</a>
30   - <a class="dropdown-item" th:href="@{/all}">Listes des utilisateurs</a>
31   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
32   - </div>
33   - <div th:case="'USER'">
34   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
35   - </div>
36   - </div>
37   - <a class="dropdown-item" href="#">A ajouter...</a>
  18 + <div class="navbar-nav mr-auto">
  19 + <a class="nav-item nav-link" th:href="@{/home}">Accueil</a>
  20 + <a class="nav-item nav-link" th:href="@{/upload}">Gestion des noeuds</a>
  21 + <div th:remove="tag" th:switch="${customerRole}">
  22 + <div th:remove="tag" th:case="'ADMIN'">
  23 + <a class="nav-item nav-link active" th:href="@{/registration}">Enregistrer des utilisateurs</a>
  24 + <a class="nav-item nav-link" th:href="@{/all}">Listes des utilisateurs</a>
  25 + <a class="nav-item nav-link" th:href="@{/session}">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="@{/session}">Paramétrer une mise à jour</a>
38 29 </div>
39   - </li>
40   - <a class="nav-item nav-link disabled" href="#">Documentations</a>
  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>
41 36 </div>
42 37 </div>
43 38 </nav>
... ... @@ -63,10 +58,10 @@
63 58  
64 59 <form id="Login" th:action="@{/registration}" method="POST">
65 60 <div class="form-group">
66   - <input type="text" v-model="user.login" class="form-control" id="username" placeholder="Entrer le pseudo" name="email">
  61 + <input type="text" class="form-control" id="username" placeholder="Entrer le pseudo" name="email">
67 62 </div>
68 63 <div class="form-group">
69   - <input type="password" v-model="user.password" class="form-control" id="password" placeholder="Entrer le mot de passe" name="password">
  64 + <input type="password" class="form-control" id="password" placeholder="Entrer le mot de passe" name="password">
70 65 </div>
71 66 <div class="form3">
72 67 <input type="radio" id="role1" name="role" value="ADMIN">
... ... @@ -77,11 +72,9 @@
77 72 </div>
78 73 <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button>
79 74 </form>
80   -
81 75 </div>
82 76 </div>
83 77  
84   -
85 78 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
86 79 <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>
87 80 <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/session.html
... ... @@ -2,66 +2,55 @@
2 2 <html xmlns:th="http://www.thymeleaf.org">
3 3 <html lang="en">
4 4 <head>
5   -
6 5 <meta charset="utf-8">
7 6 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
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 <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
10   -
11 9 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
12 10 <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css">
13 11 <link rem="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css">
14   - <link rel="stylesheet" th:href="@{/css/home.css}">
  12 + <link rel="stylesheet" th:href="@{/css/upload.css}">
15 13 <title>Session</title>
16 14 </head>
17 15  
18 16 <body>
19   -<div id="app">
20   -
21 17 <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
22 18 <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
23 19 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
24 20 <span class="navbar-toggler-icon"></span>
25 21 </button>
26 22 <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
27   - <div class="navbar-nav">
28   - <a class="nav-item nav-link active" th:href="@{/home}">Gestion des noeuds <span class="sr-only">(current)</span></a>
29   - <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a>
30   - <li class="nav-item dropdown">
31   - <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a>
32   - <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
33   - <div th:switch="${customerRole}">
34   - <div th:case="'ADMIN'">
35   - <a class="dropdown-item" th:href="@{/registration}">Enregistrer des utilisateurs</a>
36   - <a class="dropdown-item" th:href="@{/all}">Listes des utilisateurs</a>
37   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
38   - </div>
39   - <div th:case="'USER'">
40   - <a class="dropdown-item" th:href="@{/session}">Paramétrer une mise à jour</a>
41   - </div>
42   - </div>
43   - <a class="dropdown-item" href="#">A ajouter...</a>
  23 + <div class="navbar-nav mr-auto">
  24 + <a class="nav-item nav-link" th:href="@{/home}">Accueil</a>
  25 + <a class="nav-item nav-link" th:href="@{/upload}">Gestion des noeuds</a>
  26 + <div th:remove="tag" th:switch="${customerRole}">
  27 + <div th:remove="tag" th:case="'ADMIN'">
  28 + <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a>
  29 + <a class="nav-item nav-link" th:href="@{/all}">Listes des utilisateurs</a>
  30 + <a class="nav-item nav-link active" th:href="@{/session}">Paramétrer une mise à jour</a>
44 31 </div>
45   - </li>
46   - <a class="nav-item nav-link disabled" href="#">Documentations</a>
  32 + <div th:remove="tag" th:case="'USER'">
  33 + <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a>
  34 + </div>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + <div class="collapse navbar-collapse ml-3" id="navbarNavAltMarkup2" >
  39 + <div class="navbar-nav ml-auto">
  40 + <a class="nav-item nav-link btn btn-danger active" th:href="@{/logout}">Déconnexion</a>
47 41 </div>
48 42 </div>
49 43 </nav>
50 44  
51 45 <div class="container" style="padding-bottom: 50px;">
52   -
53 46 <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Relancer une mise à jour</h1>
54   -
55 47 <div class="form-group">
56   -
57 48 <select multiple class="form-control">
58 49 <option value="">--</option>
59 50 <option th:each="maj : ${customerMaj}" th:value="${maj.getMaj_id()}" th:utext="${maj.getMaj()}"/>
60 51 </select>
61   -
62 52 <button id="start_maj" type="submit" class="btn btn-primary" style="margin-top:20px;">Lancer la mise à jour</button>
63 53 </div>
64   -
65 54 <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Créer une mise à jour</h1>
66 55 <table id="nodes-table" class="table table-striped table-bordered dt-responsive nowrap">
67 56 <thead>
... ... @@ -100,15 +89,12 @@
100 89 <div class="form-group">
101 90 <input type="date" class="form-control" id="majDate" placeholder="Date de la mise à jour" name="date">
102 91 </div>
103   -
104 92 <select multiple class="form-control" style="margin-bottom:20px;" id="file_choice">
105 93 <option value="">--</option>
106 94 <option th:each="file : ${customerFiles}" th:value="${file}" th:utext="${file}"/>
107 95 </select>
108   -
109 96 <button id="save_maj" type="submit" class="btn btn-primary">Sauvegarder la mise à jour</button>
110 97 <button id="run_maj" type="submit" class="btn btn-primary">Lancer la mise à jour</button>
111   -
112 98 </div>
113 99  
114 100 <div class="modal fade" id="warningFilesNumber" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
... ... @@ -130,10 +116,6 @@
130 116 </div>
131 117 </div>
132 118  
133   -
134   -</div>
135   -
136   -</div>
137 119 <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
138 120 <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
139 121 <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/success.html deleted
... ... @@ -1,10 +0,0 @@
1   -<!DOCTYPE html>
2   -<html lang="en">
3   -<head>
4   - <meta charset="UTF-8">
5   - <title>SUCCESS</title>
6   -</head>
7   -<body>
8   -<a href="/login">connexion</a>
9   -</body>
10   -</html>
11 0 \ No newline at end of file
PFE06/src/main/resources/templates/test.html deleted
... ... @@ -1,25 +0,0 @@
1   -<!DOCTYPE html>
2   -<html xmlns:th="http://www.thymeleaf.org">
3   -<html lang="en">
4   - <head>
5   - <meta charset="UTF-8">
6   - <title>Data from js test</title>
7   - </head>
8   - <body>
9   - <form id="Login" th:action="@{/test}" method="POST">
10   - <div class="form-group">
11   - <input type="text" class="form-control" id="maj" placeholder="Entrer le nom de la maj" name="maj">
12   - </div>
13   - <div class="form-group">
14   - <input type="text" class="form-control" id="date" placeholder="Entrer la date" name="date">
15   - </div>
16   - <div class="form-group">
17   - <input type="text" class="form-control" id="set1" placeholder="set1" name="set1">
18   - </div>
19   - <div class="form-group">
20   - <input type="text" class="form-control" id="set2" placeholder="set2" name="set2">
21   - </div>
22   - <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button>
23   - </form>
24   - </body>
25   -</html>
26 0 \ No newline at end of file
PFE06/src/main/resources/templates/upload.html 0 → 100644
... ... @@ -0,0 +1,88 @@
  1 +<!DOCTYPE html>
  2 +<html xmlns:th="http://www.thymeleaf.org">
  3 +<html lang="en">
  4 +<head>
  5 + <meta charset="utf-8">
  6 + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  8 + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
  9 + <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
  10 + <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css">
  11 + <link rem="stylesheet" href="https://cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css">
  12 + <link rel="stylesheet" th:href="@{/css/upload.css}">
  13 + <title>Accueil</title>
  14 +</head>
  15 +
  16 +<body>
  17 + <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  18 + <span class="navbar-brand"> ID : <span th:text="${customerName}" th:remove="tag">Documentations</span></span>
  19 + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
  20 + <span class="navbar-toggler-icon"></span>
  21 + </button>
  22 + <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
  23 + <div class="navbar-nav mr-auto">
  24 + <a class="nav-item nav-link" th:href="@{/home}">Accueil</a>
  25 + <a class="nav-item nav-link active" th:href="@{/upload}">Gestion des noeuds</a>
  26 + <div th:remove="tag" th:switch="${customerRole}">
  27 + <div th:remove="tag" th:case="'ADMIN'">
  28 + <a class="nav-item nav-link" th:href="@{/registration}">Enregistrer des utilisateurs</a>
  29 + <a class="nav-item nav-link" th:href="@{/all}">Listes des utilisateurs</a>
  30 + <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a>
  31 + </div>
  32 + <div th:remove="tag" th:case="'USER'">
  33 + <a class="nav-item nav-link" th:href="@{/session}">Paramétrer une mise à jour</a>
  34 + </div>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + <div class="collapse navbar-collapse ml-3" id="navbarNavAltMarkup2" >
  39 + <div class="navbar-nav ml-auto">
  40 + <a class="nav-item nav-link btn btn-danger active" th:href="@{/logout}">Déconnexion</a>
  41 + </div>
  42 + </div>
  43 + </nav>
  44 +
  45 + <div class="container" style="padding-bottom: 50px;">
  46 + <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Uploader un fichier</h1>
  47 + <div class="panel panel-default">
  48 + <h4>Choix du fichier</h4>
  49 + <input id="filesExplorer" type="file" style="display:none"></input>
  50 + <div class="upload-drop-zone" id="drop-zone">
  51 + Clic ou dépose un fichier ici
  52 + </div>
  53 + <div class="progress">
  54 + <div id="file-progress" class="progress-bar" role="progressbar" style="width: 75%; display:none">25%</div>
  55 + </div>
  56 + </div>
  57 + <button id="sendButton" type="button" class="btn btn-secondary btn-lg btn-block"style="margin-top:50px;">Envoyer</button>
  58 + </div>
  59 + </div>
  60 +
  61 + <div class="modal fade" id="warningFilesNumber" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  62 + <div class="modal-dialog modal-dialog-centered" role="document">
  63 + <div class="modal-content">
  64 + <div class="modal-header">
  65 + <h5 class="modal-title" id="modal-title">Attention</h5>
  66 + <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  67 + <span aria-hidden="true">&times;</span>
  68 + </button>
  69 + </div>
  70 + <div id="modal-content" class="modal-body">
  71 + Un seul fichier peut être envoyé !
  72 + </div>
  73 + <div class="modal-footer">
  74 + <button id="modal-button" type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
  75 + </div>
  76 + </div>
  77 + </div>
  78 + </div>
  79 +<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  80 +<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
  81 +<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  82 +<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" charset="utf-8"></script>
  83 +<script src="https://cdn.datatables.net/select/1.2.7/js/dataTables.select.min.js" charset="utf-8"></script>
  84 +<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script>
  85 +<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js" charset="utf-8"></script>
  86 +<script th:src="@{/js/upload.js}"></script>
  87 +</body>
  88 +</html>
... ...