|
|
|
@ -205,8 +205,10 @@ export default class View implements ViewType {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static async list(modelId: string, ncMeta = Noco.ncMeta) { |
|
|
|
|
let viewsList = await NocoCache.getList(CacheScope.VIEW, [modelId]); |
|
|
|
|
if (!viewsList.length) { |
|
|
|
|
const cachedList = await NocoCache.getList(CacheScope.VIEW, [modelId]); |
|
|
|
|
let { list: viewsList } = cachedList; |
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
if (!isEmptyList && !viewsList.length) { |
|
|
|
|
viewsList = await ncMeta.metaList2(null, null, MetaTable.VIEWS, { |
|
|
|
|
condition: { |
|
|
|
|
fk_model_id: modelId, |
|
|
|
@ -1123,8 +1125,10 @@ export default class View implements ViewType {
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// get existing cache
|
|
|
|
|
const dataList = await NocoCache.getList(scope, [viewId]); |
|
|
|
|
if (dataList?.length) { |
|
|
|
|
const cachedList = await NocoCache.getList(scope, [viewId]); |
|
|
|
|
let { list: dataList } = cachedList; |
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
if (!isEmptyList && dataList?.length) { |
|
|
|
|
for (const o of dataList) { |
|
|
|
|
if (!ignoreColdIds?.length || !ignoreColdIds.includes(o.fk_column_id)) { |
|
|
|
|
// set data
|
|
|
|
@ -1209,7 +1213,9 @@ export default class View implements ViewType {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// get existing cache
|
|
|
|
|
const dataList = await NocoCache.getList(scope, [viewId]); |
|
|
|
|
const cachedList = await NocoCache.getList(scope, [viewId]); |
|
|
|
|
let { list: dataList } = cachedList; |
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
|
|
const colsEssentialForView = |
|
|
|
|
view.type === ViewTypes.MAP |
|
|
|
@ -1218,7 +1224,7 @@ export default class View implements ViewType {
|
|
|
|
|
|
|
|
|
|
const mergedIgnoreColdIds = [...ignoreColdIds, ...colsEssentialForView]; |
|
|
|
|
|
|
|
|
|
if (dataList?.length) { |
|
|
|
|
if (!isEmptyList && dataList?.length) { |
|
|
|
|
for (const o of dataList) { |
|
|
|
|
if ( |
|
|
|
|
!mergedIgnoreColdIds?.length || |
|
|
|
@ -1257,8 +1263,10 @@ export default class View implements ViewType {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static async shareViewList(tableId, ncMeta = Noco.ncMeta) { |
|
|
|
|
let sharedViews = await NocoCache.getList(CacheScope.VIEW, [tableId]); |
|
|
|
|
if (!sharedViews.length) { |
|
|
|
|
let cachedList = await NocoCache.getList(CacheScope.VIEW, [tableId]); |
|
|
|
|
let { list: sharedViews } = cachedList; |
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
if (!isEmptyList && !sharedViews.length) { |
|
|
|
|
sharedViews = await ncMeta.metaList2(null, null, MetaTable.VIEWS, { |
|
|
|
|
xcCondition: { |
|
|
|
|
fk_model_id: { |
|
|
|
|