Browse Source

fix(nocodb): fetch calendarView dependency fields even if hidden

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
3c3746831d
  1. 14
      packages/nocodb/src/helpers/getAst.ts
  2. 1
      packages/nocodb/src/models/index.ts

14
packages/nocodb/src/helpers/getAst.ts

@ -43,6 +43,7 @@ const getAst = async ({
dependencyFields.fieldsSet = dependencyFields.fieldsSet || new Set(); dependencyFields.fieldsSet = dependencyFields.fieldsSet || new Set();
let coverImageId; let coverImageId;
let dependencyFieldsForCalenderView;
if (view && view.type === ViewTypes.GALLERY) { if (view && view.type === ViewTypes.GALLERY) {
const gallery = await GalleryView.get(view.id); const gallery = await GalleryView.get(view.id);
coverImageId = gallery.fk_cover_image_col_id; coverImageId = gallery.fk_cover_image_col_id;
@ -52,6 +53,14 @@ const getAst = async ({
} else if (view && view.type === ViewTypes.CALENDAR) { } else if (view && view.type === ViewTypes.CALENDAR) {
const calendar = await CalendarView.get(view.id); const calendar = await CalendarView.get(view.id);
coverImageId = calendar.fk_cover_image_col_id; coverImageId = calendar.fk_cover_image_col_id;
const calenderRanges = await CalendarRange.read(view.id);
if (calenderRanges) {
dependencyFieldsForCalenderView = calenderRanges.ranges
.flatMap((obj) =>
[obj.fk_from_column_id, obj.fk_to_column_id].filter(Boolean),
)
.map(String);
}
} }
if (!model.columns?.length) await model.getColumns(); if (!model.columns?.length) await model.getColumns();
@ -102,6 +111,11 @@ const getAst = async ({
if (coverImageId) { if (coverImageId) {
allowedCols[coverImageId] = 1; allowedCols[coverImageId] = 1;
} }
if (dependencyFieldsForCalenderView) {
dependencyFieldsForCalenderView.forEach((id) => {
allowedCols[id] = 1;
});
}
} }
const ast = await model.columns.reduce(async (obj, col: Column) => { const ast = await model.columns.reduce(async (obj, col: Column) => {

1
packages/nocodb/src/models/index.ts

@ -5,6 +5,7 @@ export { default as Source } from './Source';
export { default as Column } from './Column'; export { default as Column } from './Column';
export { default as CalendarView } from './CalendarView'; export { default as CalendarView } from './CalendarView';
export { default as CalendarViewColumn } from './CalendarViewColumn'; export { default as CalendarViewColumn } from './CalendarViewColumn';
export { default as CalendarRange } from './CalendarRange';
export { default as Filter } from './Filter'; export { default as Filter } from './Filter';
export { default as FormulaColumn } from './FormulaColumn'; export { default as FormulaColumn } from './FormulaColumn';
export { default as FormView } from './FormView'; export { default as FormView } from './FormView';

Loading…
Cancel
Save