Skip to content

Commit

Permalink
Usage of checkSemanticId() of mixin SubmodelElementHandling
Browse files Browse the repository at this point in the history
  • Loading branch information
seicke committed Aug 28, 2024
1 parent fda6ca4 commit 74850a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</template>
</v-combobox>
<template v-if="aasData && Object.keys(aasData).length > 0">
<TimeSeriesData v-if="checkSemanticId('https://admin-shell.io/idta/TimeSeries/1/1')" class="py-2" :submodelElementData="aasData" :configData="dashboardData" :editDialog="true" @newOptions="setNewOptions"></TimeSeriesData>
<TimeSeriesData v-if="checkSemanticId(dashboardData.configObject, 'https://admin-shell.io/idta/TimeSeries/1/1')" class="py-2" :submodelElementData="aasData" :configData="dashboardData" :editDialog="true" @newOptions="setNewOptions"></TimeSeriesData>
</template>
</v-card-text>
<v-divider></v-divider>
Expand All @@ -46,6 +46,7 @@
import { defineComponent } from 'vue';
import { useEnvStore } from '@/store/EnvironmentStore';
import DashboardHandling from '@/mixins/DashboardHandling';
import SubmodelElementHandling from '@/mixins/SubmodelElementHandling';
import TimeSeriesData from '../SubmodelPlugins/TimeSeriesData.vue';
export default defineComponent({
Expand All @@ -54,7 +55,7 @@
TimeSeriesData,
DashboardHandling,
},
mixins: [DashboardHandling],
mixins: [SubmodelElementHandling, DashboardHandling],
props: ['aasData', 'dashboardData'],
setup() {
Expand Down Expand Up @@ -92,11 +93,6 @@
},
methods: {
checkSemanticId(semanticId: string): boolean {
// console.log(this.dashboardData)
return this.dashboardData.configObject.semanticId === semanticId;
},
async getAvailableGroups() {
this.groups = await this.getGroups();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</v-col>
</v-row>
<template v-if="AASData && Object.keys(AASData).length > 0">
<TimeSeriesData v-if="checkSemanticId('https://admin-shell.io/idta/TimeSeries/1/1')" :submodelElementData="AASData" :configData="localDashboardData" :editDialog="false" :loadTrigger="trigger"></TimeSeriesData>
<TimeSeriesData v-if="checkSemanticId(localDashboardData.configObject, 'https://admin-shell.io/idta/TimeSeries/1/1')" :submodelElementData="AASData" :configData="localDashboardData" :editDialog="false" :loadTrigger="trigger"></TimeSeriesData>
</template>
</v-card>
<!-- Dialog for deleting a dashboard element -->
Expand All @@ -45,6 +45,7 @@
import { defineComponent } from 'vue';
import { useEnvStore } from '@/store/EnvironmentStore';
import DashboardHandling from '@/mixins/DashboardHandling';
import SubmodelElementHandling from '@/mixins/SubmodelElementHandling';
import TimeSeriesData from '../SubmodelPlugins/TimeSeriesData.vue';
import DashboardEditElement from '../Dashboard/DashboardEditElement.vue';
Expand All @@ -55,7 +56,7 @@ export default defineComponent({
TimeSeriesData,
DashboardEditElement,
},
mixins: [DashboardHandling],
mixins: [SubmodelElementHandling, DashboardHandling],
props: ['dashboardData', 'globalSyncStatus'],
emits: ['deleteElement', 'updateElement'],
Expand Down Expand Up @@ -134,10 +135,6 @@ export default defineComponent({
});
},
// Function to check if the SemanticID of a SubmodelElement matches the given SemanticID
checkSemanticId(semanticId: string): boolean {
return this.localDashboardData.configObject.semanticId === semanticId;
},
updateVisibility() {
this.localDashboardData.visibility = !this.localDashboardData.visibility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<v-container fluid class="pa-0">
<!-- List of all available Submodel and SubmodelElement Plugins matched by their SemanticID -->
<template v-if="SelectedNode && Object.keys(SelectedNode).length > 0 && Object.keys(submodelElementData).length > 0 && submodelElementData.semanticId && submodelElementData.semanticId.keys && submodelElementData.semanticId.keys.length > 0">
<HTWFuehrungskomponente v-if="checkSemanticId('http://htw-berlin.de/smc_statemachine')" :submodelElementData="submodelElementData" :selectedNode="selectedNode"></HTWFuehrungskomponente>
<DigitalNameplate v-else-if="checkSemanticId('https://admin-shell.io/zvei/nameplate/2/0/Nameplate')" :submodelElementData="submodelElementData"></DigitalNameplate>
<TimeSeriesData v-else-if="checkSemanticId('https://admin-shell.io/idta/TimeSeries/1/1')" :submodelElementData="submodelElementData"></TimeSeriesData>
<BillsOfMaterial v-else-if="checkSemanticId('https://admin-shell.io/idta/HierarchicalStructures/1/0/Submodel') || checkSemanticId('https://admin-shell.io/idta/HierarchicalStructures/1/1/Submodel')" :submodelElementData="submodelElementData"></BillsOfMaterial>
<HandoverDocumentation v-else-if="checkSemanticId('0173-1#01-AHF578#001')" :submodelElementData="submodelElementData"></HandoverDocumentation>
<ContactInformation v-else-if="checkSemanticId('https://admin-shell.io/zvei/nameplate/1/0/ContactInformations')" :submodelElementData="submodelElementData"></ContactInformation>
<TechnicalData v-else-if="checkSemanticId('https://admin-shell.io/ZVEI/TechnicalData/Submodel/1/2')" :submodelElementData="submodelElementData"></TechnicalData>
<JSONArrayProperty v-else-if="checkSemanticId('http://iese.fraunhofer.de/prop_jsonarray')" :submodelElementData="submodelElementData"></JSONArrayProperty>
<HTWFuehrungskomponente v-if="checkSemanticId(submodelElementData, 'http://htw-berlin.de/smc_statemachine')" :submodelElementData="submodelElementData" :selectedNode="selectedNode"></HTWFuehrungskomponente>
<DigitalNameplate v-else-if="checkSemanticId(submodelElementData, 'https://admin-shell.io/zvei/nameplate/2/0/Nameplate')" :submodelElementData="submodelElementData"></DigitalNameplate>
<TimeSeriesData v-else-if="checkSemanticId(submodelElementData, 'https://admin-shell.io/idta/TimeSeries/1/1')" :submodelElementData="submodelElementData"></TimeSeriesData>
<BillsOfMaterial v-else-if="checkSemanticId(submodelElementData, 'https://admin-shell.io/idta/HierarchicalStructures/1/0/Submodel') || checkSemanticId(submodelElementData, 'https://admin-shell.io/idta/HierarchicalStructures/1/1/Submodel')" :submodelElementData="submodelElementData"></BillsOfMaterial>
<HandoverDocumentation v-else-if="checkSemanticId(submodelElementData, '0173-1#01-AHF578#001')" :submodelElementData="submodelElementData"></HandoverDocumentation>
<ContactInformation v-else-if="checkSemanticId(submodelElementData, 'https://admin-shell.io/zvei/nameplate/1/0/ContactInformations')" :submodelElementData="submodelElementData"></ContactInformation>
<TechnicalData v-else-if="checkSemanticId(submodelElementData, 'https://admin-shell.io/ZVEI/TechnicalData/Submodel/1/2')" :submodelElementData="submodelElementData"></TechnicalData>
<JSONArrayProperty v-else-if="checkSemanticId(submodelElementData, 'http://iese.fraunhofer.de/prop_jsonarray')" :submodelElementData="submodelElementData"></JSONArrayProperty>
<GenericDataVisu v-else-if="viewerMode" :submodelElementData="submodelElementData.submodelElements"></GenericDataVisu>
<!-- Plugins added by the user are dynamically registered here -->
<component v-for="(plugin, i) in filteredPlugins" :key="i" :is="plugin.name" :submodelElementData="submodelElementData"></component>
Expand All @@ -31,6 +31,7 @@ import { defineComponent } from 'vue';
import { useRoute } from 'vue-router';
import { useNavigationStore } from '@/store/NavigationStore';
import { useAASStore } from '@/store/AASDataStore';
import SubmodelElementHandling from '@/mixins/SubmodelElementHandling';
import HTWFuehrungskomponente from './HTWFuehrungskomponente.vue';
import DigitalNameplate from './DigitalNameplate.vue';
Expand Down Expand Up @@ -62,6 +63,7 @@ export default defineComponent({
PDFPreview,
CADPreview,
},
mixins: [SubmodelElementHandling],
props: ['submodelElementData', 'selectedNode'],
setup() {
Expand Down Expand Up @@ -102,17 +104,5 @@ export default defineComponent({
},
},
methods: {
// Function to check if the SemanticID of a SubmodelElement matches the given SemanticID
checkSemanticId(semanticId: string): boolean {
let result = false;
this.submodelElementData.semanticId.keys.forEach((key: any) => {
if (key.value === semanticId) {
result = true;
}
});
return result;
},
},
});
</script>

0 comments on commit 74850a5

Please sign in to comment.