From 7329c3aa42add7b183e74d91531c7aeeaa3e59e0 Mon Sep 17 00:00:00 2001
From: lucile varloteaux <lucile.varloteaux@inrae.fr>
Date: Mon, 17 Oct 2022 12:41:57 +0200
Subject: [PATCH 1/2] affichage heure

---
 ui/src/model/file/Dataset.js                      | 6 ++++--
 ui/src/views/datatype/DataTypesRepositoryView.vue | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ui/src/model/file/Dataset.js b/ui/src/model/file/Dataset.js
index d4110c113..986c6ff43 100644
--- a/ui/src/model/file/Dataset.js
+++ b/ui/src/model/file/Dataset.js
@@ -13,7 +13,7 @@ export class Dataset {
     this.lastUploadUser = file.params.createuser;
     this.published = file.params.published;
     this.publishDate = file.params.publisheddate;
-    this.publishUser = file.params.publishedhuser;
+    this.publishUser = file.params.publisheduser;
     this.periode = this.periodeToString(
       file.params.binaryFiledataset.from,
       file.params.binaryFiledataset.to
@@ -38,8 +38,10 @@ export class Dataset {
     var dd = String(today.getDate()).padStart(2, "0");
     var mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0!
     var yyyy = today.getFullYear();
+    var HH = today.getHours();
+    var MM = today.getMinutes();
 
-    today = dd + "/" + mm + "/" + yyyy;
+    today = dd + "/" + mm + "/" + yyyy + " " + HH + ":" + MM;
     return today;
   }
   periodeToString(from, to) {
diff --git a/ui/src/views/datatype/DataTypesRepositoryView.vue b/ui/src/views/datatype/DataTypesRepositoryView.vue
index cf14c6825..ef44e5ae8 100644
--- a/ui/src/views/datatype/DataTypesRepositoryView.vue
+++ b/ui/src/views/datatype/DataTypesRepositoryView.vue
@@ -240,9 +240,9 @@
                   </b-tooltip>
                 </td>
                 <td align>{{ dataset.size }}</td>
-                <td align>{{ UTCToString(dataset.params.createdate) }}</td>
+                <td align>{{ formatDate(dataset.params.createdate) }}</td>
                 <td align>{{ dataset.createuser }}</td>
-                <td align>{{ UTCToString(dataset.params.publisheddate) }}</td>
+                <td align>{{ formatDate(dataset.params.publisheddate) }}</td>
                 <td align>{{ dataset.publisheduser }}</td>
                 <td align>
                   <b-field>
@@ -545,7 +545,7 @@ export default class DataTypesRepositoryView extends Vue {
   }
 
   formatDate(date) {
-    return moment(date).format("DD/MM/YYYY");
+    return moment(date).format("DD/MM/YYYY HH:mm");
   }
 
   periodeToString(dataset) {
-- 
GitLab


From f73450f93ba5191be82dd2ade34a6a81bd0eb4b9 Mon Sep 17 00:00:00 2001
From: TCHERNIATINSKY <philippe.tcherniatinsky@inrae.fr>
Date: Tue, 18 Oct 2022 13:44:04 +0200
Subject: [PATCH 2/2] =?UTF-8?q?Correction=20des=20locales=20Ajout=20du=20t?=
 =?UTF-8?q?=C3=A9l=C3=A9chargement?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../fr/inra/oresing/rest/OreSiResources.java  |   2 +-
 .../fr/inra/oresing/rest/OreSiService.java    |   6 +
 ui/src/locales/en.json                        |  10 +-
 ui/src/locales/fr.json                        |  10 +-
 ui/src/services/rest/FileService.js           |   6 +-
 .../datatype/DataTypesRepositoryView.vue      | 351 +++++++++---------
 6 files changed, 208 insertions(+), 177 deletions(-)

diff --git a/src/main/java/fr/inra/oresing/rest/OreSiResources.java b/src/main/java/fr/inra/oresing/rest/OreSiResources.java
index 21e961875..85013d7dc 100644
--- a/src/main/java/fr/inra/oresing/rest/OreSiResources.java
+++ b/src/main/java/fr/inra/oresing/rest/OreSiResources.java
@@ -69,7 +69,7 @@ public class OreSiResources {
 
     @GetMapping(value = "/applications/{name}/file/{id}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
     public ResponseEntity<byte[]> getFile(@PathVariable("name") String name, @PathVariable("id") UUID id) {
-        Optional<BinaryFile> optionalBinaryFile = service.getFile(name, id);
+        Optional<BinaryFile> optionalBinaryFile = service.getFileWithData(name, id);
         if (optionalBinaryFile.isPresent()) {
             BinaryFile binaryFile = optionalBinaryFile.get();
             HttpHeaders headers = new HttpHeaders();
diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java
index 32fac3a1f..f3146aefa 100644
--- a/src/main/java/fr/inra/oresing/rest/OreSiService.java
+++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java
@@ -1317,6 +1317,12 @@ public class OreSiService {
         return optionalBinaryFile;
     }
 
+    public Optional<BinaryFile> getFileWithData(String name, UUID id) {
+        authenticationService.setRoleForClient();
+        Optional<BinaryFile> optionalBinaryFile = repo.getRepository(name).binaryFile().tryFindByIdWithData(id);
+        return optionalBinaryFile;
+    }
+
     public boolean removeFile(String name, UUID id) {
         authenticationService.setRoleForClient();
         BinaryFile binaryFile = repo.getRepository(name).binaryFile().findById(id);
diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json
index 1b5e45f64..5d7d5622c 100644
--- a/ui/src/locales/en.json
+++ b/ui/src/locales/en.json
@@ -277,12 +277,14 @@
         "list-file-data-period": "List of versions for the period",
         "table-file-data-id": "ID",
         "table-file-data-size": "Size",
-        "table-file-data-create": "Create",
-        "table-file-data-create-by": "Create by :",
-        "table-file-data-publish": "Publish",
-        "table-file-data-publish-by": "Publish by :",
+        "table-file-data-create": "Created on",
+        "table-file-data-create-by": "Created by :",
+        "table-file-data-publish": "Published on",
+        "table-file-data-publish-by": "Published by :",
         "table-file-data-publication": "Publication",
+        "table-file-data-action": "Actions",
         "table-file-data-delete": "Delete",
+        "table-file-data-download": "Download",
         "table-file-data-period": "Period"
     },
     "dataTypeAuthorizations": {
diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json
index be1eca68a..d3f8abb7c 100644
--- a/ui/src/locales/fr.json
+++ b/ui/src/locales/fr.json
@@ -282,12 +282,14 @@
         "list-file-data-period": "Liste des versions pour la période",
         "table-file-data-id": "ID",
         "table-file-data-size": "Taille",
-        "table-file-data-create": "Création",
-        "table-file-data-create-by": "Créer par :",
-        "table-file-data-publish": "Publier",
-        "table-file-data-publish-by": "Publier par :",
+        "table-file-data-create": "Créé le",
+        "table-file-data-create-by": "Créé par :",
+        "table-file-data-publish": "Publié le",
+        "table-file-data-publish-by": "Publié par :",
         "table-file-data-publication": "Publication",
+        "table-file-data-action": "Actions",
         "table-file-data-delete": "Supprimer",
+        "table-file-data-download": "Télécharger",
         "table-file-data-period": "Période"
     },
     "dataTypeAuthorizations": {
diff --git a/ui/src/services/rest/FileService.js b/ui/src/services/rest/FileService.js
index 0716d2d8b..1f714813e 100644
--- a/ui/src/services/rest/FileService.js
+++ b/ui/src/services/rest/FileService.js
@@ -16,4 +16,8 @@ export class FileService extends Fetcher {
   async remove(applicationName, uuid) {
     return this.delete(`applications/${applicationName}/file/${uuid}`);
   }
-}
+
+  async download(applicationName, uuid) {
+    return this.downloadFile(`applications/${applicationName}/file/${uuid}`);
+  }
+}
\ No newline at end of file
diff --git a/ui/src/views/datatype/DataTypesRepositoryView.vue b/ui/src/views/datatype/DataTypesRepositoryView.vue
index ef44e5ae8..090712f7a 100644
--- a/ui/src/views/datatype/DataTypesRepositoryView.vue
+++ b/ui/src/views/datatype/DataTypesRepositoryView.vue
@@ -2,10 +2,10 @@
   <div>
     <PageView class="with-submenu">
       <SubMenu
-        :paths="subMenuPaths"
-        :root="application.localName || application.title"
-        role="navigation"
-        :aria-label="$t('menu.aria-sub-menu')"
+          :paths="subMenuPaths"
+          :root="application.localName || application.title"
+          role="navigation"
+          :aria-label="$t('menu.aria-sub-menu')"
       />
       <h1 class="title main-title">
         {{
@@ -22,24 +22,24 @@
                 <b-dropdown :ref="authKey" expanded>
                   <template #trigger="{ active }">
                     <b-button
-                      expanded
-                      :icon-right="active ? 'chevron-up' : 'chevron-down'"
-                      type="is-primary"
+                        expanded
+                        :icon-right="active ? 'chevron-up' : 'chevron-down'"
+                        type="is-primary"
                     >
                       {{
                         internationalisationService.getLocaleforPath(
-                          application,
-                          getAuthorizationScopePath(authKey),
-                          authKey
+                            application,
+                            getAuthorizationScopePath(authKey),
+                            authKey
                         )
                       }}
                     </b-button>
                   </template>
                   <DropDownMenu
-                    v-for="(option, optionKey) in authReference"
-                    :key="optionKey"
-                    :option="option"
-                    @select-menu-item="selectAuthorization(authKey, $event)"
+                      v-for="(option, optionKey) in authReference"
+                      :key="optionKey"
+                      :option="option"
+                      @select-menu-item="selectAuthorization(authKey, $event)"
                   />
                 </b-dropdown>
               </b-field>
@@ -50,20 +50,20 @@
           <h1>
             {{
               this.requiredAuthorizationsObject
-                ? Object.entries(this.requiredAuthorizationsObject)
-                  .filter((e) => e[1])
-                  .map(
-                    (e) =>
-                      internationalisationService.getLocaleforPath(
-                          application,
-                          getAuthorizationScopePath(e[0]),
-                          e[0]
-                      ) +
-                      " : " +
-                      e[1]
-                  )
-                  .join(", ")
-                : ""
+                  ? Object.entries(this.requiredAuthorizationsObject)
+                      .filter((e) => e[1])
+                      .map(
+                          (e) =>
+                              internationalisationService.getLocaleforPath(
+                                  application,
+                                  getAuthorizationScopePath(e[0]),
+                                  e[0]
+                              ) +
+                              " : " +
+                              e[1]
+                      )
+                      .join(", ")
+                  : ""
             }}
           </h1>
         </div>
@@ -88,15 +88,15 @@
                     <div class="column">
                       <b-field :label="$t('dataTypesRepository.start-date')" data-cy="dateStart">
                         <b-datepicker
-                          v-model="startDate"
-                          :date-parser="parseDate"
-                          :date-formatter="formatDate"
-                          :placeholder="
+                            v-model="startDate"
+                            :date-parser="parseDate"
+                            :date-formatter="formatDate"
+                            :placeholder="
                             $t('dataTypesRepository.placeholder-datepicker') +
                             ' dd-MM-YYYY, dd-MM-YYYY hh, dd-MM-YYYY hh:mm, dd-MM-YYYY HH:mm:ss'
                           "
-                          editable
-                          icon="calendar"
+                            editable
+                            icon="calendar"
                         >
                         </b-datepicker>
                       </b-field>
@@ -104,32 +104,32 @@
                     <div class="column">
                       <b-field :label="$t('dataTypesRepository.end-date')" data-cy="dateEnd">
                         <b-datepicker
-                          v-model="endDate"
-                          :date-parser="parseDate"
-                          :date-formatter="formatDate"
-                          :placeholder="
+                            v-model="endDate"
+                            :date-parser="parseDate"
+                            :date-formatter="formatDate"
+                            :placeholder="
                             $t('dataTypesRepository.placeholder-datepicker') +
                             ' dd-MM-YYYY, dd-MM-YYYY hh, dd-MM-YYYY hh:mm, dd-MM-YYYY HH:mm:ss'
                           "
-                          editable
-                          icon="calendar"
+                            editable
+                            icon="calendar"
                         >
                         </b-datepicker>
                       </b-field>
                     </div>
                     <div class="column">
                       <b-upload
-                        @input="changeFile"
-                        v-model="file"
-                        class="file-label"
-                        style="margin-top: 30px"
-                        data-cy="changeFileButton"
+                          @input="changeFile"
+                          v-model="file"
+                          class="file-label"
+                          style="margin-top: 30px"
+                          data-cy="changeFileButton"
                       >
                         <span class="file-cta">
                           <b-icon class="file-icon" icon="upload"></b-icon>
                           <span class="file-label">{{
-                            $t("dataTypesRepository.choose-file")
-                          }}</span>
+                              $t("dataTypesRepository.choose-file")
+                            }}</span>
                         </span>
                         <span v-if="file" class="file-name">
                           {{ file.name }}
@@ -148,7 +148,7 @@
                 <div class="column is-10"></div>
                 <div class="column is-2" style="float: right">
                   <b-button type="is-dark" @click="upload" style="float: right" expanded
-                    >{{ $t("dataTypesRepository.submit") }}
+                  >{{ $t("dataTypesRepository.submit") }}
                   </b-button>
                 </div>
               </footer>
@@ -160,9 +160,9 @@
         <div class="card column">
           <div class="card-content">
             <table
-              v-if="datasets && Object.keys(datasets).length"
-              class="table is-striped is-fullwidth numberData"
-              style="text-align: center; vertical-align: center"
+                v-if="datasets && Object.keys(datasets).length"
+                class="table is-striped is-fullwidth numberData"
+                style="text-align: center; vertical-align: center"
             >
               <caption>
                 {{
@@ -175,12 +175,12 @@
                 <th align>{{ $t("dataTypesRepository.table-file-data-publication") }}</th>
               </tr>
               <tr
-                v-for="(dataset, periode) in datasets"
-                :key="dataset.id"
-                @click="showDatasets(dataset)"
-                @keypress.enter="showDatasets(dataset)"
-                tabindex="0"
-                style="cursor: pointer"
+                  v-for="(dataset, periode) in datasets"
+                  :key="dataset.id"
+                  @click="showDatasets(dataset)"
+                  @keypress.enter="showDatasets(dataset)"
+                  tabindex="0"
+                  style="cursor: pointer"
               >
                 <td align>{{ periode }}</td>
                 <td align>{{ Object.keys(dataset.datasets).length }}</td>
@@ -188,9 +188,9 @@
               </tr>
             </table>
             <table
-              v-if="currentDataset && currentDataset.length"
-              class="table is-striped is-fullwidth"
-              style="text-align: center; vertical-align: center"
+                v-if="currentDataset && currentDataset.length"
+                class="table is-striped is-fullwidth"
+                style="text-align: center; vertical-align: center"
             >
               <caption>
                 {{
@@ -222,7 +222,7 @@
                 <th align>{{ $t("dataTypesRepository.table-file-data-publish") }}</th>
                 <th align>{{ $t("dataTypesRepository.table-file-data-publish-by") }}</th>
                 <th align>{{ $t("dataTypesRepository.table-file-data-publication") }}</th>
-                <th align>{{ $t("dataTypesRepository.table-file-data-delete") }}</th>
+                <th align>{{ $t("dataTypesRepository.table-file-data-action") }}</th>
               </tr>
               <tr v-for="dataset in currentDataset" :key="dataset.id">
                 <td align>
@@ -232,9 +232,9 @@
                       <p>{{ UTCToString(dataset.params.binaryFiledataset.comment) }}</p>
                     </template>
                     <a
-                      :aria-describedby="dataset.id"
-                      tabindex="0"
-                      @keypress.enter="changeCss(dataset.id)"
+                        :aria-describedby="dataset.id"
+                        tabindex="0"
+                        @keypress.enter="changeCss(dataset.id)"
                     >{{ dataset.id.slice(0, 8) }}</a
                     >
                   </b-tooltip>
@@ -247,23 +247,34 @@
                 <td align>
                   <b-field>
                     <b-button
-                      :icon-right="dataset.params.published ? 'check-circle' : 'circle'"
-                      size="is-medium"
-                      type="is-primary is-light"
-                      @click="publish(dataset, !dataset.params.published)"
-                      style="height: 1.5em; background-color: transparent; font-size: 1.45rem"
+                        :icon-right="dataset.params.published ? 'check-circle' : 'circle'"
+                        size="is-medium"
+                        type="is-primary is-light"
+                        @click="publish(dataset, !dataset.params.published)"
+                        style="height: 1.5em; background-color: transparent; font-size: 1.45rem"
                     />
                   </b-field>
                 </td>
                 <td>
                   <b-field>
-                    <b-button
-                      icon-right="times-circle"
-                      size="is-medium"
-                      type="is-danger is-light"
-                      @click="remove(dataset, dataset.params.published)"
-                      style="height: 1.5em; background-color: transparent; font-size: 1.45rem"
-                    />
+                    <b-tooltip :label="$t('dataTypesRepository.table-file-data-delete')" position="is-left">
+                      <b-button
+                          icon-right="times-circle"
+                          size="is-medium"
+                          type="is-danger is-light"
+                          @click="remove(dataset, dataset.params.published)"
+                          style="height: 1.5em; background-color: transparent; font-size: 1.45rem"
+                      />
+                    </b-tooltip>
+                    <b-tooltip :label="$t('dataTypesRepository.table-file-data-download')" position="is-left">
+                      <b-button
+                          icon-right="download"
+                          size="is-medium"
+                          type="is-primary is-light"
+                          @click="downloadDataTypeVersion(dataset)"
+                          style="height: 1.5em; background-color: transparent; font-size: 1.45rem"
+                      />
+                    </b-tooltip>
                   </b-field>
                 </td>
               </tr>
@@ -276,23 +287,23 @@
 </template>
 
 <script>
-import { Component, Prop, Vue } from "vue-property-decorator";
+import {Component, Prop, Vue} from "vue-property-decorator";
 import PageView from "@/views/common/PageView.vue";
-import { ApplicationService } from "@/services/rest/ApplicationService";
-import { ApplicationResult } from "@/model/ApplicationResult";
+import {ApplicationService} from "@/services/rest/ApplicationService";
+import {ApplicationResult} from "@/model/ApplicationResult";
 import CollapsibleTree from "@/components/common/CollapsibleTree.vue";
-import { AlertService } from "@/services/AlertService";
-import { DataService } from "@/services/rest/DataService";
-import { FileService } from "@/services/rest/FileService";
-import { ReferenceService } from "@/services/rest/ReferenceService";
-import { ErrorsService } from "@/services/ErrorsService";
-import SubMenu, { SubMenuPath } from "@/components/common/SubMenu.vue";
-import { BinaryFileDataset } from "@/model/file/BinaryFileDataset";
-import { BinaryFile } from "@/model/file/BinaryFile";
-import { FileOrUUID } from "@/model/file/FileOrUUID";
-import { Dataset } from "@/model/file/Dataset";
-import { InternationalisationService } from "@/services/InternationalisationService";
-import { LOCAL_STORAGE_LANG } from "@/services/Fetcher";
+import {AlertService} from "@/services/AlertService";
+import {DataService} from "@/services/rest/DataService";
+import {FileService} from "@/services/rest/FileService";
+import {ReferenceService} from "@/services/rest/ReferenceService";
+import {ErrorsService} from "@/services/ErrorsService";
+import SubMenu, {SubMenuPath} from "@/components/common/SubMenu.vue";
+import {BinaryFileDataset} from "@/model/file/BinaryFileDataset";
+import {BinaryFile} from "@/model/file/BinaryFile";
+import {FileOrUUID} from "@/model/file/FileOrUUID";
+import {Dataset} from "@/model/file/Dataset";
+import {InternationalisationService} from "@/services/InternationalisationService";
+import {LOCAL_STORAGE_LANG} from "@/services/Fetcher";
 import DropDownMenu from "@/components/common/DropDownMenu";
 import moment from "moment";
 import {HttpStatusCodes} from "@/utils/HttpUtils";
@@ -351,10 +362,10 @@ export default class DataTypesRepositoryView extends Vue {
     const prevPath = `/applications/${this.applicationName}/dataTypes`;
     this.subMenuPaths = [
       new SubMenuPath(
-        this.dataTypeId.toLowerCase(),
-        () => {
-        },
-        () => this.$router.push(prevPath)
+          this.dataTypeId.toLowerCase(),
+          () => {
+          },
+          () => this.$router.push(prevPath)
       ),
     ];
 
@@ -371,7 +382,7 @@ export default class DataTypesRepositoryView extends Vue {
         if (this.repository.authorizationScope) {
           for (const authorizationScopeKey in this.repository.authorizationScope) {
             let authorizationScope =
-              matches[this.repository.authorizationScope[authorizationScopeKey]];
+                matches[this.repository.authorizationScope[authorizationScopeKey]];
 
             var currentNode = this.authReferences[authorizationScopeKey];
 
@@ -408,16 +419,16 @@ export default class DataTypesRepositoryView extends Vue {
           }
         }
         if (
-          this.repository.startDate &&
-          this.repository.startDate.token &&
-          matches[this.repository.startDate.token]
+            this.repository.startDate &&
+            this.repository.startDate.token &&
+            matches[this.repository.startDate.token]
         ) {
           this.startDate = moment(matches[this.repository.startDate.token], "DD-MM-YYYY").toDate();
         }
         if (
-          this.repository.endDate &&
-          this.repository.endDate.token &&
-          matches[this.repository.endDate.token]
+            this.repository.endDate &&
+            this.repository.endDate.token &&
+            matches[this.repository.endDate.token]
         ) {
           this.endDate = moment(matches[this.repository.endDate.token], "DD-MM-YYYY").toDate();
         }
@@ -458,15 +469,15 @@ export default class DataTypesRepositoryView extends Vue {
       this.application = {
         ...this.application,
         localName: this.internationalisationService.mergeInternationalization(this.application)
-          .localName,
+            .localName,
         localDatatypeName: this.internationalisationService.localeDataTypeIdName(
-          this.application,
-          this.application.dataTypes[this.dataTypeId]
+            this.application,
+            this.application.dataTypes[this.dataTypeId]
         ),
       };
       this.configuration = this.applications
-        .filter((a) => a.name === this.applicationName)
-        .map((a) => a.configuration.dataTypes[this.dataTypeId])[0];
+          .filter((a) => a.name === this.applicationName)
+          .map((a) => a.configuration.dataTypes[this.dataTypeId])[0];
       console.log("refType", this.getRefType("site", "chemin"));
       this.authorizations = this.configuration.authorization.authorizationScopes;
       let requiredAuthorizations = Object.keys(this.authorizations).reduce((acc, auth) => {
@@ -495,22 +506,22 @@ export default class DataTypesRepositoryView extends Vue {
       }
 
       let refs = Object.values(ret)
-        .reduce(
-          (acc, k) => [
-            ...acc,
-            ...k.referenceValues.reduce(
-              (a, b) => [...a, ...b.hierarchicalReference.split(".")],
-              acc
-            ),
-          ],
-          []
-        )
-        .reduce((a, b) => {
-          if (a.indexOf(b) < 0) {
-            a.push(b);
-          }
-          return a;
-        }, []);
+          .reduce(
+              (acc, k) => [
+                ...acc,
+                ...k.referenceValues.reduce(
+                    (a, b) => [...a, ...b.hierarchicalReference.split(".")],
+                    acc
+                ),
+              ],
+              []
+          )
+          .reduce((a, b) => {
+            if (a.indexOf(b) < 0) {
+              a.push(b);
+            }
+            return a;
+          }, []);
       for (const refsKey in refs) {
         await this.getOrLoadReferences(refs[refsKey]);
       }
@@ -554,10 +565,10 @@ export default class DataTypesRepositoryView extends Vue {
 
   periodeToStringForBinaryFileDataset(binaryFiledataset) {
     return (
-      "du " +
-      this.dateToString(binaryFiledataset.from) +
-      " au " +
-      this.dateToString(binaryFiledataset.to)
+        "du " +
+        this.dateToString(binaryFiledataset.from) +
+        " au " +
+        this.dateToString(binaryFiledataset.to)
     );
   }
 
@@ -572,27 +583,27 @@ export default class DataTypesRepositoryView extends Vue {
   async upload() {
     if (this.file && this.startDate && this.endDate) {
       var fileOrId = new FileOrUUID(
-        null,
-        new BinaryFileDataset(
-          this.dataTypeId,
-          this.selected.requiredAuthorizations,
-          /(.{10})T(.{8}).*/
-            .exec(new Date(this.startDate).toISOString())
-            .filter((a, i) => i !== 0)
-            .join(" "),
-          /(.{10})T(.{8}).*/
-            .exec(new Date(this.endDate).toISOString())
-            .filter((a, i) => i !== 0)
-            .join(" "),
-          this.comment
-        ),
-        false
+          null,
+          new BinaryFileDataset(
+              this.dataTypeId,
+              this.selected.requiredAuthorizations,
+              /(.{10})T(.{8}).*/
+                  .exec(new Date(this.startDate).toISOString())
+                  .filter((a, i) => i !== 0)
+                  .join(" "),
+              /(.{10})T(.{8}).*/
+                  .exec(new Date(this.endDate).toISOString())
+                  .filter((a, i) => i !== 0)
+                  .join(" "),
+              this.comment
+          ),
+          false
       );
       var uuid = await this.dataService.addData(
-        this.applicationName,
-        this.dataTypeId,
-        this.file,
-        fileOrId
+          this.applicationName,
+          this.dataTypeId,
+          this.file,
+          fileOrId
       );
       this.$emit("uploaded", uuid);
     }
@@ -612,10 +623,10 @@ export default class DataTypesRepositoryView extends Vue {
     var fileOrId = new FileOrUUID(dataset.id, dataset.params.binaryFiledataset, pusblished);
     try {
       var uuid = await this.dataService.addData(
-        this.applicationName,
-        this.dataTypeId,
-        null,
-        fileOrId
+          this.applicationName,
+          this.dataTypeId,
+          null,
+          fileOrId
       );
       this.$emit("published", uuid.fileId);
       this.alertService.toastSuccess(this.$t("alert.data-updated"));
@@ -683,7 +694,7 @@ export default class DataTypesRepositoryView extends Vue {
   isAuthorisationsSelected() {
     if (this.selected && this.selected.requiredAuthorizations) {
       return (
-        this.selected && Object.values(this.selected.requiredAuthorizations).every((v) => v?.length)
+          this.selected && Object.values(this.selected.requiredAuthorizations).every((v) => v?.length)
       );
     }
     return false;
@@ -692,9 +703,9 @@ export default class DataTypesRepositoryView extends Vue {
   async updateDatasets(uuid) {
     if (this.isAuthorisationsSelected()) {
       let datasetsList = await this.fileService.getFiles(
-        this.applicationName,
-        this.dataTypeId,
-        this.selected
+          this.applicationName,
+          this.dataTypeId,
+          this.selected
       );
       if (!datasetsList || !datasetsList.length) {
         this.datasets = {};
@@ -719,9 +730,9 @@ export default class DataTypesRepositoryView extends Vue {
     this.datasets = datasetMap;
     if (fileList.uuid) {
       var periode =
-        fileList.uuid &&
-        this.datasets &&
-        Object.values(this.datasets).find((e) => e.findByUUID(fileList.uuid))?.periode;
+          fileList.uuid &&
+          this.datasets &&
+          Object.values(this.datasets).find((e) => e.findByUUID(fileList.uuid))?.periode;
       this.currentDataset = this.datasets?.[periode]?.datasets;
     }
     return this.datasets;
@@ -730,13 +741,19 @@ export default class DataTypesRepositoryView extends Vue {
   remove(dataset, isPublished) {
     this.$buefy.dialog.confirm({
       message:
-        (isPublished
-          ? "<b>La version contient des données publiées.</b><br /> La supprimer entraînera la suppression de ces données.<br /><br />?"
-          : "") + "Etes vous sûr de vouloir supprimer cette version?",
+          (isPublished
+              ? "<b>La version contient des données publiées.</b><br /> La supprimer entraînera la suppression de ces données.<br /><br />?"
+              : "") + "Etes vous sûr de vouloir supprimer cette version?",
       onConfirm: () => this.deleteFile(dataset.id),
     });
   }
 
+
+  async downloadDataTypeVersion(event) {
+    await this.fileService.download(this.applicationName, event.id);
+    return false;
+  }
+
   async deleteFile(uuid) {
     var deleted = await this.fileService.remove(this.applicationName, uuid);
     this.$emit("deleted", deleted);
@@ -764,14 +781,14 @@ export default class DataTypesRepositoryView extends Vue {
       let localName = refValues.referenceValues.find((r) => r.naturalKey == key);
       if (localName?.values?.["__display_" + lang]) {
         localName = localName?.values?.["__display_" + lang];
-      }else{
+      } else {
         localName = localName?.naturalKey
       }
       if (!localName) {
         localName = key;
       }
       var completeLocalName =
-        typeof currentCompleteLocalName === "undefined" ? "" : currentCompleteLocalName;
+          typeof currentCompleteLocalName === "undefined" ? "" : currentCompleteLocalName;
       completeLocalName = completeLocalName + (completeLocalName === "" ? "" : ",") + localName;
       let authPartition = returnValues[key] || {
         key,
@@ -789,8 +806,8 @@ export default class DataTypesRepositoryView extends Vue {
       var auth = returnValues[returnValuesKey];
       let referenceValueLeaf = auth.referenceValues?.[0];
       if (
-        auth.referenceValues.length <= 1 &&
-        referenceValueLeaf.hierarchicalKey === auth.currentPath
+          auth.referenceValues.length <= 1 &&
+          referenceValueLeaf.hierarchicalKey === auth.currentPath
       ) {
         returnValues[returnValuesKey] = {
           ...auth,
@@ -799,9 +816,9 @@ export default class DataTypesRepositoryView extends Vue {
         };
       } else {
         var r = await this.partitionReferencesValues(
-          auth.referenceValues,
-          auth.currentPath,
-          auth.completeLocalName
+            auth.referenceValues,
+            auth.currentPath,
+            auth.completeLocalName
         );
         returnValues[returnValuesKey] = {
           ...auth,
-- 
GitLab