Browse Source

feat: sync metadata front end

pull/6528/head
mertmit 1 year ago
parent
commit
b6db2df5a4
  1. 25
      packages/nc-gui/components/dashboard/settings/Metadata.vue

25
packages/nc-gui/components/dashboard/settings/Metadata.vue

@ -41,21 +41,30 @@ async function loadMetaDiff() {
}
}
const { $jobs } = useNuxtApp()
async function syncMetaDiff() {
try {
if (!project.value?.id || !isDifferent.value) return
isLoading.value = true
await $api.base.metaDiffSync(project.value?.id, props.baseId)
// Table metadata recreated successfully
message.info(t('msg.info.metaDataRecreated'))
await loadTables()
await loadMetaDiff()
emit('baseSynced')
const jobData = await $api.base.metaDiffSync(project.value?.id, props.baseId)
$jobs.subscribe({ id: jobData.id }, undefined, async (status: string) => {
if (status === JobStatus.COMPLETED) {
// Table metadata recreated successfully
message.info(t('msg.info.metaDataRecreated'))
await loadTables()
await loadMetaDiff()
emit('baseSynced')
isLoading.value = false
} else if (status === JobStatus.FAILED) {
message.error('Failed to sync base metadata')
isLoading.value = false
}
})
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
} finally {
isLoading.value = false
}
}

Loading…
Cancel
Save