From e9923ffe13331ff6964fa9ec5634ffda30331d13 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 16 Nov 2023 12:24:14 +0000 Subject: [PATCH] fix: render group by label --- .../components/smartsheet/grid/GroupBy.vue | 46 +++++++------------ .../smartsheet/grid/GroupByLabel.vue | 28 +++++++++++ packages/nc-gui/composables/useViewGroupBy.ts | 6 +++ packages/nocodb/src/db/BaseModelSqlv2.ts | 4 -- 4 files changed, 50 insertions(+), 34 deletions(-) create mode 100644 packages/nc-gui/components/smartsheet/grid/GroupByLabel.vue diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index 6965f065bf..49844a3d73 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -1,9 +1,10 @@ @@ -262,32 +267,13 @@ const parseKey = (group) => { 'font-weight': 500, }" > - {{ grp.key in GROUP_BY_VARS.VAR_TITLES ? GROUP_BY_VARS.VAR_TITLES[grp.key] : parseKey(grp) }} + + + - - - -
- - - - -
- diff --git a/packages/nc-gui/components/smartsheet/grid/GroupByLabel.vue b/packages/nc-gui/components/smartsheet/grid/GroupByLabel.vue new file mode 100644 index 0000000000..ee2bd5cf2a --- /dev/null +++ b/packages/nc-gui/components/smartsheet/grid/GroupByLabel.vue @@ -0,0 +1,28 @@ + + + diff --git a/packages/nc-gui/composables/useViewGroupBy.ts b/packages/nc-gui/composables/useViewGroupBy.ts index 7bbb31c3dc..7d715082c5 100644 --- a/packages/nc-gui/composables/useViewGroupBy.ts +++ b/packages/nc-gui/composables/useViewGroupBy.ts @@ -89,6 +89,12 @@ export const useViewGroupBy = (view: Ref, where?: Computed if (col.uidt === UITypes.Checkbox) { return value ? GROUP_BY_VARS.TRUE : GROUP_BY_VARS.FALSE } + + // convert to JSON string if non-string value + if(value && typeof value === 'object') { + value = JSON.stringify(value) + } + return value ?? GROUP_BY_VARS.NULL } diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 8734bbe296..6cf9d25d21 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -388,10 +388,6 @@ class BaseModelSqlv2 { }); } - console.log('=======data'); - console.log(qb.toQuery()); - console.log('=======data'); - return data?.map((d) => { d.__proto__ = proto; return d;