Browse Source

refactor(gui-v2): label correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2990/head
Pranav C 2 years ago
parent
commit
7f818d0599
  1. 2
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  2. 5
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue
  3. 15
      packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue
  4. 13
      packages/nc-gui-v2/components/virtual-cell/components/ListItems.vue
  5. 2
      packages/nc-gui-v2/composables/useLTARStore.ts

2
packages/nc-gui-v2/components/virtual-cell/HasMany.vue

@ -40,7 +40,7 @@ await loadRelatedTableMeta()
<MdiPlusIcon class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500" @click="listItemsDlg = true" />
</div>
<ListItems v-model="listItemsDlg" />
<ListChildItems @attachRecord="childListDlg=false,listItemsDlg=true" v-model="childListDlg" />
<ListChildItems v-model="childListDlg" @attachRecord=";(childListDlg = false), (listItemsDlg = true)" />
</div>
</template>

5
packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue

@ -32,8 +32,7 @@ await loadRelatedTableMeta()
<template v-if="value">
<ItemChip v-for="(ch, i) in value" :key="i" :value="ch[relatedTablePrimaryValueProp]" @unlink="unlink(ch)" />
<span v-if="value?.length === 10" class="caption pointer ml-1 grey--text"
@click="childListDlg = true">more... </span>
<span v-if="value?.length === 10" class="caption pointer ml-1 grey--text" @click="childListDlg = true">more... </span>
</template>
</div>
<div class="flex-1 flex justify-end gap-1">
@ -41,7 +40,7 @@ await loadRelatedTableMeta()
<MdiPlusIcon class="text-sm nc-action-icon text-gray-500/50 hover:text-gray-500" @click="listItemsDlg = true" />
</div>
<ListItems v-model="listItemsDlg" />
<ListChildItems @attachRecord="childListDlg=false,listItemsDlg=true" v-model="childListDlg" />
<ListChildItems v-model="childListDlg" @attachRecord=";(childListDlg = false), (listItemsDlg = true)" />
</div>
</template>

15
packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue

@ -10,15 +10,7 @@ const emit = defineEmits(['update:modelValue', 'attachRecord'])
const vModel = useVModel(props, 'modelValue', emit)
const {
childrenList,
meta,
deleteRelatedRow,
loadChildrenList,
childrenListPagination,
relatedTablePrimaryValueProp,
unlink,
} =
const { childrenList, meta, deleteRelatedRow, loadChildrenList, childrenListPagination, relatedTablePrimaryValueProp, unlink } =
useLTARStoreOrThrow()
watch(vModel, () => {
@ -56,8 +48,7 @@ const unlinkRow = async (row: Record<string, any>) => {
</div>
<div class="flex gap-2">
<MdiUnlinkIcon class="text-xs text-grey hover:(!text-red-500) cursor-pointer" @click="unlinkRow(row)" />
<MdiDeleteIcon class="text-xs text-grey hover:(!text-red-500) cursor-pointer"
@click="deleteRelatedRow(row)" />
<MdiDeleteIcon class="text-xs text-grey hover:(!text-red-500) cursor-pointer" @click="deleteRelatedRow(row)" />
</div>
</div>
</a-card>
@ -72,7 +63,7 @@ const unlinkRow = async (row: Record<string, any>) => {
show-less-items
/>
</template>
<a-empty class="my-10" v-else />
<a-empty v-else class="my-10" />
</div>
</a-modal>
</template>

13
packages/nc-gui-v2/components/virtual-cell/components/ListItems.vue

@ -20,16 +20,21 @@ watch(vModel, () => {
const linkRow = async (row: Record<string, any>) => {
await link(row)
vModel.value= false
vModel.value = false
// await loadChildrenExcludedList()
}
</script>
<template>
<a-modal v-model:visible="vModel" :footer="null" title="Related table rows">
<a-modal v-model:visible="vModel" :footer="null" title="Link Record">
<div class="max-h-[max(calc(100vh_-_300px)_,500px)] flex flex-col">
<div class="flex mb-4 align-center gap-2">
<a-input v-model:value="childrenExcludedListPagination.query" placeholder="Filter query" class="max-w-[200px]" size="small"></a-input>
<a-input
v-model:value="childrenExcludedListPagination.query"
placeholder="Filter query"
class="max-w-[200px]"
size="small"
></a-input>
<div class="flex-1" />
<MdiReloadIcon class="cursor-pointer text-gray-500" @click="loadChildrenExcludedList" />
<a-button type="primary" size="small" @click="emit('addNewRecord')">Add new record</a-button>
@ -55,7 +60,7 @@ const linkRow = async (row: Record<string, any>) => {
show-less-items
/>
</template>
<a-empty class="my-10" v-else />
<a-empty v-else class="my-10" />
</div>
</a-modal>
</template>

2
packages/nc-gui-v2/composables/useLTARStore.ts

@ -110,7 +110,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
$api.dbTableRow.delete(NOCO, project.value.id as string, relatedTableMeta.value.id as string, id as string)
reloadData?.()
await loadChildrenList()
} catch (e) {
} catch (e: any) {
notification.error(await extractSdkResponseErrorMsg(e))
}
},

Loading…
Cancel
Save