Browse Source

feat: sync metadata front end

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

15
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)
$jobs.subscribe({ id: jobData.id }, undefined, async (status: string) => {
if (status === JobStatus.COMPLETED) {
// Table metadata recreated successfully // Table metadata recreated successfully
message.info(t('msg.info.metaDataRecreated')) message.info(t('msg.info.metaDataRecreated'))
await loadTables() await loadTables()
await loadMetaDiff() await loadMetaDiff()
emit('baseSynced') 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