1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-18 03:13:47 +00:00

Resolve "Hide views that don't have any exporters"

This commit is contained in:
Bram Wiepjes 2021-08-04 10:28:56 +00:00
parent 09405e83e4
commit 2f6bd163af
2 changed files with 18 additions and 1 deletions
changelog.md
web-frontend/modules/database/components/export

View file

@ -13,6 +13,7 @@
* Made it possible to use the "F2"-Key to edit a cell without clearing the cell content.
* Added password validation to password reset page.
* Add backup and restore database management commands.
* Hide view types that can't be exported in the export modal.
* Relaxed the URL field validator and made it consistent between the backend and
web-frontend.

View file

@ -7,7 +7,7 @@
<div class="control__elements">
<ExportTableDropdown
v-model="values.view_id"
:views="views"
:views="viewsWithExporterTypes"
:loading="loading"
@input="values.exporter_type = firstExporterType"
></ExportTableDropdown>
@ -72,6 +72,11 @@ export default {
}
},
computed: {
viewsWithExporterTypes() {
return this.views.filter((view) =>
this.viewTypeHasExporterTypes(view.type)
)
},
selectedView() {
return this.views.find((view) => view.id === this.values.view_id) || null
},
@ -108,5 +113,16 @@ 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>