diff --git a/aas-web-ui/src/components/SubmodelPlugins/ContactInformation.vue b/aas-web-ui/src/components/SubmodelPlugins/ContactInformation.vue index 96c2bde..08461bb 100644 --- a/aas-web-ui/src/components/SubmodelPlugins/ContactInformation.vue +++ b/aas-web-ui/src/components/SubmodelPlugins/ContactInformation.vue @@ -145,29 +145,33 @@ // create Contact Person Property let nameParts = []; // find property with the idShort "Title" - let title = contact.value.find((element: any) => element.idShort === 'Title'); + let title = contact.value.find((element: any) => this.checkIdShort(element, 'Title')); if (title && title.value && title.value.length > 0) { nameParts.push(title.value[0].text); } // find property with the idShort "FirstName" - let firstName = contact.value.find((element: any) => element.idShort === 'FirstName'); + let firstName = contact.value.find((element: any) => this.checkIdShort(element, 'FirstName')); if (firstName && firstName.value && firstName.value.length > 0) { nameParts.push(firstName.value[0].text); } // find property with the idShort "MiddleNames" - let middleNames = contact.value.find((element: any) => element.idShort === 'MiddleNames'); + let middleNames = contact.value.find((element: any) => this.checkIdShort(element, 'MiddleNames')); if (middleNames && middleNames.value && middleNames.value.length > 0) { nameParts.push(middleNames.value[0].text); } // find property with the idShort "NameOfContact" - let nameOfContact = contact.value.find((element: any) => element.idShort === 'NameOfContact'); + let nameOfContact = contact.value.find((element: any) => + this.checkIdShort(element, 'NameOfContact') + ); if (nameOfContact && nameOfContact.value && nameOfContact.value.length > 0) { nameParts.push(nameOfContact.value[0].text); } // join all name parts with a space let name = nameParts.filter(Boolean).join(' '); // find property with the idShort "AcademicTitle" - let academicTitle = contact.value.find((element: any) => element.idShort === 'AcademicTitle'); + let academicTitle = contact.value.find((element: any) => + this.checkIdShort(element, 'AcademicTitle') + ); if (academicTitle && academicTitle.value && academicTitle.value.length > 0) { // add a comma before the academic title if the name is not empty name += (name ? ', ' : '') + academicTitle.value[0].text; @@ -181,45 +185,45 @@ }); } // find property with the idShort "Company" and add that element to the generalProperties - let company = contact.value.find((element: any) => element.idShort === 'Company'); + let company = contact.value.find((element: any) => this.checkIdShort(element, 'Company')); if (company) { contact.generalProperties.push(company); } // find property with the idShort "Department" and add that element to the generalProperties - let department = contact.value.find((element: any) => element.idShort === 'Department'); + let department = contact.value.find((element: any) => this.checkIdShort(element, 'Department')); if (department) { contact.generalProperties.push(department); } // find property with the idShort "RoleOfContactPerson" and add that element to the generalProperties - let roleOfContactPerson = contact.value.find( - (element: any) => element.idShort === 'RoleOfContactPerson' + let roleOfContactPerson = contact.value.find((element: any) => + this.checkIdShort(element, 'RoleOfContactPerson') ); if (roleOfContactPerson) { contact.generalProperties.push(this.translateRole(roleOfContactPerson)); } // find property with the idShort "Language" and add that element to the generalProperties - let language = contact.value.find((element: any) => element.idShort === 'Language'); + let language = contact.value.find((element: any) => this.checkIdShort(element, 'Language')); if (language) { contact.generalProperties.push(language); } // find property with the idShort "Street" and add that element to the generalProperties - let street = contact.value.find((element: any) => element.idShort === 'Street'); + let street = contact.value.find((element: any) => this.checkIdShort(element, 'Street')); if (street) { contact.generalProperties.push(street); } let address = ''; // find property with the idShort "NationalCode" - let nationalCode = contact.value.find((element: any) => element.idShort === 'NationalCode'); + let nationalCode = contact.value.find((element: any) => this.checkIdShort(element, 'NationalCode')); if (nationalCode) { address += nationalCode.value[0].text + ' '; } // find property with the idShort "Zipcode" - let zipcode = contact.value.find((element: any) => element.idShort === 'Zipcode'); + let zipcode = contact.value.find((element: any) => this.checkIdShort(element, 'Zipcode')); if (zipcode) { address += zipcode.value[0].text + ' '; } // find property with the idShort "City" - let cityTown = contact.value.find((element: any) => element.idShort === 'CityTown'); + let cityTown = contact.value.find((element: any) => this.checkIdShort(element, 'CityTown')); if (cityTown) { address += cityTown.value[0].text; } @@ -228,35 +232,39 @@ contact.generalProperties.push({ idShort: 'Address', value: address, modelType: 'String' }); } // get the Phone Information - let phone = contact.value.find((element: any) => element.idShort === 'Phone'); + let phone = contact.value.find((element: any) => this.checkIdShort(element, 'Phone')); if (phone) { // find property with the idShort "TelephoneNumber" and add that element to the generalProperties - let telephoneNumber = phone.value.find((element: any) => element.idShort === 'TelephoneNumber'); + let telephoneNumber = phone.value.find((element: any) => + this.checkIdShort(element, 'TelephoneNumber') + ); if (telephoneNumber) { contact.generalProperties.push(telephoneNumber); } } // get the Fax Information - let fax = contact.value.find((element: any) => element.idShort === 'Fax'); + let fax = contact.value.find((element: any) => this.checkIdShort(element, 'Fax')); if (fax) { // find property with the idShort "FaxNumber" and add that element to the generalProperties - let faxNumber = fax.value.find((element: any) => element.idShort === 'FaxNumber'); + let faxNumber = fax.value.find((element: any) => this.checkIdShort(element, 'FaxNumber')); if (faxNumber) { contact.generalProperties.push(faxNumber); } } // get the Email Information - let email = contact.value.find((element: any) => element.idShort === 'Email'); + let email = contact.value.find((element: any) => this.checkIdShort(element, 'Email')); if (email) { // find property with the idShort "EmailAddress" and add that element to the generalProperties - let emailAddress = email.value.find((element: any) => element.idShort === 'EmailAddress'); + let emailAddress = email.value.find((element: any) => + this.checkIdShort(element, 'EmailAddress') + ); if (emailAddress) { contact.generalProperties.push(emailAddress); } } // find property with the idShort "AddressOfAdditionalLink" and add that element to the generalProperties - let addressOfAdditionalLink = contact.value.find( - (element: any) => element.idShort === 'AddressOfAdditionalLink' + let addressOfAdditionalLink = contact.value.find((element: any) => + this.checkIdShort(element, 'AddressOfAdditionalLink') ); if (addressOfAdditionalLink) { contact.generalProperties.push(addressOfAdditionalLink); @@ -272,37 +280,39 @@ let vCard = 'BEGIN:VCARD\n'; vCard += 'VERSION:3.0\n'; // add Contact Person Property to the vCard - let contactPerson = contact.generalProperties.find( - (element: any) => element.idShort === 'ContactPerson' + let contactPerson = contact.generalProperties.find((element: any) => + this.checkIdShort(element, 'ContactPerson') ); if (contactPerson) { vCard += 'FN:' + contactPerson.value + '\n'; } // add Company Property to the vCard - let company = contact.generalProperties.find((element: any) => element.idShort === 'Company'); + let company = contact.generalProperties.find((element: any) => this.checkIdShort(element, 'Company')); if (company) { vCard += 'ORG:' + company.value[0].text + '\n'; } // add Department Property to the vCard - let department = contact.generalProperties.find((element: any) => element.idShort === 'Department'); + let department = contact.generalProperties.find((element: any) => + this.checkIdShort(element, 'Department') + ); if (department) { vCard += 'TITLE:' + department.value[0].text + '\n'; } // add RoleOfContactPerson Property to the vCard - let roleOfContactPerson = contact.generalProperties.find( - (element: any) => element.idShort === 'RoleOfContactPerson' + let roleOfContactPerson = contact.generalProperties.find((element: any) => + this.checkIdShort(element, 'RoleOfContactPerson') ); if (roleOfContactPerson) { vCard += 'ROLE:' + roleOfContactPerson.value + '\n'; } // add Language Property to the vCard - let language = contact.generalProperties.find((element: any) => element.idShort === 'Language'); + let language = contact.generalProperties.find((element: any) => this.checkIdShort(element, 'Language')); if (language) { vCard += 'LANG:' + language.value + '\n'; } // add Address Property to the vCard - let street = contact.generalProperties.find((element: any) => element.idShort === 'Street'); - let address = contact.generalProperties.find((element: any) => element.idShort === 'Address'); + let street = contact.generalProperties.find((element: any) => this.checkIdShort(element, 'Street')); + let address = contact.generalProperties.find((element: any) => this.checkIdShort(element, 'Address')); if (address) { vCard += 'ADR;TYPE=WORK:;;' + @@ -311,35 +321,37 @@ ';;;\n'; } // get the Phone Information - let phone = contact.value.find((element: any) => element.idShort === 'Phone'); + let phone = contact.value.find((element: any) => this.checkIdShort(element, 'Phone')); if (phone) { // find property with the idShort "TelephoneNumber" and add that element to the vCard - let telephoneNumber = phone.value.find((element: any) => element.idShort === 'TelephoneNumber'); + let telephoneNumber = phone.value.find((element: any) => + this.checkIdShort(element, 'TelephoneNumber') + ); if (telephoneNumber) { vCard += 'TEL;TYPE=WORK,VOICE:' + telephoneNumber.value[0].text + '\n'; } } // get the Fax Information - let fax = contact.value.find((element: any) => element.idShort === 'Fax'); + let fax = contact.value.find((element: any) => this.checkIdShort(element, 'Fax')); if (fax) { // find property with the idShort "FaxNumber" and add that element to the vCard - let faxNumber = fax.value.find((element: any) => element.idShort === 'FaxNumber'); + let faxNumber = fax.value.find((element: any) => this.checkIdShort(element, 'FaxNumber')); if (faxNumber) { vCard += 'TEL;TYPE=WORK,FAX:' + faxNumber.value[0].text + '\n'; } } // get the Email Information - let email = contact.value.find((element: any) => element.idShort === 'Email'); + let email = contact.value.find((element: any) => this.checkIdShort(element, 'Email')); if (email) { // find property with the idShort "EmailAddress" and add that element to the vCard - let emailAddress = email.value.find((element: any) => element.idShort === 'EmailAddress'); + let emailAddress = email.value.find((element: any) => this.checkIdShort(element, 'EmailAddress')); if (emailAddress) { vCard += 'EMAIL;TYPE=WORK:' + emailAddress.value + '\n'; } } // add AddressOfAdditionalLink Property to the vCard - let addressOfAdditionalLink = contact.value.find( - (element: any) => element.idShort === 'AddressOfAdditionalLink' + let addressOfAdditionalLink = contact.value.find((element: any) => + this.checkIdShort(element, 'AddressOfAdditionalLink') ); if (addressOfAdditionalLink) { vCard += 'URL:' + addressOfAdditionalLink.value + '\n'; diff --git a/aas-web-ui/src/components/SubmodelPlugins/DigitalNameplate.vue b/aas-web-ui/src/components/SubmodelPlugins/DigitalNameplate.vue index dd40819..d55944e 100644 --- a/aas-web-ui/src/components/SubmodelPlugins/DigitalNameplate.vue +++ b/aas-web-ui/src/components/SubmodelPlugins/DigitalNameplate.vue @@ -44,7 +44,7 @@ element.idShort === 'URIOfTheProduct' + (element: any) => this.checkIdShort(element, 'URIOfTheProduct') ); if (uriOfTheProduct) { productProperties.push(uriOfTheProduct); } // find property with the idShort "ManufacturerProductDesignation" and add that element to the productProperties array let manufacturerProductDesignation = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ManufacturerProductDesignation' + (element: any) => this.checkIdShort(element, 'ManufacturerProductDesignation') ); if (manufacturerProductDesignation) { productProperties.push(manufacturerProductDesignation); } // find property with the idShort "ManufacturerProductRoot" and add that element to the productProperties array let manufacturerProductRoot = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ManufacturerProductRoot' + (element: any) => this.checkIdShort(element, 'ManufacturerProductRoot') ); if (manufacturerProductRoot) { productProperties.push(manufacturerProductRoot); } // find property with the idShort "ManufacturerProductFamily" and add that element to the productProperties array let manufacturerProductFamily = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ManufacturerProductFamily' + (element: any) => this.checkIdShort(element, 'ManufacturerProductFamily') ); if (manufacturerProductFamily) { productProperties.push(manufacturerProductFamily); } // find property with the idShort "ManufacturerProductType" and add that element to the productProperties array let manufacturerProductType = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ManufacturerProductType' + (element: any) => this.checkIdShort(element, 'ManufacturerProductType') ); if (manufacturerProductType) { productProperties.push(manufacturerProductType); } // find property with the idShort "ProductArticleNumberOfManufacturer" and add that element to the productProperties array let productArticleNumberOfManufacturer = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ProductArticleNumberOfManufacturer' + (element: any) => this.checkIdShort(element, 'ProductArticleNumberOfManufacturer') ); if (productArticleNumberOfManufacturer) { productProperties.push(productArticleNumberOfManufacturer); } // find property with the idShort "SerialNumber" and add that element to the productProperties array let serialNumber = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'SerialNumber' + (element: any) => this.checkIdShort(element, 'SerialNumber') ); if (serialNumber) { productProperties.push(serialNumber); } // find property with the idShort "YearOfConstruction" and add that element to the productProperties array let yearOfConstruction = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'YearOfConstruction' + (element: any) => this.checkIdShort(element, 'YearOfConstruction') ); if (yearOfConstruction) { productProperties.push(yearOfConstruction); } // find property with the idShort "DateOfManufacture" and add that element to the productProperties array let dateOfManufacture = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'DateOfManufacture' + (element: any) => this.checkIdShort(element, 'DateOfManufacture') ); if (dateOfManufacture) { productProperties.push(dateOfManufacture); @@ -354,21 +354,21 @@ let versions = []; // find property with the idShort "HardwareVersion" and add that element to the productProperties array let hardwareVersion = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'HardwareVersion' + (element: any) => this.checkIdShort(element, 'HardwareVersion') ); if (hardwareVersion) { versions.push(hardwareVersion); } // find property with the idShort "FirmwareVersion" and add that element to the productProperties array let firmwareVersion = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'FirmwareVersion' + (element: any) => this.checkIdShort(element, 'FirmwareVersion') ); if (firmwareVersion) { versions.push(firmwareVersion); } // find property with the idShort "SoftwareVersion" and add that element to the productProperties array let softwareVersion = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'SoftwareVersion' + (element: any) => this.checkIdShort(element, 'SoftwareVersion') ); if (softwareVersion) { versions.push(softwareVersion); @@ -386,7 +386,7 @@ // console.log('Extract Manufacturer Properties:', digitalNameplateData); // find property with the idShort "CompanyLogo" and add that element to the manufacturerProperties array let companyLogo = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'CompanyLogo' + (element: any) => this.checkIdShort(element, 'CompanyLogo') ); if (companyLogo) { this.getImageUrl(companyLogo, 'companyLogoUrl'); @@ -394,37 +394,37 @@ } // find property with the idShort "ManufacturerName" and add that element to the manufacturerProperties array let manufacturerName = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ManufacturerName' + (element: any) => this.checkIdShort(element, 'ManufacturerName') ); if (manufacturerName) { manufacturerProperties.push(manufacturerName); } // get the Contact Information let contactInformation = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'ContactInformation' + (element: any) => this.checkIdShort(element, 'ContactInformation') ); if (contactInformation) { // console.log('Contact Information:', contactInformation) // find property with the idShort "Street" and add that element to the manufacturerProperties array - let street = contactInformation.value.find((element: any) => element.idShort === 'Street'); + let street = contactInformation.value.find((element: any) => this.checkIdShort(element, 'Street')); if (street) { manufacturerProperties.push(street); } let address = ''; // find property with the idShort "NationalCode" and add that element to the manufacturerProperties array let nationalCode = contactInformation.value.find( - (element: any) => element.idShort === 'NationalCode' + (element: any) => this.checkIdShort(element, 'NationalCode') ); if (nationalCode) { address += nationalCode.value[0].text + ' '; } // find property with the idShort "Zipcode" and add that element to the manufacturerProperties array - let zipcode = contactInformation.value.find((element: any) => element.idShort === 'Zipcode'); + let zipcode = contactInformation.value.find((element: any) => this.checkIdShort(element, 'Zipcode')); if (zipcode) { address += zipcode.value[0].text + ' '; } // find property with the idShort "City" and add that element to the manufacturerProperties array - let cityTown = contactInformation.value.find((element: any) => element.idShort === 'CityTown'); + let cityTown = contactInformation.value.find((element: any) => this.checkIdShort(element, 'CityTown')); if (cityTown) { address += cityTown.value[0].text; } @@ -433,28 +433,28 @@ manufacturerProperties.push({ idShort: 'Address', value: address, modelType: 'String' }); } // get the Phone Information - let phone = contactInformation.value.find((element: any) => element.idShort === 'Phone'); + let phone = contactInformation.value.find((element: any) => this.checkIdShort(element, 'Phone')); if (phone) { // find property with the idShort "TelephoneNumber" and add that element to the manufacturerProperties array - let telephoneNumber = phone.value.find((element: any) => element.idShort === 'TelephoneNumber'); + let telephoneNumber = phone.value.find((element: any) => this.checkIdShort(element, 'TelephoneNumber')); if (telephoneNumber) { manufacturerProperties.push(telephoneNumber); } } // get the Fax Information - let fax = contactInformation.value.find((element: any) => element.idShort === 'Fax'); + let fax = contactInformation.value.find((element: any) => this.checkIdShort(element, 'Fax')); if (fax) { // find property with the idShort "FaxNumber" and add that element to the manufacturerProperties array - let faxNumber = fax.value.find((element: any) => element.idShort === 'FaxNumber'); + let faxNumber = fax.value.find((element: any) => this.checkIdShort(element, 'FaxNumber')); if (faxNumber) { manufacturerProperties.push(faxNumber); } } // get the Email Information - let email = contactInformation.value.find((element: any) => element.idShort === 'Email'); + let email = contactInformation.value.find((element: any) => this.checkIdShort(element, 'Email')); if (email) { // find property with the idShort "EmailAddress" and add that element to the manufacturerProperties array - let emailAddress = email.value.find((element: any) => element.idShort === 'EmailAddress'); + let emailAddress = email.value.find((element: any) => this.checkIdShort(element, 'EmailAddress')); if (emailAddress) { manufacturerProperties.push(emailAddress); } @@ -462,7 +462,7 @@ } // find property with the idShort "OrderCodeOfManufacturer" and add that element to the manufacturerProperties array let orderCodeOfManufacturer = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'OrderCodeOfManufacturer' + (element: any) => this.checkIdShort(element, 'OrderCodeOfManufacturer') ); if (orderCodeOfManufacturer) { manufacturerProperties.push(orderCodeOfManufacturer); @@ -474,15 +474,15 @@ // Function to extract the Markings extractMarkings(digitalNameplateData: any) { let markings = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'Markings' + (element: any) => this.checkIdShort(element, 'Markings') ); let formattedMarkings = [] as Array; if (markings?.value) { markings.value.forEach((marking: any) => { // find property with the idShort "MarkingFile" - let markingFile = marking.value.find((element: any) => element.idShort === 'MarkingFile'); + let markingFile = marking.value.find((element: any) => this.checkIdShort(element, 'MarkingFile')); // find property with the idShort "MarkingName" - let markingName = marking.value.find((element: any) => element.idShort === 'MarkingName'); + let markingName = marking.value.find((element: any) => this.checkIdShort(element, 'MarkingName')); // create the formatted Marking Object let formattedMarking = { idShort: marking.idShort, @@ -501,7 +501,7 @@ // Function to extract the Asset Specific Properties extractAssetSpecificProperties(digitalNameplateData: any) { let assetSpecificProperties = digitalNameplateData.submodelElements.find( - (element: any) => element.idShort === 'AssetSpecificProperties' + (element: any) => this.checkIdShort(element, 'AssetSpecificProperties') ); if (assetSpecificProperties) { // console.log('Asset Specific Properties:', assetSpecificProperties); @@ -513,35 +513,35 @@ let vCard = 'BEGIN:VCARD\nVERSION:3.0\n'; let manufacturerName = manufacturerProperties.find( - (element: any) => element.idShort === 'ManufacturerName' + (element: any) => this.checkIdShort(element, 'ManufacturerName') ); if (manufacturerName) { vCard += 'FN:' + manufacturerName.value[0].text + '\n'; } - let companyLogo = manufacturerProperties.find((element: any) => element.idShort === 'CompanyLogo'); + let companyLogo = manufacturerProperties.find((element: any) => this.checkIdShort(element, 'CompanyLogo')); if (companyLogo) { vCard += 'PHOTO;MEDIATYPE=image/jpeg:' + companyLogo.value[0].text + '\n'; } - let address = manufacturerProperties.find((element: any) => element.idShort === 'Address'); + let address = manufacturerProperties.find((element: any) => this.checkIdShort(element, 'Address')); if (address) { vCard += 'ADR;TYPE=WORK:;;' + address.value + ';;;\n'; } let telephoneNumber = manufacturerProperties.find( - (element: any) => element.idShort === 'TelephoneNumber' + (element: any) => this.checkIdShort(element, 'TelephoneNumber') ); if (telephoneNumber) { vCard += 'TEL;TYPE=WORK,VOICE:' + telephoneNumber.value[0].text + '\n'; } - let faxNumber = manufacturerProperties.find((element: any) => element.idShort === 'FaxNumber'); + let faxNumber = manufacturerProperties.find((element: any) => this.checkIdShort(element, 'FaxNumber')); if (faxNumber) { vCard += 'TEL;TYPE=WORK,FAX:' + faxNumber.value[0].text + '\n'; } - let emailAddress = manufacturerProperties.find((element: any) => element.idShort === 'EmailAddress'); + let emailAddress = manufacturerProperties.find((element: any) => this.checkIdShort(element, 'EmailAddress')); if (emailAddress) { vCard += 'EMAIL;TYPE=WORK:' + emailAddress.value + '\n'; } diff --git a/aas-web-ui/src/components/SubmodelPlugins/HTWFuehrungskomponente.vue b/aas-web-ui/src/components/SubmodelPlugins/HTWFuehrungskomponente.vue index c208fd3..78f636b 100644 --- a/aas-web-ui/src/components/SubmodelPlugins/HTWFuehrungskomponente.vue +++ b/aas-web-ui/src/components/SubmodelPlugins/HTWFuehrungskomponente.vue @@ -1325,7 +1325,7 @@ let propName = 'Prop_Mode'; // console.log('setState: ', state, this.selectedNode) this.submodelElementData.value.forEach((element: any) => { - if (element.idShort == 'Prop_UnitMode') propName = 'Prop_UnitMode'; + if (this.checkIdShort(element, 'Prop_UnitMode')) propName = 'Prop_UnitMode'; }); let path = this.selectedNode.pathFull + '/' + propName + '/value'; let content = "'" + mode + "'"; @@ -1353,7 +1353,7 @@ let propName = 'Prop_ControlCommand'; // console.log('setState: ', state, this.selectedNode) this.submodelElementData.value.forEach((element: any) => { - if (element.idShort == 'Prop_eCommand') propName = 'Prop_eCommand'; + if (this.checkIdShort(element, 'Prop_eCommand')) propName = 'Prop_eCommand'; }); let path = this.selectedNode.pathFull + '/' + propName + '/value'; let content = "'" + state + "'"; diff --git a/aas-web-ui/src/components/SubmodelPlugins/HandoverDocumentation.vue b/aas-web-ui/src/components/SubmodelPlugins/HandoverDocumentation.vue index 3575148..da43f12 100644 --- a/aas-web-ui/src/components/SubmodelPlugins/HandoverDocumentation.vue +++ b/aas-web-ui/src/components/SubmodelPlugins/HandoverDocumentation.vue @@ -357,11 +357,11 @@ documentVersion.meta = documentVersion.value.filter((element: any) => { // return elements with the following idShorts: Language, Title, SubTitle, Summary, KeyWords return ( - element.idShort === 'Language' || - element.idShort === 'Title' || - element.idShort === 'SubTitle' || - element.idShort === 'Summary' || - element.idShort === 'KeyWords' + this.checkIdShort(element, 'Language') || + this.checkIdShort(element, 'Title') || + this.checkIdShort(element, 'SubTitle') || + this.checkIdShort(element, 'Summary') || + this.checkIdShort(element, 'KeyWords') ); }); documentVersion.fileToggle = 'preview'; diff --git a/aas-web-ui/src/components/SubmodelPlugins/TechnicalData.vue b/aas-web-ui/src/components/SubmodelPlugins/TechnicalData.vue index 24763d0..2b29742 100644 --- a/aas-web-ui/src/components/SubmodelPlugins/TechnicalData.vue +++ b/aas-web-ui/src/components/SubmodelPlugins/TechnicalData.vue @@ -54,14 +54,14 @@ { - if (generalProperty.idShort === 'ManufacturerLogo') { + if (this.checkIdShort(generalProperty.idShort, 'ManufacturerLogo')) { this.getImageUrl(generalProperty, 'ManufacturerLogoUrl'); } if (generalProperty.idShort.includes('ProductImage')) { diff --git a/aas-web-ui/src/components/SubmodelPlugins/TimeSeriesData.vue b/aas-web-ui/src/components/SubmodelPlugins/TimeSeriesData.vue index a72d2c6..8a032e1 100644 --- a/aas-web-ui/src/components/SubmodelPlugins/TimeSeriesData.vue +++ b/aas-web-ui/src/components/SubmodelPlugins/TimeSeriesData.vue @@ -332,14 +332,18 @@ let timeSeriesData = { ...this.submodelElementData }; // create local copy of the TimeSeriesData this.timeSeriesData = timeSeriesData; // set the local copy to the data object // get the collection for segments - const segmentsSMC = timeSeriesData.submodelElements.find((smc: any) => smc.idShort === 'Segments'); + const segmentsSMC = timeSeriesData.submodelElements.find((smc: any) => + this.checkIdShort(smc, 'Segments') + ); // create an array of segments this.segments = segmentsSMC.value; // console.log('Segments: ', this.segments) // get the collection for metadata - const metadataSMC = timeSeriesData.submodelElements.find((smc: any) => smc.idShort === 'Metadata'); + const metadataSMC = timeSeriesData.submodelElements.find((smc: any) => + this.checkIdShort(smc, 'Metadata') + ); // get the collection for records - const recordsSMC = metadataSMC.value.find((smc: any) => smc.idShort === 'Record'); + const recordsSMC = metadataSMC.value.find((smc: any) => this.checkIdShort(smc, 'Record')); // create an array of records let records = recordsSMC.value; // request the concept descriptions for the records (if they have semanticIds) @@ -376,9 +380,9 @@ this.apiToken = this.configData.configObject.apiToken; this.showTokenInput = false; } - if (this.selectedSegment.idShort == 'LinkedSegment') this.fetchLinkedData(); - if (this.selectedSegment.idShort == 'InternalSegment') this.fetchInternalData(); - if (this.selectedSegment.idShort == 'ExternalSegment') this.fetchExternalData(); + if (this.checkIdShort(this.selectedSegment, 'LinkedSegment')) this.fetchLinkedData(); + if (this.checkIdShort(this.selectedSegment, 'InternalSegment')) this.fetchInternalData(); + if (this.checkIdShort(this.selectedSegment, 'ExternalSegment')) this.fetchExternalData(); }, fetchInternalData() { @@ -398,7 +402,7 @@ getRecordValues() { // console.log('Selected Segment: ', this.selectedSegment); // get the records submodel element collection - const recordsSMC = this.selectedSegment.value.find((smc: any) => smc.idShort === 'Records'); + const recordsSMC = this.selectedSegment.value.find((smc: any) => this.checkIdShort(smc, 'Records')); // save the records in an array const records = recordsSMC.value; // console.log('Records: ', records, ' Time Variable: ', this.timeVariable, ' Y Variables: ', this.yVariables); @@ -407,7 +411,7 @@ (yVar) => // Check if yVarEntry exists in all records records.every((item: any) => - item.value.some((entry: any) => entry.idShort === yVar.idShort) + item.value.some((entry: any) => this.checkIdShort(entry, yVar.idShort)) ) || // display an alert if the yVariable is not available in the records (specify the yVariable name) this.navigationStore.dispatchSnackbar({ @@ -422,8 +426,8 @@ // For each yVariable, go through each item in the original array return records.map((item: any) => { // Extract the time value - const timeEntry = item.value.find( - (entry: any) => entry.idShort === this.timeVariable.idShort + const timeEntry = item.value.find((entry: any) => + this.checkIdShort(entry, this.timeVariable.idShort) ); // display an alert if the timeVariable is not available the Records if (!timeEntry) { @@ -441,7 +445,7 @@ const time = timeEntry ? timeEntry.value : null; // Extract the yVariable value - const yVarEntry = item.value.find((entry: any) => entry.idShort === yVar.idShort); + const yVarEntry = item.value.find((entry: any) => entry, yVar.idShort); const yVarValue = yVarEntry ? yVarEntry.value : null; // Return an object with time and the yVariable value @@ -460,9 +464,11 @@ return; } // get the Endpoint from the selected Segment - const endpoint = this.selectedSegment.value.find((smc: any) => smc.idShort === 'Endpoint').value; + const endpoint = this.selectedSegment.value.find((smc: any) => + this.checkIdShort(smc, 'Endpoint') + ).value; // get the query from the selected Segment - let query = this.selectedSegment.value.find((smc: any) => smc.idShort === 'Query').value; + let query = this.selectedSegment.value.find((smc: any) => this.checkIdShort(smc, 'Query')).value; if (this.yVariables.length > 0) query = query.replace(this.yVariableTemplate, this.yVariables[0].idShort); @@ -600,7 +606,7 @@ getFileData() { // console.log('Selected Segment: ', this.selectedSegment); // get the Data File/Blob submodel element - const dataFile = this.selectedSegment.value.find((smc: any) => smc.idShort === 'Data'); + const dataFile = this.selectedSegment.value.find((smc: any) => this.checkIdShort(smc, 'Data')); // determine the path to the file let path = dataFile.value; if (path.startsWith('/')) { diff --git a/aas-web-ui/src/mixins/SubmodelElementHandling.ts b/aas-web-ui/src/mixins/SubmodelElementHandling.ts index 47759b2..f653a15 100644 --- a/aas-web-ui/src/mixins/SubmodelElementHandling.ts +++ b/aas-web-ui/src/mixins/SubmodelElementHandling.ts @@ -105,6 +105,28 @@ export default defineComponent({ return string.charAt(0).toUpperCase() + string.slice(1); }, + // Function to check if the idShort of a SubmodelElement matches the given idShort + checkIdShort(referable: any, idShort: string, startsWith: boolean = false, strict: boolean = false): boolean { + if (idShort.trim() === '') return false; + + if (!referable || !referable.idShort || referable.idShort.length === 0) return false; + + if (startsWith) { + // For matching e.g. ProductImage{00} with idShort ProductImage + if (strict) { + return referable.idShort.startsWith(idShort); + } else { + return referable.idShort.toLowerCase().startsWith(idShort.toLowerCase()); + } + } else { + if (strict) { + return referable.idShort === idShort; + } else { + return referable.idShort.toLowerCase() === idShort.toLowerCase(); + } + } + }, + // Function to check if the SemanticID of a SubmodelElement matches the given SemanticID checkSemanticId(submodelElement: any, semanticId: string): boolean { if (semanticId.trim() == '') return false; @@ -330,7 +352,7 @@ export default defineComponent({ // execute if the Request was successful const list = response.data; list.value.forEach((element: any, i: number) => { - if (element.idShort == SubmodelElement.value) { + if (this.checkIdShort(element, SubmodelElement.value, false, true)) { path += encodeURIComponent('[') + i + encodeURIComponent(']'); } });