Skip to content

Commit

Permalink
Only the project implementation strategy selected in tailoring are sh…
Browse files Browse the repository at this point in the history
…own in documentation. (#480)

Adapt activities link to product pages also for tool references.
Removed topics from product index page.
  • Loading branch information
Bock4Soft authored Apr 29, 2024
1 parent d654958 commit c99512e
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 72 deletions.
1 change: 1 addition & 0 deletions client/public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"SimpleDate": "{{date, date}}"
},
"label": {
"activities": "Aktivitäten",
"bibliography": "Literaturverzeichnis",
"group": "Gruppe",
"product": "Produkt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ export function Content() {
[NavTypeEnum.PRODUCT].includes(item.dataType)
);

let data: any[] = filterRelevantDataTypes.map((navItem: any): any => {
const data: any[] = filterRelevantDataTypes.map((navItem: any): any => {
return {
modelElement: {
id: navItem.key,
Expand All @@ -1207,51 +1207,6 @@ export function Content() {

/////////////////

const filterDisciplineDataTypes = flatten(navigationData).filter((item: any) =>
[NavTypeEnum.DISCIPLINE].includes(item.dataType)
);

for (const discipline of filterDisciplineDataTypes) {
const productsUrl =
weitApiUrl +
'/Tailoring/V-Modellmetamodell/mm_2021/V-Modellvariante/' +
tailoringParameter.modelVariantId +
'/Projekttyp/' +
tailoringParameter.projectTypeId +
'/Projekttypvariante/' +
tailoringParameter.projectTypeVariantId +
'/Disziplin/' +
discipline.key +
'/Produkt?' +
getProjectFeaturesString();

const jsonDataFromXml = await getJsonDataFromXml(productsUrl);

let productTopicEntries: any[] = [];

if (jsonDataFromXml.children) {
for (const product of jsonDataFromXml.children) {
const themaRef: XMLElement[] = product.getElementsByTagName('ThemaRef');
productTopicEntries = [
...productTopicEntries,
...themaRef.map((subjectRef) => {
return {
modelElement: {
id: product.attributes.id + '#' + subjectRef.attributes.id,
text: subjectRef.attributes.name,
},
dataTypes: [NavTypeEnum.TOPIC],
};
}),
];
}
}

data = [...data, ...productTopicEntries];
}

/////////////////

const columns: ColumnsType<any> = [
{
title: 'Modellelement',
Expand Down Expand Up @@ -1282,9 +1237,6 @@ export function Content() {
if (tag === 'product') {
color = 'geekblue';
}
if (tag === 'topic') {
color = 'green';
}
return (
<Tag color={color} key={tag}>
{t('translation:dataType.' + tag)}
Expand Down Expand Up @@ -2023,7 +1975,8 @@ export function Content() {
//////////////////////////////////////////////

const activitiesData = await getActivitiesData();
const activitiesToTools = [];
const activitiesToTools: DataEntry[] = [];
const activitiesToProducts: DataEntry[] = [];

for (const activity of activitiesData) {
const methodReferences = activity.getElementsByTagName('MethodenreferenzRef');
Expand All @@ -2047,11 +2000,15 @@ export function Content() {
const products = activity.getElementsByTagName('ProduktRef');

for (const product of products) {
activitiesToTools.push({
id: product.attributes.id,
title: activity.attributes.name,
suffix: '(' + product.attributes.name + ')',
});
const foundProduct = getMenuItemByAttributeValue(navigationData, 'key', product.attributes.id);

if (foundProduct) {
activitiesToProducts.push({
id: product.attributes.id,
title: activity.attributes.name,
suffix: '(' + product.attributes.name + ')',
});
}
}
}
}
Expand All @@ -2061,13 +2018,19 @@ export function Content() {
if (activitiesToTools.length > 0) {
tableEntries.push({
id: (idCounter++).toString(),
descriptionEntry: 'Aktivitäten',
descriptionEntry: t('translation:label.activities'),
dataEntries: activitiesToTools,
});
} else if (activitiesToProducts.length > 0) {
tableEntries.push({
id: (idCounter++).toString(),
descriptionEntry: t('translation:label.products'),
dataEntries: activitiesToProducts,
});
}

// //////////////////////////////////////////////
//

const quellen = quelleRefs.flatMap((entry: XMLElement) => {
return entry.getElementsByTagName('QuelleRef').map((productRef) => {
return {
Expand Down Expand Up @@ -2115,26 +2078,58 @@ export function Content() {
//////////////////////////////////////////////

const activitiesData = await getActivitiesData();
const activitiesToTools = [];
const activitiesToTools: DataEntry[] = [];
const activitiesToProducts: DataEntry[] = [];

for (const activity of activitiesData) {
const toolReferences = activity.getElementsByTagName('WerkzeugreferenzRef');
for (const toolReference of toolReferences) {
if (toolReference.attributes.id === toolReferenceId) {
activitiesToTools.push({
id: activity.attributes.id,
title: activity.attributes.name,
});
/* The method and tool references (reference work aids) contain links to the corresponding activities.
As the activities are no longer part of the documentation (since version 2.4), the links cannot be resolved.
Instead of the activity, a link should therefore be created to the product linked to the activity.
-> So, if the activity id is not in navigation menu change linked site to products page of the activity.
*/

const foundActivity = getMenuItemByAttributeValue(navigationData, 'key', activity.attributes.id);

if (foundActivity) {
activitiesToTools.push({
id: activity.attributes.id,
title: activity.attributes.name,
});
} else {
const products = activity.getElementsByTagName('ProduktRef');

for (const product of products) {
const foundProduct = getMenuItemByAttributeValue(navigationData, 'key', product.attributes.id);

if (foundProduct) {
activitiesToProducts.push({
id: product.attributes.id,
title: activity.attributes.name,
suffix: '(' + product.attributes.name + ')',
});
}
}
}
}
}
}

if (activitiesToTools.length > 0) {
tableEntries.push({
id: (idCounter++).toString(),
descriptionEntry: 'Aktivitäten',
descriptionEntry: t('translation:label.activities'),
dataEntries: activitiesToTools,
});
} else if (activitiesToProducts.length > 0) {
tableEntries.push({
id: (idCounter++).toString(),
descriptionEntry: t('translation:label.products'),
dataEntries: activitiesToProducts,
});
}

//////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ icons.set('Ausgewählte Vorgehensbausteine', { color: '#689fd0', icon: <ToolOutl
icons.set('Ausgewählte Ablaufbausteine', { color: '#689fd0', icon: <ToolOutlined /> });
// Referenz Arbeitshilfen
icons.set('Produkt', { color: '#689fd0', icon: <ShoppingOutlined /> });
icons.set('Produkte', { color: '#689fd0', icon: <ShoppingOutlined /> });
icons.set('Werkzeuge', { color: '#689fd0', icon: <ToolOutlined /> });
icons.set('Arbeitsschritte', { color: '#689fd0', icon: <ToolOutlined /> });
icons.set('Methoden', { color: '#689fd0', icon: <ToolOutlined /> });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,16 +955,21 @@ export function Navigation() {

const navigation: NavMenuItem[] = [];

jsonDataFromXmlProjectTypeVariants.getElementsByTagName('Projekttypvariante').map((projectTypeVariantValue) => {
navigation.push({
key: 'pes_' + projectTypeVariantValue.attributes.id,
parent: target,
label: projectTypeVariantValue.attributes.name,
dataType: NavTypeEnum.PROJECT_TYPE_VARIANT_SEQUENCE, // TODO: oder auch ProjectExecutionStrategy
onClick: (item: any) => handleSelectedItem(item.key), // TODO: different Types
onTitleClick: (item: any) => handleSelectedItem(item.key), // TODO: different Types
jsonDataFromXmlProjectTypeVariants
.getElementsByTagName('Projekttypvariante')
.filter(
(projectTypeVariantValue) => projectTypeVariantValue.attributes.id === tailoringParameter.projectTypeVariantId
)
.map((projectTypeVariantValue) => {
navigation.push({
key: 'pes_' + projectTypeVariantValue.attributes.id,
parent: target,
label: projectTypeVariantValue.attributes.name,
dataType: NavTypeEnum.PROJECT_TYPE_VARIANT_SEQUENCE, // TODO: oder auch ProjectExecutionStrategy
onClick: (item: any) => handleSelectedItem(item.key), // TODO: different Types
onTitleClick: (item: any) => handleSelectedItem(item.key), // TODO: different Types
});
});
});

return navigation;
}
Expand Down

0 comments on commit c99512e

Please sign in to comment.