1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-06 22:08:52 +00:00

Fix various loading states

This commit is contained in:
Bram Wiepjes 2023-11-02 16:24:02 +00:00
parent 3dacea4729
commit b771058d6c
2 changed files with 20 additions and 11 deletions
web-frontend/modules
core/components/snapshots
database/components/view

View file

@ -106,9 +106,9 @@ export default {
this.stopPollIfRunning()
},
methods: {
async show(...args) {
show(...args) {
this.hideError()
await this.loadSnapshots()
this.loadSnapshots()
modal.methods.show.bind(this)(...args)
},
async submitted(values) {

View file

@ -44,7 +44,10 @@
)
"
>
<a @click="duplicateView()">
<a
:class="{ 'context__menu-item--loading': duplicateLoading }"
@click="duplicateView()"
>
<i class="context__menu-icon iconoir-copy"></i>
{{ $t('viewContext.duplicateView') }}
</a>
@ -86,7 +89,10 @@
)
"
>
<a @click="deleteView()">
<a
:class="{ 'context__menu-item--loading': deleteLoading }"
@click="deleteView()"
>
<i class="context__menu-icon iconoir-bin"></i>
{{ $t('viewContext.deleteView') }}
</a>
@ -136,6 +142,12 @@ export default {
required: true,
},
},
data() {
return {
duplicateLoading: false,
deleteLoading: false,
}
},
computed: {
hasValidExporter() {
return viewTypeHasExporterTypes(this.view.type, this.$registry)
@ -145,15 +157,12 @@ export default {
}),
},
methods: {
setLoading(view, value) {
this.$store.dispatch('view/setItemLoading', { view, value })
},
enableRename() {
this.$refs.context.hide()
this.$emit('enable-rename')
},
async deleteView() {
this.setLoading(this.view, true)
this.deleteLoading = true
try {
await this.$store.dispatch('view/delete', this.view)
@ -161,10 +170,10 @@ export default {
this.handleError(error, 'view')
}
this.setLoading(this.view, false)
this.deleteLoading = false
},
async duplicateView() {
this.setLoading(this.view, true)
this.duplicateLoading = true
let newView
try {
@ -174,7 +183,7 @@ export default {
}
this.$refs.context.hide()
this.setLoading(this.view, false)
this.duplicateLoading = false
// Redirect to the newly created view.
this.$nuxt.$router.push({