Browse Source

feat(nocodb): add kanban related logic in View

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
071dbdd82b
  1. 39
      packages/nocodb/src/lib/models/View.ts

39
packages/nocodb/src/lib/models/View.ts

@ -16,6 +16,7 @@ import Filter from './Filter';
import { isSystemColumn, ViewType, ViewTypes } from 'nocodb-sdk'; import { isSystemColumn, ViewType, ViewTypes } from 'nocodb-sdk';
import GalleryViewColumn from './GalleryViewColumn'; import GalleryViewColumn from './GalleryViewColumn';
import FormViewColumn from './FormViewColumn'; import FormViewColumn from './FormViewColumn';
import KanbanViewColumn from './KanbanViewColumn';
import Column from './Column'; import Column from './Column';
import NocoCache from '../cache/NocoCache'; import NocoCache from '../cache/NocoCache';
import { extractProps } from '../meta/helpers/extractProps'; import { extractProps } from '../meta/helpers/extractProps';
@ -302,6 +303,16 @@ export default class View implements ViewType {
ncMeta ncMeta
); );
break; break;
case ViewTypes.KANBAN:
await KanbanView.insert(
{
...(copyFromView?.view || {}),
...view,
fk_view_id: view_id,
},
ncMeta
);
break;
} }
let columns: any[] = await ( let columns: any[] = await (
@ -343,7 +354,11 @@ export default class View implements ViewType {
if (view.type === ViewTypes.GALLERY) { if (view.type === ViewTypes.GALLERY) {
const galleryView = await GalleryView.get(view_id, ncMeta); const galleryView = await GalleryView.get(view_id, ncMeta);
if (vCol.id === galleryView.fk_cover_image_col_id || vCol.pv || galleryShowLimit < 3) { if (
vCol.id === galleryView.fk_cover_image_col_id ||
vCol.pv ||
galleryShowLimit < 3
) {
show = true; show = true;
galleryShowLimit++; galleryShowLimit++;
} else { } else {
@ -412,6 +427,15 @@ export default class View implements ViewType {
ncMeta ncMeta
); );
break; break;
case ViewTypes.KANBAN:
await KanbanViewColumn.insert(
{
...insertObj,
fk_view_id: view.id,
},
ncMeta
);
break;
} }
} }
} }
@ -598,13 +622,12 @@ export default class View implements ViewType {
show: colData.show, show: colData.show,
}); });
case ViewTypes.KANBAN: case ViewTypes.KANBAN:
// TODO: Use the following when KanbanViewColumn is ready to avoid cache issue return await KanbanViewColumn.insert({
// return await KanbanViewColumn.insert({ fk_view_id: viewId,
// fk_view_id: viewId, fk_column_id: fkColId,
// fk_column_id: fkColId, order: colData.order,
// order: colData.order, show: colData.show,
// show: colData.show, });
// });
break; break;
case ViewTypes.FORM: case ViewTypes.FORM:
return await FormViewColumn.insert({ return await FormViewColumn.insert({

Loading…
Cancel
Save