Feat: manager case when there is no datas

This commit is contained in:
Bertrand Benjamin 2018-12-03 12:15:22 +01:00
parent 06855a1f5b
commit 9f3cdd4f1b
2 changed files with 46 additions and 33 deletions

View File

@ -27,6 +27,9 @@ export default {
rows: (state) => { rows: (state) => {
return state.rows.data return state.rows.data
}, },
present: (state) => {
return state.rows.data.length > 0
},
spending_rows: (state, getters) => { spending_rows: (state, getters) => {
return getters.rows.filter(x => x.Montant < 0) return getters.rows.filter(x => x.Montant < 0)
}, },

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="import"> <div class="import">
<h1>Analyse</h1> <h1>Analyse</h1>
<div class="analysis" v-if="rows"> <div class="analysis" v-if="datas_present">
<b-container fluid> <b-container fluid>
<b-row class="date-selector"> <b-row class="date-selector">
<b-col sm="1"><label for="start"> Entre </label> </b-col> <b-col sm="1"><label for="start"> Entre </label> </b-col>
@ -35,9 +35,16 @@
</b-table> </b-table>
</div> </div>
<div v-else> <div v-else>
<div class="nodata">
<h1>
<font-awesome-icon icon="dizzy" class="fa"/> <font-awesome-icon icon="dizzy" class="fa"/>
Pas de données Pas de données
<font-awesome-icon icon="dizzy" class="fa"/> <font-awesome-icon icon="dizzy" class="fa"/>
</h1>
<p>
Penser à en importer!
</p>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -89,7 +96,7 @@ export default {
...mapGetters({ ...mapGetters({
'csvs': 'datas/csvs', 'csvs': 'datas/csvs',
'tag_filter_rows': 'datas/tag_filter_rows', 'tag_filter_rows': 'datas/tag_filter_rows',
'rows': 'datas/rows', 'datas_present': 'datas/present',
'start': 'datas/start', 'start': 'datas/start',
'end': 'datas/end', 'end': 'datas/end',
'tags': 'config/tags' 'tags': 'config/tags'
@ -120,5 +127,8 @@ export default {
.date-selector { .date-selector {
padding: 1rem; padding: 1rem;
} }
.nodata{
text-align: center;
}
</style> </style>