Browse Source

fix(nocodb): model duplication fails to duplicate range and col properties

pull/7995/head
DarkPhoenix2704 8 months ago
parent
commit
0ef5e3c379
  1. 19
      packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts
  2. 9
      packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts

19
packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts

@ -6,13 +6,13 @@ import { Injectable } from '@nestjs/common';
import { elapsedTime, initTime } from '../../helpers'; import { elapsedTime, initTime } from '../../helpers';
import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2'; import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import type { View } from '~/models'; import type { View } from '~/models';
import { Base, Hook, Model, Source } from '~/models';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { getViewAndModelByAliasOrId } from '~/modules/datas/helpers'; import { getViewAndModelByAliasOrId } from '~/modules/datas/helpers';
import { clearPrefix, generateBaseIdMap } from '~/helpers/exportImportHelpers'; import { clearPrefix, generateBaseIdMap } from '~/helpers/exportImportHelpers';
import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2'; import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import { DatasService } from '~/services/datas.service'; import { DatasService } from '~/services/datas.service';
import { Base, Hook, Model, Source } from '~/models';
import { parseMetaProp } from '~/utils/modelUtils'; import { parseMetaProp } from '~/utils/modelUtils';
@Injectable() @Injectable()
@ -233,6 +233,23 @@ export class ExportService {
view.view.meta = meta; view.view.meta = meta;
} }
break; break;
case 'calendar_range':
if (view.type === ViewTypes.CALENDAR) {
const range = view.view[k];
view.view[k] = range.map(
(r: {
fk_to_column_id?: string;
fk_from_column_id: string;
}) => {
return {
fk_to_column_id: idMap.get(r.fk_to_column_id),
fk_from_column_id: idMap.get(r.fk_from_column_id),
};
},
);
}
break;
case 'created_at': case 'created_at':
case 'updated_at': case 'updated_at':
case 'fk_view_id': case 'fk_view_id':

9
packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts

@ -1061,12 +1061,21 @@ export class ImportService {
(a) => a.fk_column_id === reverseGet(idMap, cl.fk_column_id), (a) => a.fk_column_id === reverseGet(idMap, cl.fk_column_id),
); );
if (!fcl) continue; if (!fcl) continue;
const calendarColProperties =
vw.type === ViewTypes.CALENDAR
? {
bold: fcl.bold,
italic: fcl.italic,
underline: fcl.underline,
}
: {};
await this.viewColumnsService.columnUpdate({ await this.viewColumnsService.columnUpdate({
viewId: vw.id, viewId: vw.id,
columnId: cl.id, columnId: cl.id,
column: { column: {
show: fcl.show, show: fcl.show,
order: fcl.order, order: fcl.order,
...calendarColProperties,
}, },
req: param.req, req: param.req,
}); });

Loading…
Cancel
Save