Browse Source

Merge pull request #4495 from nocodb/fix/page-switch-bug

fix(nc-gui): page swtich bug + gallery display bug
pull/4497/head
Pranav C 2 years ago committed by GitHub
parent
commit
381577b328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/nc-gui/app.vue
  2. 7
      packages/nc-gui/components/smartsheet/Gallery.vue
  3. 7
      packages/nc-gui/components/smartsheet/Kanban.vue
  4. 5
      packages/nc-gui/pages/account/index/users.vue
  5. 30
      packages/nc-gui/pages/account/index/users/[[nestedPage]].vue
  6. 156
      packages/nc-gui/pages/index/index/index.vue
  7. 4
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

2
packages/nc-gui/app.vue

@ -36,7 +36,7 @@ if (typeof window !== 'undefined') {
<template> <template>
<a-config-provider> <a-config-provider>
<NuxtLayout :name="disableBaseLayout ? false : 'base'"> <NuxtLayout :name="disableBaseLayout ? false : 'base'">
<NuxtPage :key="key" /> <NuxtPage :transition="false" :key="key" />
</NuxtLayout> </NuxtLayout>
</a-config-provider> </a-config-provider>
</template> </template>

7
packages/nc-gui/components/smartsheet/Gallery.vue

@ -80,7 +80,12 @@ const isRowEmpty = (record: any, col: any) => {
const attachments = (record: any): Attachment[] => { const attachments = (record: any): Attachment[] => {
try { try {
return coverImageColumn?.title && record.row[coverImageColumn.title] ? JSON.parse(record.row[coverImageColumn.title]) : [] if (coverImageColumn?.title && record.row[coverImageColumn.title]) {
return typeof record.row[coverImageColumn.title] === 'string'
? JSON.parse(record.row[coverImageColumn.title])
: record.row[coverImageColumn.title]
}
return []
} catch (e) { } catch (e) {
return [] return []
} }

7
packages/nc-gui/components/smartsheet/Kanban.vue

@ -116,7 +116,12 @@ reloadViewDataHook?.on(async () => {
const attachments = (record: any): Attachment[] => { const attachments = (record: any): Attachment[] => {
try { try {
return coverImageColumn?.title && record.row[coverImageColumn.title] ? JSON.parse(record.row[coverImageColumn.title]) : [] if (coverImageColumn?.title && record.row[coverImageColumn.title]) {
return typeof record.row[coverImageColumn.title] === 'string'
? JSON.parse(record.row[coverImageColumn.title])
: record.row[coverImageColumn.title]
}
return []
} catch (e) { } catch (e) {
return [] return []
} }

5
packages/nc-gui/pages/account/index/users.vue

@ -1,5 +0,0 @@
<template>
<div class="h-full overflow-y-scroll scrollbar-thin-dull pt-2">
<NuxtPage />
</div>
</template>

30
packages/nc-gui/pages/account/index/users/[[nestedPage]].vue

@ -5,18 +5,20 @@ const { isUIAllowed } = useUIPermission()
</script> </script>
<template> <template>
<template <div class="h-full overflow-y-scroll scrollbar-thin-dull pt-2">
v-if=" <template
$route.params.nestedPage === 'password-reset' || v-if="
(!isUIAllowed('superAdminUserManagement') && !isUIAllowed('superAdminAppSettings')) $route.params.nestedPage === 'password-reset' ||
" (!isUIAllowed('superAdminUserManagement') && !isUIAllowed('superAdminAppSettings'))
> "
<LazyAccountResetPassword /> >
</template> <LazyAccountResetPassword />
<template v-else-if="$route.params.nestedPage === 'settings'"> </template>
<LazyAccountSignupSettings /> <template v-else-if="$route.params.nestedPage === 'settings'">
</template> <LazyAccountSignupSettings />
<template v-else-if="isUIAllowed('superAdminUserManagement')"> </template>
<LazyAccountUserList /> <template v-else-if="isUIAllowed('superAdminUserManagement')">
</template> <LazyAccountUserList />
</template>
</div>
</template> </template>

156
packages/nc-gui/pages/index/index/index.vue

@ -212,92 +212,94 @@ const copyProjectMeta = async () => {
</a-dropdown> </a-dropdown>
</div> </div>
<Transition name="layout" mode="out-in"> <!--
<div v-if="isLoading"> TODO: bring back transition after fixing the bug with navigation
<a-skeleton /> <Transition name="layout" mode="out-in"> -->
</div> <div v-if="isLoading">
<a-skeleton />
<a-table </div>
v-else
:custom-row="customRow"
:data-source="filteredProjects"
:pagination="{ position: ['bottomCenter'] }"
:table-layout="md ? 'auto' : 'fixed'"
>
<template #emptyText>
<a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="$t('labels.noData')" />
</template>
<!-- Title --> <a-table
<a-table-column key="title" :title="$t('general.title')" data-index="title"> v-else
<template #default="{ text, record }"> :custom-row="customRow"
<div class="flex items-center"> :data-source="filteredProjects"
<div @click.stop> :pagination="{ position: ['bottomCenter'] }"
<a-menu class="!border-0 !m-0 !p-0" trigger-sub-menu-action="click"> :table-layout="md ? 'auto' : 'fixed'"
<template v-if="isUIAllowed('projectTheme')"> >
<a-sub-menu key="theme" popup-class-name="custom-color"> <template #emptyText>
<template #title> <a-empty :image="Empty.PRESENTED_IMAGE_SIMPLE" :description="$t('labels.noData')" />
<div </template>
class="color-selector"
:style="{ <!-- Title -->
'background-color': getProjectPrimary(record), <a-table-column key="title" :title="$t('general.title')" data-index="title">
'width': '8px', <template #default="{ text, record }">
'height': '100%', <div class="flex items-center">
}" <div @click.stop>
/> <a-menu class="!border-0 !m-0 !p-0" trigger-sub-menu-action="click">
</template> <template v-if="isUIAllowed('projectTheme')">
<a-sub-menu key="theme" popup-class-name="custom-color">
<template #title>
<div
class="color-selector"
:style="{
'background-color': getProjectPrimary(record),
'width': '8px',
'height': '100%',
}"
/>
</template>
<template #expandIcon></template> <template #expandIcon></template>
<LazyGeneralColorPicker <LazyGeneralColorPicker
:model-value="getProjectPrimary(record)" :model-value="getProjectPrimary(record)"
:colors="projectThemeColors" :colors="projectThemeColors"
:row-size="9" :row-size="9"
:advanced="false" :advanced="false"
@input="handleProjectColor(record.id, $event)" @input="handleProjectColor(record.id, $event)"
/> />
<a-sub-menu key="pick-primary"> <a-sub-menu key="pick-primary">
<template #title> <template #title>
<div class="nc-project-menu-item group !py-0"> <div class="nc-project-menu-item group !py-0">
<ClarityColorPickerSolid class="group-hover:text-accent" /> <ClarityColorPickerSolid class="group-hover:text-accent" />
Custom Color Custom Color
</div> </div>
</template> </template>
<template #expandIcon></template> <template #expandIcon></template>
<LazyGeneralChromeWrapper @input="handleProjectColor(record.id, $event)" /> <LazyGeneralChromeWrapper @input="handleProjectColor(record.id, $event)" />
</a-sub-menu>
</a-sub-menu> </a-sub-menu>
</template> </a-sub-menu>
</a-menu> </template>
</div> </a-menu>
<div
class="capitalize color-transition group-hover:text-primary !w-[400px] h-full overflow-hidden overflow-ellipsis whitespace-nowrap pl-2"
>
{{ text }}
</div>
</div> </div>
</template> <div
</a-table-column> class="capitalize color-transition group-hover:text-primary !w-[400px] h-full overflow-hidden overflow-ellipsis whitespace-nowrap pl-2"
<!-- Actions --> >
{{ text }}
<a-table-column key="id" :title="$t('labels.actions')" data-index="id">
<template #default="{ text, record }">
<div class="flex items-center gap-2">
<MdiEditOutline v-e="['c:project:edit:rename']" class="nc-action-btn" @click.stop="navigateTo(`/${text}`)" />
<MdiDeleteOutline
class="nc-action-btn"
:data-testid="`delete-project-${record.title}`"
@click.stop="deleteProject(record)"
/>
</div> </div>
</template> </div>
</a-table-column> </template>
</a-table> </a-table-column>
</Transition> <!-- Actions -->
<a-table-column key="id" :title="$t('labels.actions')" data-index="id">
<template #default="{ text, record }">
<div class="flex items-center gap-2">
<MdiEditOutline v-e="['c:project:edit:rename']" class="nc-action-btn" @click.stop="navigateTo(`/${text}`)" />
<MdiDeleteOutline
class="nc-action-btn"
:data-testid="`delete-project-${record.title}`"
@click.stop="deleteProject(record)"
/>
</div>
</template>
</a-table-column>
</a-table>
<!-- </Transition> -->
</div> </div>
</template> </template>

4
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -2617,7 +2617,9 @@ class BaseModelSqlv2 {
const proto = await this.getProto(); const proto = await this.getProto();
const result = (await groupedQb)?.map((d) => { let data = await groupedQb;
data = this.convertAttachmentType(data);
const result = data?.map((d) => {
d.__proto__ = proto; d.__proto__ = proto;
return d; return d;
}); });

Loading…
Cancel
Save