From a0d6087ad9da123810b85666330cf8a6ca36b22a Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Mon, 21 Jan 2019 12:01:27 +0100 Subject: [PATCH] Feat(config): sort csv and improve display --- src/store/modules/datas.js | 9 ++++++++- src/views/config.vue | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/store/modules/datas.js b/src/store/modules/datas.js index 036dbb7..2e64b28 100644 --- a/src/store/modules/datas.js +++ b/src/store/modules/datas.js @@ -15,7 +15,14 @@ export default { getters: { csvs: (state) => { // return array of csv filename - return Object.values(state.csv) + return Object.values(state.csv).sort((a, b) => { + var filenameA=a.filename.toLowerCase(), filenameB=b.filename.toLowerCase(); + if (filenameA < filenameB) //sort string ascending + return -1; + if (filenameA > filenameB) + return 1; + return 0; //default return value (no sorting) + }); }, rows: (state) => { // return all data stored in csv deleting duplicates rows diff --git a/src/views/config.vue b/src/views/config.vue index b034d83..ef0523d 100644 --- a/src/views/config.vue +++ b/src/views/config.vue @@ -13,7 +13,14 @@ --> - {{ csv.filename }} {{ csv.data.length }} +
+
+ {{ csv.filename }} +
+
+ ({{ csv.data.length }} lignes) +
+

@@ -65,4 +72,10 @@ export default { .datadir { font-weight: bold; } +.left { + float: left; +} +.right { + float: right; +}