Skip to content

Commit

Permalink
Merge pull request #500 from RabotaRu/v3.9.0
Browse files Browse the repository at this point in the history
v3.9.0
  • Loading branch information
rpiontik authored Feb 16, 2024
2 parents 7bf8122 + 03a85fb commit f28cc9a
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 77 deletions.
8 changes: 7 additions & 1 deletion public/documentation/docs/manual/docs/examples/sa-anim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ animation:
hello: # Идентификатор действия
- action: info # Информировать пользователя. Доступны: clean / info / focus-node / focus-neighbors
text: Давай я объясню как здесь все устроено # Текст, который будет выводиться пользователю
focus-link:
- action: focus-link
from: outside.user
to: outside.application
- action: info
text: Для этого он использует наше приложение для Android
focus-user:
- action: focus-node # Установить фокус на объекте диаграммы
target: outside.user # RegEx выражение определяющее с какими идентификаторами будут выделены элементы диаграммы
Expand Down Expand Up @@ -141,7 +147,7 @@ animation:
delay: 2000
voice: true
- action: clean
- action: focus-frontend
- action: focus-link
delay: 2000
voice: true
- action: clean
Expand Down
2 changes: 1 addition & 1 deletion public/metamodel/dochub/entities/components/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ entities:
schema:
type: object
patternProperties:
"^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z][a-zA-Z0-9_-]*)*$":
"^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9][a-zA-Z0-9_-]*)*$":
type: object
properties:
title:
Expand Down
2 changes: 1 addition & 1 deletion public/metamodel/dochub/entities/contexts/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ entities:
items:
type: string
title: Идентификатор компонента или маска
pattern: "^[0-9a-zA-Z][a-zA-Z0-9\\_]*(\\.([a-zA-Z][a-zA-Z0-9\\_]*|\\*))*$"
pattern: "^[0-9a-zA-Z][a-zA-Z0-9\\_]*(\\.([a-zA-Z0-9][a-zA-Z0-9\\_]*|\\*))*$"
extra-links:
title: Отображать компоненты ближайших связей
type: boolean
Expand Down
6 changes: 3 additions & 3 deletions public/metamodel/dochub/entities/contexts/plantuml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ entities:
properties:
"dh-context-id":
title: Идентификатор контекста
type: string
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[a-zA-Z][a-zA-Z0-9_-]*)*$
type: string
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[0-9a-zA-Z][a-zA-Z0-9_-]*)*$
"dh-focus-id":
title: Идентификатор требующий подсветку
type: string
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[a-zA-Z][a-zA-Z0-9_-]*)*$
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9][a-zA-Z0-9_-]*)*$
required:
- dh-context-id
type: plantuml
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/components/Docs/DocSmartAnts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
<v-bottom-sheet v-model="sheet">
<v-card
class="text-center"
height="200">
height="200"
v-bind:style="!isPlugin ? 'padding: 20px 0px 0px 300px' : ''">
<v-card-text>
<ul>
<li v-for="warn in warnings" v-bind:key="warn">
Expand Down Expand Up @@ -126,6 +127,7 @@
import download from '@front/helpers/download';
import DocMixin from './DocMixin';
import env from '@front/helpers/env';
export default {
name: 'DocHubViewpoint',
Expand All @@ -138,6 +140,7 @@
},
data() {
return {
isPlugin: env.isPlugin(),
warnings: [],
sheet: false,
menu: { // Контекстное меню
Expand Down
20 changes: 16 additions & 4 deletions src/frontend/components/Docs/DocTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
hide-details />
</v-card-title>
<v-data-table
v-bind:mobile-breakpoint="0"
v-bind:headers="headers"
v-bind:items="source.dataset || []"
v-bind:search="search"
Expand Down Expand Up @@ -91,10 +92,15 @@
/ 48), 5);
},
footerProps() {
let itemsPerPageOptions = [5, 10, 15];
let newOption = this.itemsPerPage;
if (itemsPerPageOptions.indexOf(newOption) === -1) itemsPerPageOptions.push(newOption);
itemsPerPageOptions.sort((a, b) => a - b).push(-1);
let lengthOtions = Array.from(
new Set(
[5, 10, 15, Math.min(this.source.dataset?.length, 20)]
)
);
const itemsPerPageOptions = lengthOtions
.sort((a, b) => a - b)
.filter(v => v <= this.source.dataset?.length);
return {'items-per-page-options': itemsPerPageOptions};
}
},
Expand Down Expand Up @@ -167,3 +173,9 @@ td {
white-space: pre-wrap
}
</style>
<style>
.v-data-table-header tr th {
white-space: nowrap;
}
</style>
49 changes: 19 additions & 30 deletions src/frontend/components/Layouts/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<v-btn v-if="isCriticalError" icon title="Есть критические ошибки!" v-on:click="gotoProblems">
<v-icon class="material-icons blink" style="display: inline">error</v-icon>
</v-btn>
<v-btn v-if="isSearchInCode" icon title="Найти в коде" v-on:click="gotoCode">
<v-icon class="material-icons" style="display: inline">search</v-icon>
<v-btn v-if="gotoIconShow" icon title="Найти в коде" v-on:click="gotoCode">
<v-icon class="material-icons" style="display: inline">code</v-icon>
</v-btn>
<v-menu offset-y>
<template #activator="{ on, attrs }">
Expand Down Expand Up @@ -58,11 +58,13 @@
},
data() {
return {
isSearchInCode: env.isPlugin(Plugins.idea),
isBackShow: env.isPlugin(Plugins.vscode)
};
},
computed: {
gotoIconShow() {
return env.isPlugin() && this.$route.name === 'entities';
},
isCriticalError() {
return !!(this.$store.state.problems || []).find((item) => item.critical);
},
Expand Down Expand Up @@ -100,34 +102,21 @@
this.$router.push({name: 'main'}).catch(() => null);
},
gotoCode() {
// eslint-disable-next-line no-console
// console.info('For GOTO ', window.location.hash);
const location = window.location;
const struct = window.location.hash.split('/');
switch (struct[1]) {
case 'entities': {
const entity = struct[2];
const url = new URL(window.location.hash.slice(1), window.location);
const id = url.searchParams.get('id');
window.$PAPI.goto(null, entity, id);
} break;
case 'architect': {
switch (struct[2]) {
case 'contexts':
window.$PAPI.goto(null, 'context', struct[3]);
break;
case 'aspects':
window.$PAPI.goto(null, 'aspect', struct[3]);
break;
case 'components':
window.$PAPI.goto(null, 'component', struct[3]);
break;
}
break;
}
case 'docs':
window.$PAPI.goto(null, 'document', struct[2]);
break;
}
const entity = struct?.[2];
const url = new URL(location.hash.slice(1), location);
// Пытаюсь извлечь идентификатор из параметра содержащем "id" или "domain" (для berezka)
// или в качестве идентификатора берется хвост от urlа
// TODO: надо переделать
const idRegex = /\b(\w*id|domain\w*)=([^&\s]+)\b/;
const id = idRegex.exec(url.search)?.[2] || struct[struct.length -1];
if(!entity || !id) return false;
// Запрос в ide на открытие entity c id
window.$PAPI.goto(null, entity, id);
}
}
};
Expand Down
13 changes: 7 additions & 6 deletions src/frontend/components/Layouts/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,18 @@
margin: 2px !important;
}
.menu-item-ico {
position: absolute;
right: 4px;
}
.menu-item-header {
line-height: 14px;
height: 32px !important;
height: auto !important;
min-height: 32px;
cursor: pointer;
}
.menu-item-ico {
position: absolute;
right: 4px;
}
.menu-item-selected {
background: rgb(52, 149, 219);
}
Expand Down
6 changes: 6 additions & 0 deletions src/frontend/components/Schema/DHSchema/DHSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
mode="area"
v-bind:layer="presentation.layers"
v-bind:hide-boundary-titles="data.config?.hideBoundaryTitles"
v-bind:hide-leaf-titles="data.config?.hideLeafTitles"
v-on:node-dblclick="onNodeClick" />

