Feat(config): sort csv and improve display

This commit is contained in:
Bertrand Benjamin 2019-01-21 12:01:27 +01:00
parent 1c7a2556c4
commit a0d6087ad9
2 changed files with 22 additions and 2 deletions

View File

@ -15,7 +15,14 @@ export default {
getters: { getters: {
csvs: (state) => { csvs: (state) => {
// return array of csv filename // 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) => { rows: (state) => {
// return all data stored in csv deleting duplicates rows // return all data stored in csv deleting duplicates rows

View File

@ -13,7 +13,14 @@
--> -->
<b-list-group> <b-list-group>
<b-list-group-item v-for="csv in csvs"> <b-list-group-item v-for="csv in csvs">
{{ csv.filename }} {{ csv.data.length }} <div id="csvline">
<div class="left">
<strong>{{ csv.filename }} </strong>
</div>
<div class="right">
({{ csv.data.length }} lignes)
</div>
</div>
</b-list-group-item> </b-list-group-item>
</b-list-group> </b-list-group>
</p> </p>
@ -65,4 +72,10 @@ export default {
.datadir { .datadir {
font-weight: bold; font-weight: bold;
} }
.left {
float: left;
}
.right {
float: right;
}
</style> </style>