1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-27 22:16:13 +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() this.stopPollIfRunning()
}, },
methods: { methods: {
async show(...args) { show(...args) {
this.hideError() this.hideError()
await this.loadSnapshots() this.loadSnapshots()
modal.methods.show.bind(this)(...args) modal.methods.show.bind(this)(...args)
}, },
async submitted(values) { 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> <i class="context__menu-icon iconoir-copy"></i>
{{ $t('viewContext.duplicateView') }} {{ $t('viewContext.duplicateView') }}
</a> </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> <i class="context__menu-icon iconoir-bin"></i>
{{ $t('viewContext.deleteView') }} {{ $t('viewContext.deleteView') }}
</a> </a>
@ -136,6 +142,12 @@ export default {
required: true, required: true,
}, },
}, },
data() {
return {
duplicateLoading: false,
deleteLoading: false,
}
},
computed: { computed: {
hasValidExporter() { hasValidExporter() {
return viewTypeHasExporterTypes(this.view.type, this.$registry) return viewTypeHasExporterTypes(this.view.type, this.$registry)
@ -145,15 +157,12 @@ export default {
}), }),
}, },
methods: { methods: {
setLoading(view, value) {
this.$store.dispatch('view/setItemLoading', { view, value })
},
enableRename() { enableRename() {
this.$refs.context.hide() this.$refs.context.hide()
this.$emit('enable-rename') this.$emit('enable-rename')
}, },
async deleteView() { async deleteView() {
this.setLoading(this.view, true) this.deleteLoading = true
try { try {
await this.$store.dispatch('view/delete', this.view) await this.$store.dispatch('view/delete', this.view)
@ -161,10 +170,10 @@ export default {
this.handleError(error, 'view') this.handleError(error, 'view')
} }
this.setLoading(this.view, false) this.deleteLoading = false
}, },
async duplicateView() { async duplicateView() {
this.setLoading(this.view, true) this.duplicateLoading = true
let newView let newView
try { try {
@ -174,7 +183,7 @@ export default {
} }
this.$refs.context.hide() this.$refs.context.hide()
this.setLoading(this.view, false) this.duplicateLoading = false
// Redirect to the newly created view. // Redirect to the newly created view.
this.$nuxt.$router.push({ this.$nuxt.$router.push({