1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-12 16:28:06 +00:00
bramw_baserow/web-frontend/modules/database/components/view/ViewRotateSlugModal.vue
2022-01-26 16:04:13 +00:00

76 lines
1.7 KiB
Vue

<template>
<Modal>
<h2 class="box__title">{{ $t('viewRotateSlugModal.title') }}</h2>
<Error :error="error"></Error>
<div>
<p>
{{
$t('viewRotateSlugModal.refreshWarning', {
viewName: view.name,
viewTypeSharingLinkName,
})
}}
</p>
<div class="actions">
<div class="align-right">
<button
class="button button--large button--primary"
:class="{ 'button--loading': loading }"
:disabled="loading"
@click="rotateSlug()"
>
{{ $t('viewRotateSlugModal.generateNewURL') }}
</button>
</div>
</div>
</div>
</Modal>
</template>
<script>
import modal from '@baserow/modules/core/mixins/modal'
import error from '@baserow/modules/core/mixins/error'
import ViewService from '@baserow/modules/database/services/view'
export default {
name: 'ViewRotateSlugModal',
mixins: [modal, error],
props: {
view: {
type: Object,
required: true,
},
},
data() {
return {
loading: false,
}
},
computed: {
viewTypeSharingLinkName() {
return this.$registry.get('view', this.view.type).getSharingLinkName()
},
},
methods: {
async rotateSlug() {
this.hideError()
this.loading = true
try {
const { data } = await ViewService(this.$client).rotateSlug(
this.view.id
)
await this.$store.dispatch('view/forceUpdate', {
view: this.view,
values: data,
})
this.hide()
} catch (error) {
this.handleError(error, 'table')
}
this.loading = false
},
},
}
</script>