mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-07 14:25:37 +00:00
Merge branch '570-hide-export-view-button-in-the-view-context-menu-if-the-view-doesnt-have-any-compatible-exporter-types' into 'develop'
Resolve #570: Hide "Export view" button in the view context menu if the view doesn't have any compatible exporter types Closes #570 See merge request bramw/baserow!560
This commit is contained in:
commit
d8dbd7299c
4 changed files with 23 additions and 13 deletions
changelog.md
web-frontend/modules/database
|
@ -24,6 +24,7 @@
|
|||
instead.
|
||||
* Fixed error when the select row modal is closed immediately after opening.
|
||||
* Add footer aggregations to grid view
|
||||
* Hide "Export view" button if there is no valid exporter available
|
||||
|
||||
## Released (2022-01-13 1.8.2)
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
import { required } from 'vuelidate/lib/validators'
|
||||
|
||||
import form from '@baserow/modules/core/mixins/form'
|
||||
import viewTypeHasExporterTypes from '@baserow/modules/database/utils/viewTypeHasExporterTypes'
|
||||
|
||||
import ExportTableDropdown from '@baserow/modules/database/components/export/ExportTableDropdown'
|
||||
import ExporterTypeChoices from '@baserow/modules/database/components/export/ExporterTypeChoices'
|
||||
|
@ -79,7 +80,7 @@ export default {
|
|||
computed: {
|
||||
viewsWithExporterTypes() {
|
||||
return this.views.filter((view) =>
|
||||
this.viewTypeHasExporterTypes(view.type)
|
||||
viewTypeHasExporterTypes(view.type, this.$registry)
|
||||
)
|
||||
},
|
||||
selectedView() {
|
||||
|
@ -128,16 +129,5 @@ export default {
|
|||
exporter_type: { required },
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
viewTypeHasExporterTypes(viewType) {
|
||||
const exporters = Object.values(this.$registry.getAll('exporter'))
|
||||
for (let i = 0; i < exporters.length; i++) {
|
||||
if (exporters[i].getSupportedViews().includes(viewType)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<Context ref="context">
|
||||
<ul class="context__menu">
|
||||
<li>
|
||||
<li v-if="hasValidExporter">
|
||||
<a @click="exportView()">
|
||||
<i class="context__menu-icon fas fa-fw fa-file-export"></i>
|
||||
{{ $t('viewContext.exportView') }}
|
||||
|
@ -34,6 +34,8 @@
|
|||
|
||||
<script>
|
||||
import context from '@baserow/modules/core/mixins/context'
|
||||
import viewTypeHasExporterTypes from '@baserow/modules/database/utils/viewTypeHasExporterTypes'
|
||||
|
||||
import ExportTableModal from '@baserow/modules/database/components/export/ExportTableModal'
|
||||
import DeleteViewModal from './DeleteViewModal'
|
||||
import WebhookModal from '@baserow/modules/database/components/webhook/WebhookModal.vue'
|
||||
|
@ -52,6 +54,11 @@ export default {
|
|||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
hasValidExporter() {
|
||||
return viewTypeHasExporterTypes(this.view.type, this.$registry)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
setLoading(view, value) {
|
||||
this.$store.dispatch('view/setItemLoading', { view, value })
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Check if the view of type viewType has at least a valid exporter.
|
||||
*/
|
||||
export default function (viewType, registry) {
|
||||
const exporters = Object.values(registry.getAll('exporter'))
|
||||
for (let i = 0; i < exporters.length; i++) {
|
||||
if (exporters[i].getSupportedViews().includes(viewType)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Loading…
Add table
Reference in a new issue