Skip to content

Commit

Permalink
Merge pull request #371 from RabotaRu/omm-menu
Browse files Browse the repository at this point in the history
Omm menu
  • Loading branch information
rpiontik authored Sep 10, 2023
2 parents 98493de + 53bac92 commit 885504d
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 37 deletions.
11 changes: 10 additions & 1 deletion public/documentation/docs/manual/entities/entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,21 @@ entities:
...
```

Результатом работы этого запроса станет древовидное меню доступа к объектам сущности "interactions".
Результатом работы этого запроса будет древовидное меню доступа к объектам сущности "interactions".

![Меню взаимодействий](./images/menu-tree.jpeg)

Живой пример работы доступен вам из [меню](/entities/interactions/tree).

Поля структуры пункта меню:

* **icon** - (необязательно) иконка;
* **link** - (обязательно) URL ссылка относительная или прямая;
* **location** - (обязательно) путь размещения пункта меню в дереве меню;
* **order** - (необязательно) число, определяющее порядок вывода пункта меню (по умолчанию 10000).
Пункты меню дополнительно сортируются по алфавиту.


## Специальный тип презентаций - upload

Данный тип презентаций служит для подготовки контента из данных архитектуры для последующего экспорта в виде файла.
Expand Down
22 changes: 21 additions & 1 deletion public/metamodel/dochub/entities/aspects/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,25 @@ entities:
)
menu: >
(
[]
$aspects := aspects;
$makeLocation := function($id) {(
$arrleft := function($arr ,$count) {
$map($arr, function($v, $i) {
$i <= $count ? $v
})
};
$domains := $split($id, ".");
"Архитектура/Аспекты/" & $join($map($domains, function($domain, $index) {(
$lookup($aspects, $join($arrleft($domains, $index), ".")).title
)}), "/");
)};
[$append([{
"link": "/entities/aspects/tree", /* Ссылка на форму представления аспектов в виде дерева */
"location": "Архитектура/Аспекты" /* Расположение в меню */
}],
[$aspects.$spread().{
"link": "/entities/aspects/blank?dh-aspect-id=" & $keys()[0], /* Формируем ссылку на карточку */
"location": $makeLocation($keys()[0]) /* Формируем расположение в меню */
}][location]
)];
)
8 changes: 2 additions & 6 deletions public/metamodel/dochub/entities/aspects/hierarchy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ entities:
template: templates/hierarchy.puml
source: >
(
$CONTEXTS := contexts;
$ASPECTS := aspects;
/* Определяем фильтр для выделяемой иерархической структуры */
$FILTER := $params.aspect;
Expand All @@ -46,7 +45,7 @@ entities:
)});
$merge((
/* Выбираем их компонентов нужные для построения диаграммы */
[aspects.$spread().(
[$ASPECTS.$spread().(
$ID := $keys()[0];
$PREFIX := $substring($ID, 0, $FILTER_LN + 1);
$FILTER_LN = 0
Expand All @@ -66,13 +65,10 @@ entities:
).$spread().(
/* Готовим массив для вывода */
$ID := $keys()[0];
$CONTEXT := $lookup($CONTEXTS, $ID);
$ASPECT := $lookup($ASPECTS, $ID);
{
"id": $ID,
"title": $ASPECT.title ? $ASPECT.title : (
$CONTEXT.title ? $CONTEXT.title : $ID
),
"title": $ASPECT.title ? $ASPECT.title : $ID,
"link": $CONTEXT ? "/architect/aspects/" & $ID : "/architect/aspects/" & $ID
}
)^(id).(
Expand Down
1 change: 1 addition & 0 deletions public/metamodel/dochub/entities/aspects/root.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
imports:
- base.yaml
- tree.yaml
- blank.yaml
- contexts.yaml
- summary.yaml
Expand Down
5 changes: 5 additions & 0 deletions public/metamodel/dochub/entities/aspects/templates/tree.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@startwbs
* Аспекты
{{&.}}
@endwbs

37 changes: 37 additions & 0 deletions public/metamodel/dochub/entities/aspects/tree.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Сводка по архитектурному аспекту
entities:
aspects:
presentations:
tree:
title: Иерархия аспектов
type: plantuml
template: templates/tree.puml
source: >
(
$ASPECTS := aspects;
$merge((
[$ASPECTS.$spread().(
$keys()[0]~>$split(".")~>$map(function($v, $limit, $struct) {
{
$struct~>$map(function($pice, $index) {
$index <= $limit ? $pice
})~>$join("."): true
}
})
)]
)
).$spread().(
/* Готовим массив для вывода */
$ID := $keys()[0];
$ASPECT := $lookup($ASPECTS, $ID);
{
"id": $ID,
"title": $ASPECT.title ? $ASPECT.title : $ID,
"link": "/entities/aspects/blank?dh-aspect-id=" & $ID
}
)^(id).(
/* Готовим PlantUML код для MindMap */
$content := " [[" & link & " " & title & "]]";
"*" & $join($split(id, ".").("*")) & $content
)~>$join("\n");
)
7 changes: 6 additions & 1 deletion public/metamodel/dochub/entities/components/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,10 @@ entities:
)
menu: >
(
[]
[
{
"link": "/entities/components/tree",
"location": "Архитектура"
}
]
)
1 change: 1 addition & 0 deletions public/metamodel/dochub/entities/components/root.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
imports:
- base.yaml
- tree.yaml
- blank.yaml
- summary.yaml
- docs.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@startwbs
* Компоненты
{{&.}}
@endwbs

38 changes: 38 additions & 0 deletions public/metamodel/dochub/entities/components/tree.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Сводка по архитектурному аспекту
entities:
components:
presentations:
tree:
title: Иерархия компонентов
type: plantuml
template: templates/tree.puml
source: >
(
$COMPONENTS := components;
$merge((
/* Выбираем из компонентов нужные для построения диаграммы */
[$COMPONENTS.$spread().(
$keys()[0]~>$split(".")~>$map(function($v, $limit, $struct) {
{
$struct~>$map(function($pice, $index) {
$index <= $limit ? $pice
})~>$join("."): true
}
})
)]
)
).$spread().(
/* Готовим массив для вывода */
$ID := $keys()[0];
$COMPONENT := $lookup($COMPONENTS, $ID);
{
"id": $ID,
"title": $COMPONENT.title ? $COMPONENT.title : $ID,
"link": "/entities/components/blank?dh-component-id=" & $ID
}
)^(id).(
/* Готовим PlantUML код для MindMap */
$content := " [[" & link & " " & title & "]]";
"*" & $join($split(id, ".").("*")) & $content
)~>$join("\n");
)
3 changes: 2 additions & 1 deletion public/metamodel/dochub/entities/contexts/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ entities:
{
"title": "Контексты",
"location": 'Архитектура/Контексты',
"icon": 'location_searching'
"icon": 'location_searching',
"link": "entities/contexts/tree"
}
],
contexts.$spread().(
Expand Down
3 changes: 2 additions & 1 deletion public/metamodel/dochub/entities/contexts/root.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
imports:
- base.yaml
- plantuml.yaml
- smartants.yaml
- smartants.yaml
- tree.yaml
5 changes: 5 additions & 0 deletions public/metamodel/dochub/entities/contexts/templates/tree.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@startwbs
* Контексты
{{&.}}
@endwbs

39 changes: 39 additions & 0 deletions public/metamodel/dochub/entities/contexts/tree.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Сводка по архитектурному аспекту
entities:
contexts:
presentations:
tree:
title: Иерархия контекстов
type: plantuml
template: templates/tree.puml
source: >
(
$CONTEXTS := contexts;
/* Получаем нужную презентацию из конфигурации */
$presentation := entities.contexts.config.defaultPresentation;
$merge((
[$CONTEXTS.$spread().(
$keys()[0]~>$split(".")~>$map(function($v, $limit, $struct) {
{
$struct~>$map(function($pice, $index) {
$index <= $limit ? $pice
})~>$join("."): true
}
})
)]
)
).$spread().(
/* Готовим массив для вывода */
$ID := $keys()[0];
$CONTEXT := $lookup($CONTEXTS, $ID);
{
"id": $ID,
"title": $CONTEXT.title ? $CONTEXT.title : $ID,
"link": "/entities/contexts/" & $presentation & "?dh-context-id=" & $ID
}
)^(id).(
/* Готовим PlantUML код для MindMap */
$content := " [[" & link & " " & title & "]]";
"*" & $join($split(id, ".").("*")) & $content
)~>$join("\n");
)
40 changes: 14 additions & 26 deletions src/global/jsonata/queries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const queries = {
(
$isURL := $matcher := /^[a-zA-Z]*\\:.*$/i;
$isRoot := $matcher := /^\\/.*$/i;
$defOrder := 10000;
$append((
$GET_TITLE := function($LOCATION) {(
Expand All @@ -39,49 +40,34 @@ const queries = {
$MANIFEST := $;
$append([
{
"title": 'Архитектура',
"location": 'Архитектура',
"route": 'architect/',
"expand": true,
"icon": 'home'
},
{
"title": "Аспекты",
"location": 'Архитектура/Аспекты',
"icon": 'visibility',
"route": 'aspects/'
},
aspects.$spread().{
"title": $GET_TITLE($.*.location),
"route": 'architect/aspects/' & $keys()[0],
"location": 'Архитектура/Аспекты/' & $.*.location,
"icon": $.*.icon ? $.*.icon : ''
},
{
"title": 'Техрадар',
"location": 'Техрадар',
"route": 'techradar',
"icon": 'track_changes'
"icon": 'track_changes',
"order": $defOrder
},
technologies.sections.$spread().{
"title": $.*.title,
"route": 'techradar/' & $keys()[0],
"location": 'Техрадар/' & $.*.title
"location": 'Техрадар/' & $.*.title,
"order": $defOrder
},
{
"title": 'Проблемы',
"location": 'Проблемы',
"route": 'problems',
"icon": 'report_problem'
"icon": 'report_problem',
"order": $defOrder
}
][($exists(hiden) and $not(hiden)) or $not($exists(hiden))],
entities.*.(
$eval(menu, $MANIFEST).{
"route": link,
"location": location,
"icon": icon,
"title": $GET_TITLE(location)
"title": $GET_TITLE(location),
"order": order ? order : $defOrder
}
)
)
Expand All @@ -92,13 +78,15 @@ const queries = {
: ($isRoot(route) ? route : '/' & route)
) : undefined,
"icon": icon,
"location": "" & (location ? location : route)
}^(location), [
"location": "" & (location ? location : route),
"order": order
}^(order, location), [
{
"title": 'JSONata',
"route": '/devtool',
"icon": 'chrome_reader_mode',
"location": "devtool"
"location": "devtool",
"order": $defOrder
}
])
)
Expand Down

0 comments on commit 885504d

Please sign in to comment.