mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
194 lines
5.4 KiB
194 lines
5.4 KiB
3 years ago
|
<template>
|
||
|
<div>
|
||
3 years ago
|
<v-tabs v-model="dbsTab" color="x-active" height="30">
|
||
3 years ago
|
<!-- <v-tab href="#xc-project-meta">-->
|
||
|
<!-- <v-icon icon x-small class="mr-2">-->
|
||
|
<!-- mdi-file-table-box-multiple-outline-->
|
||
|
<!-- </v-icon>-->
|
||
|
<!-- <span class="caption text-capitalize nc-exp-imp-metadata">-->
|
||
|
<!-- <!– Export/Import Metadata –>-->
|
||
|
<!-- {{ $t('title.exportImportMeta') }}-->
|
||
|
<!-- </span>-->
|
||
|
<!-- </v-tab>-->
|
||
3 years ago
|
<v-tab-item value="xc-project-meta">
|
||
|
<div class="d-flex justify-center d-100">
|
||
3 years ago
|
<xc-meta />
|
||
3 years ago
|
</div>
|
||
|
</v-tab-item>
|
||
|
|
||
3 years ago
|
<template v-for="(db,i) in bases">
|
||
|
<v-tab :key="db.id + i" :href="'#' + db.id + 'meta'" class="text-capitalize caption nc-meta-mgmt-metadata-tab">
|
||
|
<!-- {{ db.connection.database | extractDbName }} {{ db.id }} -->
|
||
3 years ago
|
<!-- Metadata -->
|
||
|
{{ $t('title.metadata') }}
|
||
3 years ago
|
</v-tab>
|
||
3 years ago
|
<v-tab-item :key="db.id + 't' + i" :value="db.id + 'meta'">
|
||
|
<metaDiffSync
|
||
3 years ago
|
:nodes="nodes"
|
||
|
:db="db"
|
||
3 years ago
|
:db-id="db.id"
|
||
3 years ago
|
/>
|
||
3 years ago
|
</v-tab-item>
|
||
3 years ago
|
<template v-if="uiacl">
|
||
3 years ago
|
<v-tab :key="db.id + 'acl'" :href="'#' + db.id + 'acl'" class="text-capitalize caption nc-ui-acl-tab">
|
||
3 years ago
|
<!--UI Access Control-->
|
||
|
{{ $t('title.uiACL') }}
|
||
3 years ago
|
</v-tab>
|
||
3 years ago
|
<v-tab-item :key="db.id + 'aclt'" :value=" db.id + 'acl'">
|
||
3 years ago
|
<v-tabs color="x-active" height="28">
|
||
|
<v-tab class="text-capitalize caption">
|
||
3 years ago
|
<!-- Tables -->
|
||
|
{{ $t('objects.tables') }}
|
||
3 years ago
|
</v-tab>
|
||
|
<v-tab-item>
|
||
|
<toggle-table-ui-acl
|
||
|
:nodes="nodes"
|
||
|
:db="db"
|
||
3 years ago
|
:db-alias="db.id"
|
||
3 years ago
|
/>
|
||
|
</v-tab-item>
|
||
|
</v-tabs>
|
||
|
</v-tab-item>
|
||
|
</template>
|
||
3 years ago
|
</template>
|
||
|
</v-tabs>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import { mapGetters } from 'vuex'
|
||
3 years ago
|
import XcMeta from '../settings/XcMeta'
|
||
3 years ago
|
import { isMetaTable } from '@/helpers/xutils'
|
||
3 years ago
|
import metaDiffSync from '~/components/project/projectMetadata/sync/MetaDiffSync'
|
||
|
import ToggleTableUiAcl from '~/components/project/projectMetadata/uiAcl/ToggleTableUIAcl'
|
||
3 years ago
|
|
||
|
export default {
|
||
3 years ago
|
name: 'DisableOrEnableModels',
|
||
3 years ago
|
components: {
|
||
|
ToggleTableUiAcl,
|
||
3 years ago
|
metaDiffSync,
|
||
3 years ago
|
XcMeta
|
||
3 years ago
|
},
|
||
3 years ago
|
props: ['nodes'],
|
||
3 years ago
|
data: () => ({
|
||
3 years ago
|
uiacl: true,
|
||
3 years ago
|
edited: false,
|
||
|
models: null,
|
||
|
updating: false,
|
||
|
// dbsTab: 0,
|
||
|
filter: '',
|
||
|
tables: null
|
||
|
}),
|
||
3 years ago
|
async mounted() {
|
||
3 years ago
|
},
|
||
|
methods: {},
|
||
|
computed: {
|
||
3 years ago
|
bases() {
|
||
|
return this.$store.state.project.project && this.$store.state.project.project.bases
|
||
|
},
|
||
3 years ago
|
dbsTab: {
|
||
3 years ago
|
set(tab) {
|
||
3 years ago
|
if (!tab) {
|
||
|
// return this.$router.push({
|
||
|
// query: {}
|
||
|
// })
|
||
3 years ago
|
return
|
||
3 years ago
|
}
|
||
3 years ago
|
// eslint-disable-next-line camelcase
|
||
|
const nested_1 = tab
|
||
3 years ago
|
this.$router.push({
|
||
|
query: {
|
||
|
...this.$route.query,
|
||
|
nested_1
|
||
|
}
|
||
|
})
|
||
|
},
|
||
3 years ago
|
get() {
|
||
3 years ago
|
return this.$route.query.nested_1
|
||
|
}
|
||
|
|
||
|
},
|
||
|
|
||
|
...mapGetters({
|
||
|
dbAliasList: 'project/GtrDbAliasList'
|
||
|
}),
|
||
3 years ago
|
enableCountText() {
|
||
3 years ago
|
return this.models
|
||
|
? `${this.models.filter(m => m.enabled).length}/${this.models.length} enabled`
|
||
3 years ago
|
: ''
|
||
|
},
|
||
|
|
||
3 years ago
|
isNewOrDeletedModelFound() {
|
||
3 years ago
|
return this.comparedModelList.some(m => m.new || m.deleted)
|
||
|
},
|
||
3 years ago
|
comparedModelList() {
|
||
3 years ago
|
const res = []
|
||
3 years ago
|
const getPriority = (item) => {
|
||
3 years ago
|
if (item.new) { return 2 }
|
||
|
if (item.deleted) { return 1 }
|
||
|
return 0
|
||
3 years ago
|
}
|
||
|
if (this.tables && this.models) {
|
||
3 years ago
|
const tables = this.tables.filter(t => !isMetaTable(t.table_name)).map(t => t.table_name)
|
||
3 years ago
|
res.push(...this.models.map((m) => {
|
||
|
const i = tables.indexOf(m.title)
|
||
3 years ago
|
if (i === -1) {
|
||
3 years ago
|
m.deleted = true
|
||
3 years ago
|
} else {
|
||
3 years ago
|
tables.splice(i, 1)
|
||
3 years ago
|
}
|
||
3 years ago
|
return m
|
||
|
}))
|
||
3 years ago
|
res.push(...tables.map(t => ({
|
||
|
title: t, new: true
|
||
|
})))
|
||
|
}
|
||
|
res.sort((a, b) => getPriority(b) - getPriority(a))
|
||
3 years ago
|
return res
|
||
3 years ago
|
}
|
||
3 years ago
|
},
|
||
|
filters: {
|
||
|
extractDbName(name) {
|
||
|
return (name || '').split('/').pop()
|
||
|
}
|
||
3 years ago
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
::v-deep {
|
||
|
.v-tabs-bar {
|
||
|
border-bottom: solid 1px #7f828b33;
|
||
|
}
|
||
|
|
||
|
.v-tab {
|
||
|
border-right: 1px solid #7f828b33;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|