Skip to content

Commit

Permalink
Work on checkSemanticId() (#136)
Browse files Browse the repository at this point in the history
* Add check (and test) for IEC CDD semanticIds

* Work on checkSemanticId

Add tests for IEC CDD semanticId
Add further tests for Eclass cardinality
Fix for Eclass cardinality

* Comments console logs

* Spliting checkSemanticId()

* Fix checks of semanticId

* Adapt order of visualizations/plugins

* Fix ComponentVisu

---------

Co-authored-by: Aaron Zielstorff <[email protected]>
  • Loading branch information
seicke and aaronzi authored Dec 16, 2024
1 parent d3bc9cc commit 4cee279
Show file tree
Hide file tree
Showing 3 changed files with 575 additions and 223 deletions.
42 changes: 41 additions & 1 deletion aas-web-ui/src/components/ComponentVisualization.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
// Filtered Plugins
filteredPlugins() {
return this.importedPlugins.filter((plugin: any) => {
let plugins = this.importedPlugins.filter((plugin: any) => {
if (!plugin.semanticId) return false;
if (typeof plugin.semanticId === 'string') {
Expand All @@ -174,6 +174,46 @@
}
return false;
});
// In case of multiple plugins matching for the semanticId of
// submodelElementData, the plugins are sorted in descending
// alphabetical order with respect to their semanticIds.
// This will display the latest (in terms of version) plugin on
// top. Plugins without version in the semanticId will be
// displayed at the bottom.
// Sort filtered plugins with respect to semanticId
plugins
.sort((pluginA, pluginB) => {
let pluginASemanticId = '';
let pluginBSemanticId = '';
if (typeof pluginA.semanticId === 'string') pluginASemanticId = pluginA.semanticId;
if (typeof pluginB.semanticId === 'string') pluginBSemanticId = pluginB.semanticId;
if (Array.isArray(pluginA.semanticId)) {
if (pluginA.semanticId.length > 0) {
pluginA.semanticId
.sort((semanticIdA, semanticIdB) => semanticIdA.localeCompare(semanticIdB))
.reverse();
pluginASemanticId = pluginA.semanticId[0];
}
}
if (Array.isArray(pluginB.semanticId)) {
if (pluginB.semanticId.length > 0) {
pluginB.semanticId
.sort((semanticIdA, semanticIdB) => semanticIdA.localeCompare(semanticIdB))
.reverse();
pluginBSemanticId = pluginB.semanticId[0];
}
}
return pluginASemanticId.localeCompare(pluginBSemanticId);
})
.reverse();
return plugins;
},
// return if in viewer mode
Expand Down
Loading

0 comments on commit 4cee279

Please sign in to comment.