Moved frontend of REST Mock to frontend container (solves #168)
Co-authored-by: Adam Bem <adam.bem@zoho.eu> Reviewed-on: #186 Reviewed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
		| @@ -1,27 +0,0 @@ | |||||||
| package com.r11.tools.controller; |  | ||||||
|  |  | ||||||
| import lombok.SneakyThrows; |  | ||||||
| import org.springframework.stereotype.Controller; |  | ||||||
| import org.springframework.web.bind.annotation.GetMapping; |  | ||||||
| import org.springframework.web.bind.annotation.RequestMapping; |  | ||||||
| import org.springframework.web.servlet.ModelAndView; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Class responsible for returning homepage html |  | ||||||
|  * @author Gabriel Modzelewski |  | ||||||
|  */ |  | ||||||
| @Controller |  | ||||||
| @RequestMapping("/") |  | ||||||
| public class MainController { |  | ||||||
|     /** |  | ||||||
|      * Default path to get the homepage |  | ||||||
|      * @return the view of homepage |  | ||||||
|      */ |  | ||||||
|     @SneakyThrows |  | ||||||
|     @GetMapping |  | ||||||
|     public ModelAndView showHome(){ |  | ||||||
|         ModelAndView mov = new ModelAndView(); |  | ||||||
|         mov.setViewName("html/mock"); |  | ||||||
|         return mov; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB | 
| @@ -42,7 +42,7 @@ function init() { | |||||||
|     tools.set("xslt", "tools/xslt.html"); |     tools.set("xslt", "tools/xslt.html"); | ||||||
|     tools.set("xmlform", "tools/xmlFormatter.html"); |     tools.set("xmlform", "tools/xmlFormatter.html"); | ||||||
|     tools.set("jsonform", "tools/jsonFormatter.html"); |     tools.set("jsonform", "tools/jsonFormatter.html"); | ||||||
|     tools.set("mock", getMockHost()); |     tools.set("mock", "tools/mock.html"); | ||||||
|  |  | ||||||
|     changeActiveTools('XML'); |     changeActiveTools('XML'); | ||||||
|     loadLastPage(); |     loadLastPage(); | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ var json = {}; | |||||||
| var jsonIndex = 0; | var jsonIndex = 0; | ||||||
| var lastId = 1; | var lastId = 1; | ||||||
| var htable_row = 0; | var htable_row = 0; | ||||||
| var host = getDomain(); | var host = window.location.protocol + "//" + window.location.hostname + ":8097"; | ||||||
| var dataModified = false; | var dataModified = false; | ||||||
| const addMessageName = 'addMessage'; | const addMessageName = 'addMessage'; | ||||||
| const loadMessageName = 'changeMessage'; | const loadMessageName = 'changeMessage'; | ||||||
| @@ -65,28 +65,6 @@ function clearDataField() { | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * The `escapeHTML` function is used to escape special characters in an HTML element's innerHTML property. |  | ||||||
|  * This is done to prevent these characters from being interpreted as HTML tags or attributes,  |  | ||||||
|  * which could potentially cause security vulnerabilities or unintended behavior. |  | ||||||
|  *  |  | ||||||
|  * @function |  | ||||||
|  * @name escapeHTML |  | ||||||
|  * @kind function |  | ||||||
|  * @param {any} element |  | ||||||
|  * @returns {void} |  | ||||||
|  */ |  | ||||||
| function escapeHTML(elementID) { |  | ||||||
|     document.getElementById(elementID).innerHTML = document.getElementById(elementID).innerHTML |  | ||||||
|         .replace(/&/g, "&") |  | ||||||
|         .replace(/</g, "<") |  | ||||||
|         .replace(/>/g, ">") |  | ||||||
|         .replace(/"/g, """) |  | ||||||
|         .replace(/'/g, "'"); |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
| * It fills the XML area with a sample XML. | * It fills the XML area with a sample XML. | ||||||
| *  | *  | ||||||
| @@ -111,6 +89,16 @@ function fillDefaultXML(element) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  | * It fills the XSD area with a sample XSD and XML area with matching XML. | ||||||
|  | *  | ||||||
|  | * @function | ||||||
|  | * @name fillDefaultXSD | ||||||
|  | * @kind function | ||||||
|  | * @param {any} element | ||||||
|  | * @returns {void} | ||||||
|  | */ | ||||||
| function fillDefaultXSD(){ | function fillDefaultXSD(){ | ||||||
|     const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086"; |     const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086"; | ||||||
|     fetch(serverAddress + "/assets/samples/sampleXSD.xsd") |     fetch(serverAddress + "/assets/samples/sampleXSD.xsd") | ||||||
|   | |||||||
| @@ -5,7 +5,6 @@ | |||||||
|     <link rel="stylesheet" href="assets/css/frame.css"> |     <link rel="stylesheet" href="assets/css/frame.css"> | ||||||
|     <script src="assets/scripts/common/jquery-3.6.0.slim.min.js"></script> |     <script src="assets/scripts/common/jquery-3.6.0.slim.min.js"></script> | ||||||
|     <script src="assets/scripts/frame.js"></script> |     <script src="assets/scripts/frame.js"></script> | ||||||
|     <!-- <link rel="stylesheet" href="common.css"> --> |  | ||||||
|     <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon">  |     <link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon">  | ||||||
|     <!-- Meta tags for SEO and SEM --> |     <!-- Meta tags for SEO and SEM --> | ||||||
|     <title>Release11 Web Tools</title> |     <title>Release11 Web Tools</title> | ||||||
|   | |||||||
| @@ -3,12 +3,10 @@ | |||||||
| <head> | <head> | ||||||
|     <title>R11 MockedServices</title> |     <title>R11 MockedServices</title> | ||||||
|     <meta charset="utf-8"> |     <meta charset="utf-8"> | ||||||
|     <link rel="stylesheet" href="../css/fontello.css" type="text/css"> |     <link rel="stylesheet" href="../assets/css/tools/mock/fontello.css" type="text/css"> | ||||||
|     <link rel="stylesheet" href="../css/main.css" type="text/css"> |     <link rel="stylesheet" href="../assets/css/tools/mock/main.css" type="text/css"> | ||||||
|     <!-- <link rel="stylesheet" href="css/common.css" type="text/css"> --> |     <link rel="stylesheet" href="../assets/css/tools/mock/common.css" type="text/css"> | ||||||
|     <link rel="stylesheet" href="../css/common.css" type="text/css"> |  | ||||||
|     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> |     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||||||
|     <!-- <script src="../js/dyn_host.js"></script> --> |  | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
|     <div class="container"> |     <div class="container"> | ||||||
| @@ -155,14 +153,6 @@ | |||||||
|                                                 </tr> |                                                 </tr> | ||||||
|                                             </thead> |                                             </thead> | ||||||
|                                             <tbody> |                                             <tbody> | ||||||
|                                                 <!-- <tr class="even"> |  | ||||||
|                                                     <td>2021-01-01T10:57:26</td> |  | ||||||
|                                                     <td>Client request</td> |  | ||||||
|                                                 </tr> |  | ||||||
|                                                 <tr> |  | ||||||
|                                                     <td>2021-01-01T10:57:26</td> |  | ||||||
|                                                     <td>Client request</td> |  | ||||||
|                                                 </tr> --> |  | ||||||
|                                             </tbody> |                                             </tbody> | ||||||
|                                         </table> |                                         </table> | ||||||
|                                     </div> |                                     </div> | ||||||
| @@ -179,19 +169,6 @@ | |||||||
|                 </div> |                 </div> | ||||||
|                 <!-- tile list --> |                 <!-- tile list --> | ||||||
|                 <div id="listItems"> |                 <div id="listItems"> | ||||||
|                     <!-- <div class="tile"> |  | ||||||
|                         <div class="content"> |  | ||||||
|                             <div class="display-space-between"> |  | ||||||
|                                 <div class="centered-vertically"> |  | ||||||
|                                     <p>Id: 2</p> |  | ||||||
|                                     <p>Status: 200</p> |  | ||||||
|                                 </div> |  | ||||||
|                                 <div> |  | ||||||
|                                     <button id="test1" class="modification-button btn-tile"><i class="icon-cancel"></i></button> |  | ||||||
|                                 </div> |  | ||||||
|                             </div> |  | ||||||
|                         </div> |  | ||||||
|                     </div> --> |  | ||||||
|                 </div> |                 </div> | ||||||
|                 <div id="new-tile" class="max-width centered-content small-vertical-margin"> |                 <div id="new-tile" class="max-width centered-content small-vertical-margin"> | ||||||
|                     <button id="btn-newtile" class="modification-button btn-addtile"><i class="icon-plus"></i></button> |                     <button id="btn-newtile" class="modification-button btn-addtile"><i class="icon-plus"></i></button> | ||||||
| @@ -302,7 +279,7 @@ | |||||||
|             <div>Message saved<i class="r-exclamation"></i></div> |             <div>Message saved<i class="r-exclamation"></i></div> | ||||||
|             <button>×</button> |             <button>×</button> | ||||||
|         </div> |         </div> | ||||||
|         <div class="body">Your message has been successfuly saved.<br>You might view it under the link.</div> |         <div class="body">Your message has been successfully saved.<br>You might view it under the link.</div> | ||||||
|     </div> |     </div> | ||||||
|     <div id="modal-query" class="modal"> |     <div id="modal-query" class="modal"> | ||||||
|         <div class="header"> |         <div class="header"> | ||||||
| @@ -317,10 +294,10 @@ | |||||||
|             <button>No</button> |             <button>No</button> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <script type="text/javascript" src="../js/modal.js"></script> |     <script type="text/javascript" src="../assets/scripts/tools/mock/modal.js"></script> | ||||||
|     <script type="text/javascript" src="../js/uianimation.js"></script> |     <script type="text/javascript" src="../assets/scripts/tools/mock//uianimation.js"></script> | ||||||
|     <script type="text/javascript" src="../js/datatransfer.js"></script> |     <script type="text/javascript" src="../assets/scripts/tools/mock/datatransfer.js"></script> | ||||||
|     <script type="text/javascript" src="../js/historyloader.js"></script> |     <script type="text/javascript" src="../assets/scripts/tools/mock/historyloader.js"></script> | ||||||
|     <script type="text/javascript" src="../js/fiddle.js"></script> |     <script type="text/javascript" src="../assets/scripts/tools/mock/fiddle.js"></script> | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
		Reference in New Issue
	
	Block a user