|
|
@ -273,6 +273,10 @@ export default class View implements ViewType { |
|
|
|
`${CacheScope.VIEW}:${view_id}` |
|
|
|
`${CacheScope.VIEW}:${view_id}` |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let columns: any[] = await ( |
|
|
|
|
|
|
|
await Model.getByIdOrName({ id: view.fk_model_id }, ncMeta) |
|
|
|
|
|
|
|
).getColumns(ncMeta); |
|
|
|
|
|
|
|
|
|
|
|
// insert view metadata based on view type
|
|
|
|
// insert view metadata based on view type
|
|
|
|
switch (view.type) { |
|
|
|
switch (view.type) { |
|
|
|
case ViewTypes.GRID: |
|
|
|
case ViewTypes.GRID: |
|
|
@ -306,6 +310,13 @@ export default class View implements ViewType { |
|
|
|
); |
|
|
|
); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case ViewTypes.KANBAN: |
|
|
|
case ViewTypes.KANBAN: |
|
|
|
|
|
|
|
// Preset a grouping field by choosing the first single select field
|
|
|
|
|
|
|
|
// TODO: let users to choose in kanban create modal
|
|
|
|
|
|
|
|
const singleSelectColumns = columns.filter( |
|
|
|
|
|
|
|
(c) => c.uidt === UITypes.SingleSelect |
|
|
|
|
|
|
|
)[0]; |
|
|
|
|
|
|
|
(view as KanbanView).grp_column_id = singleSelectColumns?.id; |
|
|
|
|
|
|
|
|
|
|
|
await KanbanView.insert( |
|
|
|
await KanbanView.insert( |
|
|
|
{ |
|
|
|
{ |
|
|
|
...(copyFromView?.view || {}), |
|
|
|
...(copyFromView?.view || {}), |
|
|
@ -317,10 +328,6 @@ export default class View implements ViewType { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let columns: any[] = await ( |
|
|
|
|
|
|
|
await Model.getByIdOrName({ id: view.fk_model_id }, ncMeta) |
|
|
|
|
|
|
|
).getColumns(ncMeta); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (copyFromView) { |
|
|
|
if (copyFromView) { |
|
|
|
const sorts = await copyFromView.getSorts(ncMeta); |
|
|
|
const sorts = await copyFromView.getSorts(ncMeta); |
|
|
|
const filters = await copyFromView.getFilters(ncMeta); |
|
|
|
const filters = await copyFromView.getFilters(ncMeta); |
|
|
|