<template v-for="track in presentation.tracks">
Expand All @@ -60,6 +61,7 @@
v-bind:offset-y="0"
mode="node"
v-bind:layer="presentation.layers"
v-bind:hide-boundary-titles="data.config?.hideBoundaryTitles"
v-bind:hide-leaf-titles="data.config?.hideLeafTitles"
v-on:node-click="onNodeClick" />

Expand Down Expand Up @@ -422,6 +424,10 @@
return selected;
},
// Выделяет ноду
selectNode(box) {
this.selected.nodes[box.node.id] = box;
},
// Выделяет ноду и ее соседей со связями
selectNodeAndNeighbors(box) {
const selectedNodes = this.getSelectNode(box);
Expand Down
16 changes: 13 additions & 3 deletions src/frontend/components/Schema/DHSchema/DHSchemaAnimationMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ export default {
this.cleanSelectedTracks();
this.animation.information = null;
},
// Фокусирует объекты диаграммы
// Фокусирует линк диаграммы
animationActionFocusLink(from, to) {
const regexFrom = new RegExp(from);
const regexTo = new RegExp(to);
for (const track of this.presentation.tracks) {
if(regexFrom.test(track.link.from), regexTo.test(track.link.to))
this.onTrackClick(track);
}
},
// Фокусирует объект диаграммы
animationActionFocusNode(target) {
const regex = new RegExp(target);
for (const nodeID in this.presentation.map) {
Expand Down Expand Up @@ -46,6 +55,7 @@ export default {
switch((command.action || '$unknown$').toLowerCase()) {
case 'clean': this.animationActionClean(); break;
case 'focus-node': this.animationActionFocusNode(command.target); break;
case 'focus-link': this.animationActionFocusLink(command.from, command.to); break;
case 'focus-neighbors': this.animationActionFocusNeighbors(command.target); break;
case 'info': this.animationActionInfo(command.text, command.subject); break;
default: throw `Не известная команда "${command.action}"`;
Expand All @@ -71,7 +81,7 @@ export default {
return;
}
// Выполняем
if (this.animation.currentStep < scenario.length)
if (this.animation.currentStep < scenario.length)
this.animationExecStep(scenario, this.animation.currentStep);
else
this.animationStop();
Expand Down Expand Up @@ -162,5 +172,5 @@ export default {
destroyed() {
this.animationStop();
}

};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<g>
<g
<g
v-for="box in layer.boxes"
v-bind:key="box.node.id">
<g v-if="isArea(box)">
Expand Down
10 changes: 5 additions & 5 deletions src/frontend/components/Schema/DHSchema/DHSchemaNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
v-for="(box, idx) in layer.boxes"
v-bind:key="box.node + idx">
<g
v-if="isArea(box)"
v-if="isArea(box)"
v-on:dblclick.stop.prevent="onNodeDblClick(box, true)">
<template v-if="isShowArea">
<rect
Expand Down Expand Up @@ -40,15 +40,15 @@
v-bind:transform="`translate(${box.absoluteX},${box.absoluteY + box.height})`"
class="node-text"
v-bind:style="{ opacity: box.opacity }">
<tspan
<tspan
v-for="(line, index) in textLines(box)"
v-bind:key="index"
v-bind:x="box.width * 0.5"
v-bind:y="index * 12 + 16"
text-anchor="middle">
{{ line }}
</tspan>
</text>
</text>
</g>
<schema-node
v-bind:offset-x="box.x"
Expand Down Expand Up @@ -112,7 +112,7 @@
},
methods: {
textLines(box) {
const title = box.node.title || box.node.id;
const title = box.node.title || box.node.id || '';
const result = [];
let offset = 0;
let length = 0;
Expand Down Expand Up @@ -147,7 +147,7 @@
return result.join(' ');
},
isArea(item) {
return item.node.subitems && Object.keys(item.node.subitems).length;
return item.node?.subitems && Object.keys(item.node?.subitems).length;
}
}
};
Expand Down
14 changes: 7 additions & 7 deletions src/frontend/helpers/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ axios.interceptors.response.use(async(response) => {
)
response.data = JSON.parse(response.data);
else if (
(url.indexOf('.yaml/raw') >= 0)
|| (url.slice(-5) === '.yaml')
(url.indexOf('.yaml/raw') >= 0)
|| (url.slice(-5) === '.yaml')
|| (response?.headers || {})['content-type'] === 'application/x-yaml')
response.data = YAML.parse(response.data);
}
Expand Down Expand Up @@ -131,7 +131,7 @@ export default {
if (finalURl && finalURl.startsWith('backend://')) {
return (new URL(finalURl.slice(10), env.backendFileStorageURL()));
} else {
return url;
return url;
}
},

Expand All @@ -158,11 +158,11 @@ export default {
params.url = uri;
// Если ссылка ведет на backend конвертируем ее
let strURI = (uri || '').toString();
// Если URI является ссылкой на ресурс в Data Lake интерпретируем ее

// Если URI является ссылкой на ресурс в Data Lake интерпретируем ее
strURI.startsWith('res://') && (strURI = this.expandResourceURI(strURI));
baseURI && baseURI.toString().startsWith('res://') && (baseURI = this.expandResourceURI(baseURI));

if (strURI.startsWith('source:')) {
return new Promise((success) => {
success({
Expand All @@ -184,7 +184,7 @@ export default {

if (
env.isPlugin(Plugins.idea) && params.url.toString().startsWith('plugin:') ||
env.isPlugin(Plugins.vscode)
env.isPlugin(Plugins.vscode) && params.url.toString().startsWith('https://file+.vscode-resource.vscode-cdn.net') && !params.responseHook
) {
injectPAPIMiddleware();
this.trace(params.url);
Expand Down
2 changes: 1 addition & 1 deletion src/global/bitbucket/driver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function(config) {
this.makeFileURI = (projectID, repositoryId, source, branch) => {
const result = new URL(
`rest/api/1.0/projects/${projectID}/repos/${repositoryId}/raw/`
+ encodeURIComponent(source)
+ encodeURIComponent(source).split('%2F').join('/')
+ `?at=${branch}`
, config.bitbucket_server);
return result;
Expand Down
Loading

0 comments on commit f28cc9a

Please sign in to comment.