1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-24 16:36:46 +00:00
bramw_baserow/web-frontend/modules/database/components/docs/APIDocsSelectDatabase.vue
2024-07-25 17:05:43 +00:00

48 lines
1.2 KiB
Vue

<template>
<div class="select-application">
<template v-if="hasDatabases">
<APIDocsSelectDatabaseWorkspace
v-for="workspace in workspaces"
:key="workspace.id"
:workspace="workspace"
:selected="selected"
></APIDocsSelectDatabaseWorkspace>
</template>
<p v-else class="margin-bottom-3">
{{ $t('apiDocsSelectDatabase.needOneDatabase') }}
</p>
</div>
</template>
<script>
import { mapState } from 'vuex'
import { DatabaseApplicationType } from '@baserow/modules/database/applicationTypes'
import APIDocsSelectDatabaseWorkspace from '@baserow/modules/database/components/docs/APIDocsSelectDatabaseWorkspace'
export default {
name: 'APIDocsSelectDatabase',
components: { APIDocsSelectDatabaseWorkspace },
props: {
selected: {
type: Number,
required: false,
default: -1,
},
},
computed: {
hasDatabases() {
const databaseType = DatabaseApplicationType.getType()
return (
this.$store.getters['application/getAll'].filter(
(application) => application.type === databaseType
).length > 0
)
},
...mapState({
workspaces: (state) => state.workspace.items,
}),
},
}
</script>