Browse Source

Upgrade interface feautures

Alessia 1 year ago
parent
commit
13b8f28c54
6 changed files with 43 additions and 30 deletions
  1. 14 13
      flask_be/app.py
  2. 7 6
      flask_be/engine/handle_request.py
  3. 12 0
      site2/css/mystyle.css
  4. BIN
      site2/img/dariah-logo.jpeg
  5. 6 0
      site2/index.html
  6. 4 11
      site2/js/ricerca.js

+ 14 - 13
flask_be/app.py

@@ -45,23 +45,24 @@ def simpleContext():
 
     app.logger.info('Request successfully received by the Get Context API')
 
-    try:
-        queryDTO = request.get_json()
-        queryList = queryDTO['queryList']
-        listResults = queryDTO['listResults']
-        cooccorrenze = queryDTO['cooccorrenze']
+    return "I'm returning"
 
-        output = handleGetContext(queryList, listResults, cooccorrenze, app.config['DATA_CONFIG'])
+    #try:
+     #   queryDTO = request.get_json()
+      #  queryList = queryDTO['queryList']
+       # listResults = queryDTO['listResults']
 
-        app.logger.info('Request successfully executed, sending output')
-        return output, 200
+        #output = handleGetContext(queryList, listResults, app.config['DATA_CONFIG'])
 
-    except Exception as err:
+    #    app.logger.info('Request successfully executed, sending output')
+     #   return output, 200
+
+    #except Exception as err:
         # Log the exception? Send it back to FE?
-        emptyOut = {}
-        app.logger.error(traceback.format_exc())
-        print(traceback.format_exc())
-        return emptyOut, 500
+     #   emptyOut = {}
+      #  app.logger.error(traceback.format_exc())
+       # print(traceback.format_exc())
+        #return emptyOut, 500
 
 
 if __name__ == '__main__':

+ 7 - 6
flask_be/engine/handle_request.py

@@ -26,12 +26,6 @@ def handleOccGetQuery(queryList, cooccorrenzeObj, dataConfig):
 
     return res
 
-#Funzione da sistemare per il recupero dei contesti
-def handleGetContext(queryList, listResults, cooccorrenze, dataConfig):
-
-    res = []
-
-    return "Hey, I'm returning"
 
 def tempDecode(stringa):
     if stringa=='forma':
@@ -42,3 +36,10 @@ def tempDecode(stringa):
         return 2
     else:
         return None
+
+#Funzione da sistemare per il recupero dei contesti
+def handleGetContext(queryList, listResults, dataConfig):
+
+    res = []
+
+    return "Hey, I'm returning"

+ 12 - 0
site2/css/mystyle.css

@@ -82,6 +82,18 @@
   100% { transform: rotate(360deg); }
 }
 
+footer {
+  margin-top: 150px;
+  width: 100%;
+  text-align: center;
+  margin-bottom: 10px;
+}
+
+footer img {
+  height: 80px;
+  width: auto;
+}
+
 
 /* The container must be positioned relative: */
 .custom-select {

BIN
site2/img/dariah-logo.jpeg


+ 6 - 0
site2/index.html

@@ -155,6 +155,12 @@
 
    <div id="loader" class="loader" style="display:none;"></div>
 
+   <footer>
+      <div>
+         <img src="img/dariah-logo.jpeg" />
+      </div>
+   </footer>
+
    <script src="vendor/jquery/jquery.min.js"></script>
 
 </body>

+ 4 - 11
site2/js/ricerca.js

@@ -36,16 +36,6 @@ function getData(endpoint, queryDTO){
     // return $.post(url,  {stringifiedDTO: JSON.stringify(queryDTO)});
 }
 
-// @Alessia: non userei una funzione separata -- in sostanza è uguale a getData,
-// a parte l'endpoint.
-// Ho aggiunto una variabile 'endpoint' a getData apposta per questo
-function getContext(queryDTO){
-
-  let url = flask_be_address.concat('/get_context');
-   
-  return $.post(url,  {stringifiedDTO: JSON.stringify(queryDTO)});
-}
-
 let arrayResponse = [];
 // Separate function to handle response data -- could be moved to different file (a service)
 function processData(response){
@@ -217,8 +207,11 @@ function checkContext() {
 
   queryDTO["listResults"] = arrayResponse; 
 
-  //INSERIRE QUI LA CHIAMATA PER LA RICERCA DEI CONTESTI (SENZA COOCCORRENZE)
   console.log(queryDTO);
+
+  getData('/get_context', queryDTO)
+  // After request finishes, process response data
+  .done(response => processContext(response));
 }