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() { async function syncMetaDiff() {
try { try {
if (!project.value?.id || !isDifferent.value) return if (!project.value?.id || !isDifferent.value) return
isLoading.value = true isLoading.value = true
await $api.base.metaDiffSync(project.value?.id, props.baseId) const jobData = await $api.base.metaDiffSync(project.value?.id, props.baseId)
// Table metadata recreated successfully
message.info(t('msg.info.metaDataRecreated')) $jobs.subscribe({ id: jobData.id }, undefined, async (status: string) => {
await loadTables() if (status === JobStatus.COMPLETED) {
await loadMetaDiff() // Table metadata recreated successfully
emit('baseSynced') 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) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} finally {
isLoading.value = false
} }
} }

Loading…
Cancel
Save