wip: towards v1

Signed-off-by: Pranav C <pranavxc@gmail.com>
This commit is contained in:
Pranav C
2022-04-05 00:15:11 +05:30
parent 829c52925a
commit 8733948056
531 changed files with 157998 additions and 44971 deletions

View File

@@ -93,10 +93,10 @@
<template #item="{item,index}">
<tr class="caption">
<td>{{ index + 1 }}</td>
<td>{{ item.relationType === 'hm' ? item.rtn : item.tn }}</td>
<td>{{ item.relationType === 'hm' ? item.rtn : item.table_name }}</td>
<td>{{ item.relationType === 'hm' ? 'HasMany' : 'BelongsTo' }}</td>
<td>{{ item.rtn }}</td>
<td>{{ item.tn }}</td>
<td>{{ item.table_name }}</td>
<!-- <td>
<v-checkbox
v-model="item.enabled"

View File

@@ -1,5 +1,5 @@
<template>
<v-container v-if="dbAliasList[dbsTab]" fluid>
<v-container fluid>
<v-card>
<v-row>
<!-- <v-col cols="12">-->
@@ -28,7 +28,7 @@
small
color="primary"
icon="refresh"
@click="loadXcDiff()"
@click="clickReload"
>
<!-- Reload -->
{{ $t('general.reload') }}
@@ -76,18 +76,18 @@
<tbody>
<tr
v-for="model in diff"
v-show="!filter.trim() || (model.tn || model.title || '').toLowerCase().includes(filter.toLowerCase())"
:key="model.title"
:class="`nc-metasync-row nc-metasync-row-${model.tn}`"
v-show="!filter.trim() || (model.table_name || model.title || '').toLowerCase().includes(filter.toLowerCase())"
:key="model.table_name"
:class="`nc-metasync-row nc-metasync-row-${model.table_name}`"
>
<!-- v-if="model.alias.toLowerCase().indexOf(filter.toLowerCase()) > -1">-->
<td>
<v-icon small :color="viewIcons[model.type==='table'?'grid':'view'].color" v-on="on">
<!-- <v-icon small :color="viewIcons[model.type==='table'?'grid':'view'].color" v-on="on">
{{ viewIcons[model.type === 'table' ? 'grid' : 'view'].icon }}
</v-icon>
</v-icon>-->
<v-tooltip bottom>
<template #activator="{on}">
<span v-on="on">{{ model.tn && model.tn.slice(prefix.length) }}</span>
<span v-on="on">{{ model.table_name && model.table_name.slice(prefix.length) }}</span>
</template>
<span class="caption">{{ model.title }}</span>
</v-tooltip>
@@ -244,6 +244,7 @@
<div class="d-flex justify-center">
<v-btn
v-if="isChanged"
v-t="['proj-meta:metadata:metasync']"
x-large
class="mx-auto primary nc-btn-metasync-sync-now"
@click="syncMetaDiff"
@@ -272,11 +273,9 @@
<script>
import { mapGetters } from 'vuex'
import viewIcons from '~/helpers/viewIcons'
import XBtn from '~/components/global/xBtn'
export default {
name: 'DisableOrEnableTables',
components: { XBtn },
props: ['nodes', 'db'],
data: () => ({
viewIcons,
@@ -290,15 +289,20 @@ export default {
}),
async mounted() {
await this.loadXcDiff()
// await this.loadModels()
// await this.loadTableList()
// await this.loadMode// await this.loadTableList()
},
methods: {
async loadXcDiff() {
this.diff = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'xcMetaDiff'])
this.diff = (await this.$api.project.metaDiffGet(this.$store.state.project.projectId, this.db.id))
// this.diff = await this.$store.dispatch('sqlMgr/ActSqlOp', [{
// dbAlias: this.db.meta.dbAlias,
// env: this.$store.getters['project/GtrEnv']
// }, 'xcMetaDiff'])
},
clickReload() {
this.loadXcDiff()
this.$tele.emit('proj-meta:metadata:reload')
},
/* async addTableMeta(tables) {
try {
@@ -345,10 +349,11 @@ export default {
*/
async syncMetaDiff() {
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [{
dbAlias: this.db.meta.dbAlias,
env: this.$store.getters['project/GtrEnv']
}, 'xcMetaDiffSync', {}])
await this.$api.project.metaDiffSync(this.$store.state.project.projectId, this.db.id)
// await this.$store.dispatch('sqlMgr/ActSqlOp', [{
// dbAlias: this.db.meta.dbAlias,
// env: this.$store.getters['project/GtrEnv']
// }, 'xcMetaDiffSync', {}])
this.$toast.success('Table metadata recreated successfully').goAway(3000)
await this.loadXcDiff()
@@ -448,7 +453,7 @@ export default {
return 0
}
if (this.tables && this.models) {
const tables = this.tables.filter(t => !isMetaTable(t.tn)).map(t => t.tn)
const tables = this.tables.filter(t => !isMetaTable(t.table_name)).map(t => t.table_name)
res.push(...this.models.map((m) => {
const i = tables.indexOf(m.title)
if (i === -1) {