Skip to content

Commit

Permalink
Merge branch 'main' into single-aas
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronzi authored Dec 17, 2024
2 parents edfeb0a + 4cee279 commit a31109f
Show file tree
Hide file tree
Showing 3 changed files with 576 additions and 224 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 a31109f

Please sign in to comment.