SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 6ae6de4e authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add refresh button

parent a578718b
No related branches found
No related tags found
No related merge requests found
...@@ -85,9 +85,18 @@ ...@@ -85,9 +85,18 @@
<b-row> <b-row>
<b-col class="col-lg-6"> <b-col class="col-lg-6">
<h2>Messages for <strong>{{ accountSelected }}</strong></h2> <h2>Messages for <strong>{{ accountSelected }}</strong></h2>
<small>Last loaded: {{ lastLoaded }}</small>&emsp;
<b-button
class="p-1"
size="sm"
variant="dark"
@click="refreshMessages"
>
Refresh
</b-button>
</b-col> </b-col>
<b-col class="col-lg-2"> <b-col class="col-lg-2">
<b-badge variant="primary">{{ totalRows }} total</b-badge> <b-badge variant="primary" class="p-2">{{ totalRows }} messages</b-badge>
</b-col> </b-col>
<b-col class="col-lg-4"> <b-col class="col-lg-4">
<b-pagination <b-pagination
...@@ -211,12 +220,12 @@ ...@@ -211,12 +220,12 @@
:per-page="perPage" :per-page="perPage"
:current-page="currentPage" :current-page="currentPage"
> >
<!-- <template v-slot:table-busy> --> <template v-slot:table-busy>
<!-- <div class="text-center text-primary my-2"> --> <div class="text-center text-primary my-2">
<!-- <b-spinner class="align-middle"></b-spinner> --> <b-spinner class="align-middle"></b-spinner>
<!-- <strong>Loading...</strong> --> <strong>Loading...</strong>
<!-- </div> --> </div>
<!-- </template> --> </template>
<template v-slot:head(tags)="row"> <template v-slot:head(tags)="row">
Tags<br><small class="text-muted">click to remove</small> Tags<br><small class="text-muted">click to remove</small>
</template> </template>
...@@ -308,6 +317,7 @@ export default { ...@@ -308,6 +317,7 @@ export default {
perPage: 10, perPage: 10,
currentPage: 1, currentPage: 1,
totalRows: 1, totalRows: 1,
lastLoaded: null,
fields: [ fields: [
{ key: 'actions', label: '' }, { key: 'actions', label: '' },
{ key: 'read', label: '' }, { key: 'read', label: '' },
...@@ -431,6 +441,9 @@ export default { ...@@ -431,6 +441,9 @@ export default {
} }
const promise = fetch('/mail/api/stored_messages' + params) const promise = fetch('/mail/api/stored_messages' + params)
var now = new Date()
this.lastLoaded = now.toISOString()
return promise.then(stream => stream.json()) return promise.then(stream => stream.json())
.then(data => { .then(data => {
const items = data.results const items = data.results
...@@ -439,6 +452,12 @@ export default { ...@@ -439,6 +452,12 @@ export default {
return items || [] return items || []
}) })
}, },
refreshMessages () {
this.messagesProvider({
'perPage': this.perPage,
'currentPage': this.currentPage
})
},
onFiltered(filteredItems) { onFiltered(filteredItems) {
this.totalRows = filteredItems.length this.totalRows = filteredItems.length
this.currentPage = 1 this.currentPage = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment