From 8974783cdcc5523c6007e89d3e50482f76f38fc0 Mon Sep 17 00:00:00 2001 From: Sebastian Eicke Date: Sat, 7 Dec 2024 07:54:02 +0100 Subject: [PATCH] Add comments --- .../src/mixins/SubmodelElementHandling.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/aas-web-ui/src/mixins/SubmodelElementHandling.ts b/aas-web-ui/src/mixins/SubmodelElementHandling.ts index a2037a1..82dbbc7 100644 --- a/aas-web-ui/src/mixins/SubmodelElementHandling.ts +++ b/aas-web-ui/src/mixins/SubmodelElementHandling.ts @@ -645,26 +645,29 @@ export default defineComponent({ semanticIdsToFetch.forEach((semanticId: string) => { if (semanticId.startsWith('0173-1#')) { - semanticIdsToFetch.push(semanticId.replace(/-1#(\d{2})-/, '/1///$1#')); - semanticIdsToFetch.push('https://api.eclass-cdp.com/' + semanticId.replaceAll('#', '-')); - } else if (semanticId.startsWith('0173/1')) { - semanticIdsToFetch.push(semanticId.replace(/\/1\/\/\/(\d{2})#/, '-1#$1-')); + // e.g. 0173-1#01-AHF578#001 + semanticIdsToFetch.push(semanticId.replace(/-1#(\d{2})-/, '/1///$1#')); // 0173-1#01-AHF578#001 --> 0173/1///01#AHF578#001 + semanticIdsToFetch.push('https://api.eclass-cdp.com/' + semanticId.replaceAll('#', '-')); // 0173-1#01-AHF578#001 --> https://api.eclass-cdp.com/0173-1-01-AHF578-001 + } else if (semanticId.startsWith('0173/1///')) { + // e.g. 0173/1///01#AHF578#001 + semanticIdsToFetch.push(semanticId.replace(/\/1\/\/\/(\d{2})#/, '-1#$1-')); // 0173/1///01#AHF578#001 --> 0173-1#01-AHF578#001 semanticIdsToFetch.push( 'https://api.eclass-cdp.com/' + - semanticId.replace(/\/1\/\/\/(\d{2})#/, '-1-$1-').replaceAll('#', '-') + semanticId.replace(/\/1\/\/\/(\d{2})#/, '-1-$1-').replaceAll('#', '-') // 0173/1///01#AHF578#001 --> https://api.eclass-cdp.com/0173-1-01-AHF578-001 ); } else if (semanticId.startsWith('https://api.eclass-cdp.com/0173-1')) { + // e.g. https://api.eclass-cdp.com/0173-1-01-AHF578-001 semanticIdsToFetch.push( semanticId .replaceAll('https://api.eclass-cdp.com/', '') - .replaceAll('-', '#') - .replace(/#1#(\d{2})#/, '-1#$1-') + .replace(/-1-(\d{2})-/, '-1#$1-') + .replace(/-(\d{3})$/, '#$1') // https://api.eclass-cdp.com/0173-1-01-AHF578-001 --> 0173-1#01-AHF578#001 ); semanticIdsToFetch.push( semanticId .replaceAll('https://api.eclass-cdp.com/', '') - .replaceAll('-', '#') - .replace(/#1#(\d{2})#/, '/1///$1#') + .replace(/-1-(\d{2})-/, '/1///$1#') + .replace(/-(\d{3})$/, '#$1') // https://api.eclass-cdp.com/0173-1-01-AHF578-001 --> 0173/1///01#AHF578#001 ); } });