From 9a5525bd1d93ac94c53d091964f7060f52f4c6ce Mon Sep 17 00:00:00 2001
From: Kenzo-Hugo Hillion <hillion.kenzo@posteo.net>
Date: Wed, 24 Mar 2021 10:54:34 +0100
Subject: [PATCH] add filter for gene with functions only

---
 frontend/src/views/genes/genes.html | 10 +++++++++-
 frontend/src/views/genes/genes.js   |  5 +++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/frontend/src/views/genes/genes.html b/frontend/src/views/genes/genes.html
index 91dd2ee..fccf073 100644
--- a/frontend/src/views/genes/genes.html
+++ b/frontend/src/views/genes/genes.html
@@ -10,7 +10,7 @@
         <v-spacer/>
         {{ item.text }}
         <v-spacer/>
-        <v-flex md8>
+        <v-flex md8>  
           <v-progress-linear
             v-if="item.progressBar"
             indeterminate
@@ -181,6 +181,14 @@
                     grid-list-md
                   >
                     <v-layout>
+
+                      <v-flex sm12 md8 lg6 d-flex>
+                        <v-switch
+                          v-model="filterWithFunction"
+                          label="Functional annotation"
+                          color="secondary lighten-1"
+                        ></v-switch>
+                      </v-flex>
                       <!-- Source choice -->
                       <v-flex sm12 md8 lg6 d-flex>
                         <v-text-field
diff --git a/frontend/src/views/genes/genes.js b/frontend/src/views/genes/genes.js
index cfe96e2..7e7c820 100644
--- a/frontend/src/views/genes/genes.js
+++ b/frontend/src/views/genes/genes.js
@@ -26,6 +26,7 @@ export default {
       taxItems: [],
       taxChoice: null,
       // - Function
+      filterWithFunction: null,
       functionID: null,
       // Information about request
       loadTable: true,
@@ -89,6 +90,9 @@ export default {
       if (this.functionID){
         qParams.function = this.functionID;
       }
+      else if (this.filterWithFunction){
+        qParams.has_functions = this.filterWithFunction;
+      };
       if (this.taxChoice) {
         qParams.tax_id = this.taxItems[this.taxChoice];
       }
@@ -336,6 +340,7 @@ export default {
     },
     emptyFunctionFilter() {
       this.functionID = null;
+      this.filterWithFunction = null;
     },
     emptyFilters() {
       this.emptyGeneInformationFilter();
-- 
GitLab