From e6b30fc6fa0631e249dd7e7233388cab0e16adfb Mon Sep 17 00:00:00 2001
From: Pierre-Jean CHANCELLIER <paidge_cs@hotmail.com>
Date: Wed, 19 Jan 2022 14:41:41 +0100
Subject: [PATCH] =?UTF-8?q?ajout=20de=20la=20page=20des=20param=C3=A8tres?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 graphql/queries.js   | 10 ++++++
 i18n/locales/en.json |  7 ++++
 i18n/locales/es.json |  7 ++++
 i18n/locales/fr.json |  7 ++++
 layouts/default.vue  |  6 ++++
 pages/parametres.vue | 86 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 123 insertions(+)
 create mode 100644 pages/parametres.vue

diff --git a/graphql/queries.js b/graphql/queries.js
index be78bae..f657d81 100644
--- a/graphql/queries.js
+++ b/graphql/queries.js
@@ -219,4 +219,14 @@ fragment attr on Identity {
     __typename
     limit
   }
+}`
+
+// Pour la page parametres
+export const PARAMS = gql`query getParams{
+  allParameters {
+    name
+    par_type
+    value
+    comment
+  }
 }`
\ No newline at end of file
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index ec79d38..9656ac8 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -7,9 +7,11 @@
         "recues" : "Certificates received "
     },
     "chargement" : "Loading",
+    "description": "Description",
     "dev": "In development",
     "expire": "Expires",
     "futuremembers": "Future members",
+    "infos": "Informations",
     "inout": "Entries and exits of the web of trust for the last 2 days",
     "inpreparation": "In preparation",
     "membre": {
@@ -25,8 +27,11 @@
         "referent": "Referent"
     },
     "membres": "Members",
+    "nom": "Name",
     "non": "No",
     "oui": "Yes",
+    "params": "Parameters",
+    "params_blockchain": "Blockchain parameters",
     "previsions" : {
         "certificationsinternes": "No internal certification | 1 internal certification | {n} internal certifications",
         "dossiersattente": "No pending files | 1 pending file | {n} pending files",
@@ -57,5 +62,7 @@
         "pardate": "Sort by date",
         "parmembres": "Sort by members"
     },
+    "type": "Type",
+    "valeur": "Value",
     "wot": "Web of trust"
 }
\ No newline at end of file
diff --git a/i18n/locales/es.json b/i18n/locales/es.json
index fc3654c..6fd605b 100644
--- a/i18n/locales/es.json
+++ b/i18n/locales/es.json
@@ -7,9 +7,11 @@
         "recues" : "Certificaciones recibidas "
     },
     "chargement" : "Cargando",
+    "description": "Descripción",
     "dev": "En desarrollo",
     "expire": "Expira el",
     "futuremembers": "Futuros miembros",
+    "infos": "Informaciones",
     "inout": "Entradas y salidas de la red de confianza en los últimos 2 días",
     "inpreparation": "En preparación",
     "membre": {
@@ -25,8 +27,11 @@
         "referent": "Referente o de control"
     },
     "membres": "Miembros",
+    "nom": "Nombre",
     "non": "No",
     "oui": "Sí",
+    "params": "Parámetros",
+    "params_blockchain": "Parámetros de la blockchain",
     "previsions" : {
         "certificationsinternes": "Sin certificación interna | 1 certificación interna | {n} certificaciones internas",
         "dossiersattente": "No hay candidaturas pendientes | 1 candidatura pendiente | {n} candidaturas pendientes",
@@ -57,5 +62,7 @@
         "pardate": "Ordenar por fecha",
         "parmembres": "Clasificar por miembros"
     },
+    "type": "Tipo",
+    "valeur": "Valor",
     "wot": "Red de confianza"
 }
diff --git a/i18n/locales/fr.json b/i18n/locales/fr.json
index efb889a..6aa90ec 100644
--- a/i18n/locales/fr.json
+++ b/i18n/locales/fr.json
@@ -7,9 +7,11 @@
         "recues" : "Certifications reçues "
     },
     "chargement" : "Chargement",
+    "description": "Description",
     "dev": "En Développement",
     "expire": "Expire le",
     "futuremembers": "Futurs membres",
+    "infos": "Informations",
     "inout": "Entrées et sorties de la toile de confiance des 2 derniers jours",
     "inpreparation": "En préparation",
     "membre": {
@@ -25,8 +27,11 @@
         "referent": "Référent"
     },
     "membres": "Membres",
+    "nom": "Nom",
     "non": "Non",
     "oui": "Oui",
+    "params": "Paramètres",
+    "params_blockchain": "Paramètres de la blockchain",
     "previsions" : {
         "certificationsinternes": "Aucune certification interne | 1 certification interne | {n} certifications internes",
         "dossiersattente": "Aucun dossier en attente | 1 dossier en attente | {n} dossiers en attente",
@@ -57,5 +62,7 @@
         "pardate": "Tri par date",
         "parmembres": "Tri par membres"
     },
+    "type": "Type",
+    "valeur": "Valeur",
     "wot": "Toile de confiance"
 }
\ No newline at end of file
diff --git a/layouts/default.vue b/layouts/default.vue
index a2b644c..40321c1 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -23,6 +23,12 @@ export default {
           items : [
             {path: '/previsions/futurs_membres',title: 'futuremembers'}
           ]
+        },
+        {
+          title: 'infos',
+          items : [
+            {path: '/parametres',title: 'params_blockchain'}
+          ]
         }
       ]
     }
diff --git a/pages/parametres.vue b/pages/parametres.vue
new file mode 100644
index 0000000..f8bebc8
--- /dev/null
+++ b/pages/parametres.vue
@@ -0,0 +1,86 @@
+<template>
+<main class="container">
+  <h2 class="text-center mb-5 font-weight-light">{{ $t('params_blockchain') }}</h2>
+  
+  <NavigationLoader :isLoading="$apollo.queries.allParameters.loading" />
+  <transition name="fade">
+    <div class="alert alert-danger" v-if="error">{{ error }}</div>
+  </transition>
+  <transition name="fade">
+    <div class="table-responsive" v-if="allParameters">
+      <table class="table table-striped">
+        <thead>
+          <th>{{ $t('nom') }}</th>
+          <th class="d-none d-sm-table-cell">{{ $t('type') }}</th>
+          <th>{{ $t('valeur') }}</th>
+          <th class="d-none d-md-table-cell">{{ $t('description') }}</th>
+        </thead>
+        <tbody>
+          <tr v-for="param in allParameters" :key="param.name">
+            <th scope="row">{{ param.name }}</th>
+            <td scope="row" class="d-none d-sm-table-cell">{{ param.par_type }}</td>
+            <td scope="row">{{ param.value }}</td>
+            <td scope="row" class="d-none d-md-table-cell">{{ param.comment }}</td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </transition>
+</main>
+</template>
+
+<script>
+import {PARAMS} from '@/graphql/queries.js'
+
+export default {
+  data() {
+    return {
+      breadcrumb: [
+        {
+          text: this.$t('accueil'),
+          to: '/'
+        },
+        {
+          text: this.$t('params'),
+          active: true
+        }
+      ],
+      error: null
+    }
+  },
+  // methods: {
+  //   myFunction() {
+      
+  //   }
+  // },
+  // computed: {
+  //   myComputedValue : function() {
+  //     return this.var * 3
+  //   }
+  // },
+  apollo: {
+    // Use {{ myresponse }} in the template. If update is omitted, this name should correspond to the Query Type !
+    allParameters : {
+      query: PARAMS,
+      // Optional : this is for parametered queries
+      // variables() {return {param1:value1,param2:value2}},
+      // Optional : treat the response before display. If omitted, the query name must correspond to the Query Type !
+      // update (data) {
+        
+      //   return data
+      // },
+      error (err) {this.error = err.message}
+    }
+  },
+  nuxtI18n: {
+    paths: {
+      fr: '/parametres',
+      en: '/parameters',
+      es: '/parametros'
+    }
+  },
+  mounted () {
+    $nuxt.$emit('changeRoute',this.breadcrumb)
+  }
+}
+</script>
\ No newline at end of file
-- 
GitLab