|
|
@ -326,10 +326,12 @@ export default class Filter implements FilterType { |
|
|
|
public async getChildren(ncMeta = Noco.ncMeta): Promise<Filter[]> { |
|
|
|
public async getChildren(ncMeta = Noco.ncMeta): Promise<Filter[]> { |
|
|
|
if (this.children) return this.children; |
|
|
|
if (this.children) return this.children; |
|
|
|
if (!this.is_group) return null; |
|
|
|
if (!this.is_group) return null; |
|
|
|
let childFilters = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
const cachedList = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
this.id, |
|
|
|
this.id, |
|
|
|
]); |
|
|
|
]); |
|
|
|
if (!childFilters.length) { |
|
|
|
let { list: childFilters } = cachedList; |
|
|
|
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
if (!isEmptyList && !childFilters.length) { |
|
|
|
childFilters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
childFilters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
condition: { |
|
|
|
condition: { |
|
|
|
fk_parent_id: this.id, |
|
|
|
fk_parent_id: this.id, |
|
|
@ -369,10 +371,12 @@ export default class Filter implements FilterType { |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
): Promise<FilterType> { |
|
|
|
): Promise<FilterType> { |
|
|
|
let filters = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
const cachedList = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
viewId || hookId, |
|
|
|
viewId || hookId, |
|
|
|
]); |
|
|
|
]); |
|
|
|
if (!filters.length) { |
|
|
|
let { list: filters } = cachedList; |
|
|
|
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
if (!isEmptyList && !filters.length) { |
|
|
|
filters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
filters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
condition: viewId ? { fk_view_id: viewId } : { fk_hook_id: hookId }, |
|
|
|
condition: viewId ? { fk_view_id: viewId } : { fk_hook_id: hookId }, |
|
|
|
orderBy: { |
|
|
|
orderBy: { |
|
|
@ -480,8 +484,10 @@ export default class Filter implements FilterType { |
|
|
|
{ viewId }: { viewId: any }, |
|
|
|
{ viewId }: { viewId: any }, |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
) { |
|
|
|
) { |
|
|
|
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [viewId]); |
|
|
|
const cachedList = await NocoCache.getList(CacheScope.FILTER_EXP, [viewId]); |
|
|
|
if (!filterObjs.length) { |
|
|
|
let { list: filterObjs } = cachedList; |
|
|
|
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
if (!isEmptyList && !filterObjs.length) { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
condition: { fk_view_id: viewId }, |
|
|
|
condition: { fk_view_id: viewId }, |
|
|
|
orderBy: { |
|
|
|
orderBy: { |
|
|
@ -499,8 +505,10 @@ export default class Filter implements FilterType { |
|
|
|
{ hookId }: { hookId: any }, |
|
|
|
{ hookId }: { hookId: any }, |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
) { |
|
|
|
) { |
|
|
|
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [hookId]); |
|
|
|
const cachedList = await NocoCache.getList(CacheScope.FILTER_EXP, [hookId]); |
|
|
|
if (!filterObjs.length) { |
|
|
|
let { list: filterObjs } = cachedList; |
|
|
|
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
if (!isEmptyList && !filterObjs.length) { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
condition: { fk_hook_id: hookId }, |
|
|
|
condition: { fk_hook_id: hookId }, |
|
|
|
orderBy: { |
|
|
|
orderBy: { |
|
|
@ -520,8 +528,12 @@ export default class Filter implements FilterType { |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
) { |
|
|
|
) { |
|
|
|
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [parentId]); |
|
|
|
const cachedList = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
if (!filterObjs.length) { |
|
|
|
parentId, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
let { list: filterObjs } = cachedList; |
|
|
|
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
if (!isEmptyList && !filterObjs.length) { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
condition: { |
|
|
|
condition: { |
|
|
|
fk_parent_id: parentId, |
|
|
|
fk_parent_id: parentId, |
|
|
@ -546,11 +558,13 @@ export default class Filter implements FilterType { |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
ncMeta = Noco.ncMeta |
|
|
|
) { |
|
|
|
) { |
|
|
|
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
const cachedList = await NocoCache.getList(CacheScope.FILTER_EXP, [ |
|
|
|
hookId, |
|
|
|
hookId, |
|
|
|
parentId, |
|
|
|
parentId, |
|
|
|
]); |
|
|
|
]); |
|
|
|
if (!filterObjs.length) { |
|
|
|
let { list: filterObjs } = cachedList; |
|
|
|
|
|
|
|
const { isEmptyList } = cachedList; |
|
|
|
|
|
|
|
if (!isEmptyList && !filterObjs.length) { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { |
|
|
|
condition: { |
|
|
|
condition: { |
|
|
|
fk_parent_id: parentId, |
|
|
|
fk_parent_id: parentId, |
|
|
|