mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
Update the nuxt3 version. Co-authored-by: Jonathan Adeline <jonathan@baserow.io> Co-authored-by: Bram Wiepjes <bramw@protonmail.com> Co-authored-by: Cezary <cezary@baserow.io> Co-authored-by: Tsering Paljor <tsering@baserow.io> Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io> Co-authored-by: Bram <bram2w@users.noreply.github.com>
78 lines
1.9 KiB
Vue
78 lines
1.9 KiB
Vue
<template>
|
|
<li
|
|
class="tree__item"
|
|
:class="{
|
|
'tree__item--loading': application._.loading,
|
|
}"
|
|
>
|
|
<div class="tree__action">
|
|
<a class="tree__link" @click="$emit('selected', application)">
|
|
<i class="tree__icon" :class="application._.type.iconClass"></i>
|
|
<span class="tree__link-text">{{ application.name }}</span>
|
|
</a>
|
|
</div>
|
|
<template v-if="application._.selected">
|
|
<ul class="tree__subs">
|
|
<li
|
|
v-for="table in orderedTables"
|
|
:key="table.id"
|
|
class="tree__sub"
|
|
:class="{ active: isTableActive(table) }"
|
|
>
|
|
<a class="tree__sub-link" @click="selectTable(application, table)">
|
|
<i
|
|
v-if="table.data_sync"
|
|
class="context__menu-item-icon iconoir-data-transfer-down"
|
|
></i>
|
|
{{ table.name }}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</template>
|
|
</li>
|
|
</template>
|
|
|
|
<script>
|
|
import { DatabaseApplicationType } from '@baserow/modules/database/applicationTypes'
|
|
|
|
export default {
|
|
name: 'DBTemplateSidebar',
|
|
props: {
|
|
application: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
page: {
|
|
required: true,
|
|
validator: (prop) => typeof prop === 'object' || prop === null,
|
|
},
|
|
},
|
|
emits: ['selected', 'selected-page'],
|
|
computed: {
|
|
orderedTables() {
|
|
return this.application.tables
|
|
.map((table) => table)
|
|
.sort((a, b) => a.order - b.order)
|
|
},
|
|
},
|
|
methods: {
|
|
selectTable(application, table) {
|
|
this.$emit('selected-page', {
|
|
application: DatabaseApplicationType.getType(),
|
|
value: {
|
|
database: application,
|
|
table,
|
|
},
|
|
})
|
|
},
|
|
isTableActive(table) {
|
|
return (
|
|
this.page !== null &&
|
|
this.page.application === DatabaseApplicationType.getType() &&
|
|
this.page.value.table.id === table.id
|
|
)
|
|
},
|
|
},
|
|
}
|
|
</script>
|