Browse Source

Merge pull request #3489 from nocodb/fix/gui-v2-tableRename-LTAR

fix(gui-v2): set metas with updated model after renaming tables
pull/3496/head
Raju Udava 2 years ago committed by GitHub
parent
commit
6ddd2e7dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      packages/nc-gui-v2/components/dlg/TableRename.vue

18
packages/nc-gui-v2/components/dlg/TableRename.vue

@ -3,19 +3,25 @@ import { watchEffect } from '@vue/runtime-core'
import { Form, message } from 'ant-design-vue' import { Form, message } from 'ant-design-vue'
import type { TableType } from 'nocodb-sdk' import type { TableType } from 'nocodb-sdk'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useProject, useTabs } from '#imports' import { useProject, useTabs, useMetas } from '#imports'
import { extractSdkResponseErrorMsg, validateTableName } from '~/utils' import { extractSdkResponseErrorMsg, validateTableName } from '~/utils'
import { useNuxtApp } from '#app' import { useNuxtApp } from '#app'
const { modelValue = false, tableMeta } = defineProps<Props>()
const emit = defineEmits(['update:modelValue', 'updated'])
const { t } = useI18n()
interface Props { interface Props {
modelValue?: boolean modelValue?: boolean
tableMeta: TableType tableMeta: TableType
} }
const { modelValue = false, tableMeta } = defineProps<Props>()
const emit = defineEmits(['update:modelValue', 'updated'])
const { t } = useI18n()
const { $e, $api } = useNuxtApp() const { $e, $api } = useNuxtApp()
const { setMeta } = useMetas()
const dialogShow = computed({ const dialogShow = computed({
get() { get() {
return modelValue return modelValue
@ -99,6 +105,10 @@ const renameTable = async () => {
dialogShow.value = false dialogShow.value = false
loadTables() loadTables()
updateTab({ id: tableMeta?.id }, { title: formState.title }) updateTab({ id: tableMeta?.id }, { title: formState.title })
// update metas
setMeta(await $api.dbTable.read(tableMeta?.id as string))
// Table renamed successfully // Table renamed successfully
message.success(t('msg.success.tableRenamed')) message.success(t('msg.success.tableRenamed'))
$e('a:table:rename') $e('a:table:rename')

Loading…
Cancel
Save