Browse Source

wip(gui-v2): reload after adding a new column

pull/3030/head
Wing-Kam Wong 2 years ago
parent
commit
0287974188
  1. 19
      packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue
  2. 11
      packages/nc-gui-v2/components/smartsheet/Form.vue

19
packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

@ -6,7 +6,7 @@ import { uiTypes } from '~/utils/columnUtils'
import MdiPlusIcon from '~icons/mdi/plus-circle-outline'
import MdiMinusIcon from '~icons/mdi/minus-circle-outline'
const emit = defineEmits(['cancel'])
const emit = defineEmits(['cancel', 'submit'])
const meta = inject(MetaInj)
const advancedOptions = ref(false)
const { getMeta } = useMetas()
@ -39,9 +39,20 @@ const uiTypesOptions = computed<typeof uiTypes>(() => {
]
})
const reloadMeta = () => {
const reloadMeta = async () => {
// FIXME: this not working
console.log('HEREEEE')
emit('cancel')
getMeta(meta?.value.id as string, true)
await getMeta(meta?.value.id as string, true)
}
async function handleSubmit() {
// FIXME: await addOrUpdate(reloadMeta)
await addOrUpdate()
await reloadMeta()
// FIXME: emit fails
emit('submit')
advancedOptions.value = false
}
// create column meta if it's a new column
@ -125,7 +136,7 @@ watchEffect(() => {
<!-- Cancel -->
{{ $t('general.cancel') }}
</a-button>
<a-button html-type="submit" type="primary" size="small" @click="addOrUpdate(reloadMeta), (advancedOptions = false)">
<a-button html-type="submit" type="primary" size="small" @click="handleSubmit">
<!-- Save -->
{{ $t('general.save') }}
</a-button>

11
packages/nc-gui-v2/components/smartsheet/Form.vue

@ -266,6 +266,12 @@ function onEmailChange() {
checkSMTPStatus()
}
async function submitCallback() {
await loadFormView()
setFormData()
showColumnDropdown.value = false
}
const updateColMeta = useDebounceFn(async (col: Record<string, any>) => {
if (col.id) {
try {
@ -387,12 +393,13 @@ onMounted(async () => {
{{ $t('activity.addField') }}
</div>
</a-button>
<!-- TODO #2: make the component out of sidebar -->
<!-- TODO #3: reload view -->
<!-- TODO #1: make the component out of sidebar -->
<!-- TODO #2: reload view -->
<SmartsheetColumnEditOrAdd
v-if="showColumnDropdown"
ref="editOrAddRef"
@click.stop
@submit="submitCallback"
@cancel="showColumnDropdown = false"
/>
</template>

Loading…
Cancel
Save