Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/metamodel/dochub/entities/aspects/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ entities:
};
$domains := $split($id, ".");
$config.root_menu & "/" & $join($map($domains, function($domain, $index) {(
$lookup($aspects, $join($arrleft($domains, $index), ".")).title
$lookup($aspects, $join($arrleft($domains, $index), ".")).location
)}), "/");
)};
[$append([{
Expand All @@ -70,4 +70,4 @@ entities:
}
)][location]
)];
)
)
4 changes: 2 additions & 2 deletions src/frontend/components/JSONata/DevTool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@
this.doAutoExecute();
},
refreshOrigins() {
const pipe = query.expression(`[(datasets.$spread().{
const pipe = query.expression(`([datasets.$spread().{
"id": $keys()[0],
"title": *.title
})]`, null, null, true, { log: this.log});
}])`, null, null, true, { log: this.log});
pipe.evaluate().then((data) => this.origins = data);
},
doAutoExecute() {
Expand Down
23 changes: 22 additions & 1 deletion src/global/manifest/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ const sectionDeepLog = {
'$default$': 2
};

// Получает глубину секции из конфигурации или использует значение по умолчанию
function getSectionDeepLog(section, manifest) {
// Сначала проверяем статические значения из sectionDeepLog
if (sectionDeepLog[section] !== undefined) {
return sectionDeepLog[section];
}

// Проверяем, есть ли конфигурация merge_depth в метамодели сущности
// Это позволяет задавать глубину для пользовательских сущностей через config.merge_depth
if (manifest?.entities?.[section]?.config?.merge_depth !== undefined) {
return manifest.entities[section].config.merge_depth;
}

// Возвращаем значение по умолчанию
return sectionDeepLog['$default$'];
}

const parser = {
// Манифест перезагружен
onReloaded: null,
Expand Down Expand Up @@ -131,7 +148,11 @@ const parser = {
// Сохраняет в карте склеивания данные
pushToMergeMap(path, source, location) {
const structPath = (path || '/').split('/');
const storePath = structPath.slice(0, sectionDeepLog[structPath[1] || '$default$'] + 1).join('/');
const section = structPath[1] || '$default$';
// Используем функцию getSectionDeepLog для получения глубины секции
// Это позволяет учитывать как статические настройки, так и динамические из config.merge_depth
const depth = getSectionDeepLog(section, this.manifest);
const storePath = structPath.slice(0, depth + 1).join('/');

let locations = this.mergeMap[storePath];

Expand Down