|
|
@ -17,7 +17,7 @@ import Sort from '~/models/Sort'; |
|
|
|
import Filter from '~/models/Filter'; |
|
|
|
import Filter from '~/models/Filter'; |
|
|
|
import QrCodeColumn from '~/models/QrCodeColumn'; |
|
|
|
import QrCodeColumn from '~/models/QrCodeColumn'; |
|
|
|
import BarcodeColumn from '~/models/BarcodeColumn'; |
|
|
|
import BarcodeColumn from '~/models/BarcodeColumn'; |
|
|
|
import { LinksColumn } from '~/models'; |
|
|
|
import { GalleryView, KanbanView, LinksColumn } from '~/models'; |
|
|
|
import { extractProps } from '~/helpers/extractProps'; |
|
|
|
import { extractProps } from '~/helpers/extractProps'; |
|
|
|
import { NcError } from '~/helpers/catchError'; |
|
|
|
import { NcError } from '~/helpers/catchError'; |
|
|
|
import addFormulaErrorIfMissingColumn from '~/helpers/addFormulaErrorIfMissingColumn'; |
|
|
|
import addFormulaErrorIfMissingColumn from '~/helpers/addFormulaErrorIfMissingColumn'; |
|
|
@ -872,6 +872,8 @@ export default class Column<T = any> implements ColumnType { |
|
|
|
await Filter.delete(context, filter.id, ncMeta); |
|
|
|
await Filter.delete(context, filter.id, ncMeta); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Set Gallery & Kanban view `fk_cover_image_col_id` value to null
|
|
|
|
|
|
|
|
await Column.deleteCoverImageColumnId(context, id, ncMeta); |
|
|
|
|
|
|
|
|
|
|
|
// Delete from view columns
|
|
|
|
// Delete from view columns
|
|
|
|
let colOptionTableName = null; |
|
|
|
let colOptionTableName = null; |
|
|
@ -1205,6 +1207,11 @@ export default class Column<T = any> implements ColumnType { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oldCol.uidt === UITypes.Attachment && oldCol.uidt !== column.uidt) { |
|
|
|
|
|
|
|
// Set Gallery & Kanban view `fk_cover_image_col_id` value to null
|
|
|
|
|
|
|
|
await Column.deleteCoverImageColumnId(context, column.id, ncMeta); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// set meta
|
|
|
|
// set meta
|
|
|
|
await ncMeta.metaUpdate( |
|
|
|
await ncMeta.metaUpdate( |
|
|
|
context.workspace_id, |
|
|
|
context.workspace_id, |
|
|
@ -1725,4 +1732,64 @@ export default class Column<T = any> implements ColumnType { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static async deleteCoverImageColumnId( |
|
|
|
|
|
|
|
context: NcContext, |
|
|
|
|
|
|
|
id: string, |
|
|
|
|
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
const promises = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Gallery views
|
|
|
|
|
|
|
|
const galleryViews: GalleryView[] = await ncMeta.metaList2( |
|
|
|
|
|
|
|
context.workspace_id, |
|
|
|
|
|
|
|
context.base_id, |
|
|
|
|
|
|
|
MetaTable.GALLERY_VIEW, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
condition: { |
|
|
|
|
|
|
|
fk_cover_image_col_id: id, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const galleryView of galleryViews) { |
|
|
|
|
|
|
|
promises.push( |
|
|
|
|
|
|
|
GalleryView.update( |
|
|
|
|
|
|
|
context, |
|
|
|
|
|
|
|
galleryView.fk_view_id, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fk_cover_image_col_id: null, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
ncMeta, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Kanban views
|
|
|
|
|
|
|
|
const kanbanViews: KanbanView[] = await ncMeta.metaList2( |
|
|
|
|
|
|
|
context.workspace_id, |
|
|
|
|
|
|
|
context.base_id, |
|
|
|
|
|
|
|
MetaTable.KANBAN_VIEW, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
condition: { |
|
|
|
|
|
|
|
fk_cover_image_col_id: id, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const kanbanView of kanbanViews) { |
|
|
|
|
|
|
|
promises.push( |
|
|
|
|
|
|
|
KanbanView.update( |
|
|
|
|
|
|
|
context, |
|
|
|
|
|
|
|
kanbanView.fk_view_id, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
fk_cover_image_col_id: null, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
ncMeta, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Promise.all(promises); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|