Skip to content

Commit 4da3683

Browse files
authored
Extends the infrastructure config to include component integration flags (#1104)
* Extends the infrastructure config to include component integration flags * Improves thumbnail handling in dpp module * Further adaptions according to remarks * Futher adaptions based on remarks
1 parent cfd359e commit 4da3683

File tree

18 files changed

+788
-158
lines changed

18 files changed

+788
-158
lines changed

aas-web-ui/public/config/basyx-infra.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
# The configuration will be loaded at application startup and merged with user settings.
99
# When VITE_ENDPOINT_CONFIG_AVAILABLE=false, this configuration takes full precedence.
1010
# When VITE_ENDPOINT_CONFIG_AVAILABLE=true, users can edit these infrastructures.
11+
# Optional component flags:
12+
# - hasRegistryIntegration: Backend repository creates/updates/deletes descriptors automatically.
13+
# - hasDiscoveryIntegration: Backend AAS registry creates/updates/deletes discovery asset links automatically.
1114

1215
infrastructures:
1316
# Specify which infrastructure should be selected by default
@@ -21,12 +24,15 @@ infrastructures:
2124
baseUrl: "http://localhost:9084"
2225
aasRegistry:
2326
baseUrl: "http://localhost:9082"
27+
hasDiscoveryIntegration: true
2428
submodelRegistry:
2529
baseUrl: "http://localhost:9083"
2630
aasRepository:
2731
baseUrl: "http://localhost:9081"
32+
hasRegistryIntegration: true
2833
submodelRepository:
2934
baseUrl: "http://localhost:9081"
35+
hasRegistryIntegration: true
3036
conceptDescriptionRepository:
3137
baseUrl: "http://localhost:9081"
3238
security:

aas-web-ui/src/components/AppNavigation/DeleteAAS.vue

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@
3737
</template>
3838

3939
<script lang="ts" setup>
40-
import { ref, watch } from 'vue';
40+
import { computed, ref, watch } from 'vue';
4141
import { useRoute, useRouter } from 'vue-router';
4242
import { useAASHandling } from '@/composables/AAS/AASHandling';
4343
import { useSMHandling } from '@/composables/AAS/SMHandling';
44+
import { useAASDiscoveryClient } from '@/composables/Client/AASDiscoveryClient';
45+
import { useAASRegistryClient } from '@/composables/Client/AASRegistryClient';
46+
import { useSMRegistryClient } from '@/composables/Client/SMRegistryClient';
4447
import { useAASStore } from '@/store/AASDataStore';
48+
import { useInfrastructureStore } from '@/store/InfrastructureStore';
4549
import { useNavigationStore } from '@/store/NavigationStore';
4650
4751
// Vue Router
@@ -50,11 +54,15 @@
5054
5155
// Stores
5256
const aasStore = useAASStore();
57+
const infrastructureStore = useInfrastructureStore();
5358
const navigationStore = useNavigationStore();
5459
5560
// Composables
5661
const { deleteAasById, getSubmodelRefsById } = useAASHandling();
5762
const { deleteSmById, fetchSmById } = useSMHandling();
63+
const { deleteAasDescriptor } = useAASRegistryClient();
64+
const { deleteSubmodelDescriptor } = useSMRegistryClient();
65+
const { deleteAssetLinksForAas } = useAASDiscoveryClient();
5866
5967
const props = defineProps<{
6068
modelValue: boolean;
@@ -72,6 +80,17 @@
7280
const submodelIds = ref<any[]>([]); // Variable to store the Submodel Ids of the AAS
7381
const selected = ref<string[]>([]); // Variable to store the selected Submodel Ids
7482
83+
const selectedInfrastructure = computed(() => infrastructureStore.getSelectedInfrastructure);
84+
const aasRepoHasRegistryIntegration = computed(
85+
() => selectedInfrastructure.value?.components?.AASRepo?.hasRegistryIntegration ?? true
86+
);
87+
const submodelRepoHasRegistryIntegration = computed(
88+
() => selectedInfrastructure.value?.components?.SubmodelRepo?.hasRegistryIntegration ?? true
89+
);
90+
const aasRegistryHasDiscoveryIntegration = computed(
91+
() => selectedInfrastructure.value?.components?.AASRegistry?.hasDiscoveryIntegration ?? true
92+
);
93+
7594
watch(
7695
() => props.modelValue,
7796
async (value) => {
@@ -107,17 +126,38 @@
107126
async function confirmDelete(): Promise<void> {
108127
deleteLoading.value = true;
109128
let error = false;
129+
const warnings: string[] = [];
110130
try {
111131
if (deleteSubmodels.value) {
112132
// Extract all references in an array called submodelIds from each keys[0].value
113133
const submodelIds = selected.value;
114134
// Remove each submodel
115135
for (const submodelId of submodelIds) {
116136
error = error || !(await deleteSmById(submodelId));
137+
if (!error && !submodelRepoHasRegistryIntegration.value) {
138+
const descriptorDeleted = await deleteSubmodelDescriptor(submodelId);
139+
if (!descriptorDeleted) {
140+
warnings.push(`Failed to delete Submodel descriptor '${submodelId}'.`);
141+
}
142+
}
117143
}
118144
}
119145
120146
error = error || !(await removeAAS(props.aas));
147+
148+
if (!error && !aasRepoHasRegistryIntegration.value) {
149+
const descriptorDeleted = await deleteAasDescriptor(props.aas.id);
150+
if (!descriptorDeleted) {
151+
warnings.push(`Failed to delete AAS descriptor '${props.aas.id}'.`);
152+
}
153+
}
154+
155+
if (!error && !aasRegistryHasDiscoveryIntegration.value) {
156+
const assetLinksDeleted = await deleteAssetLinksForAas(props.aas.id);
157+
if (!assetLinksDeleted) {
158+
warnings.push(`Failed to delete discovery asset links for '${props.aas.id}'.`);
159+
}
160+
}
121161
} finally {
122162
deleteDialog.value = false;
123163
deleteSubmodels.value = false;
@@ -134,6 +174,17 @@
134174
}
135175
navigationStore.dispatchTriggerAASListReload(); // Reload AAS List
136176
}
177+
178+
if (warnings.length > 0) {
179+
navigationStore.dispatchSnackbar({
180+
status: true,
181+
timeout: 9000,
182+
color: 'warning',
183+
btnColor: 'buttonText',
184+
baseError: 'Delete completed with synchronization warnings.',
185+
extendedError: warnings.join('\n'),
186+
});
187+
}
137188
deleteLoading.value = false;
138189
}
139190
}
Lines changed: 76 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,71 @@
11
<template>
22
<v-container class="pa-0">
3-
<v-text-field
4-
v-for="componentKey in BASYX_COMPONENT_KEYS"
5-
:key="componentKey"
6-
:name="`basyx-${componentKey}-endpoint`"
7-
:model-value="components[componentKey].url"
8-
:label="getComponentLabel(componentKey) + ' Endpoint URL'"
9-
variant="outlined"
10-
density="compact"
11-
placeholder="https://example.com/api"
12-
autocomplete="url"
13-
class="mb-2"
14-
@update:model-value="handleUrlUpdate(componentKey, $event)"
15-
@keyup.enter="$emit('test-connection', componentKey)">
16-
<template #prepend-inner>
17-
<v-icon
18-
:color="
19-
componentConnectionStatus[componentKey] === true
20-
? 'success'
21-
: componentConnectionStatus[componentKey] === false
22-
? 'error'
23-
: components[componentKey].url
24-
? 'grey'
25-
: 'grey'
26-
"
27-
size="small">
28-
{{
29-
componentConnectionStatus[componentKey] === true
30-
? 'mdi-check-circle'
31-
: componentConnectionStatus[componentKey] === false
32-
? 'mdi-alert-circle'
33-
: components[componentKey].url
34-
? 'mdi-help-circle'
35-
: 'mdi-circle-outline'
36-
}}
37-
</v-icon>
38-
</template>
39-
<template #append-inner>
40-
<v-btn
41-
icon
42-
size="x-small"
43-
variant="text"
44-
:loading="componentTestingLoading[componentKey]"
45-
:disabled="!components[componentKey].url"
46-
@click.stop="$emit('test-connection', componentKey)">
47-
<v-icon>mdi-connection</v-icon>
48-
<v-tooltip activator="parent" location="bottom"> Test Connection </v-tooltip>
49-
</v-btn>
50-
</template>
51-
</v-text-field>
3+
<div v-for="componentKey in BASYX_COMPONENT_KEYS" :key="componentKey" class="mb-2">
4+
<v-text-field
5+
:name="`basyx-${componentKey}-endpoint`"
6+
:model-value="components[componentKey].url"
7+
:label="getComponentLabel(componentKey) + ' Endpoint URL'"
8+
variant="outlined"
9+
density="compact"
10+
placeholder="https://example.com/api"
11+
autocomplete="url"
12+
@update:model-value="handleUrlUpdate(componentKey, $event)"
13+
@keyup.enter="$emit('test-connection', componentKey)">
14+
<template #prepend-inner>
15+
<v-icon
16+
:color="
17+
componentConnectionStatus[componentKey] === true
18+
? 'success'
19+
: componentConnectionStatus[componentKey] === false
20+
? 'error'
21+
: components[componentKey].url
22+
? 'grey'
23+
: 'grey'
24+
"
25+
size="small">
26+
{{
27+
componentConnectionStatus[componentKey] === true
28+
? 'mdi-check-circle'
29+
: componentConnectionStatus[componentKey] === false
30+
? 'mdi-alert-circle'
31+
: components[componentKey].url
32+
? 'mdi-help-circle'
33+
: 'mdi-circle-outline'
34+
}}
35+
</v-icon>
36+
</template>
37+
<template #append-inner>
38+
<v-btn
39+
icon
40+
size="x-small"
41+
variant="text"
42+
:loading="componentTestingLoading[componentKey]"
43+
:disabled="!components[componentKey].url"
44+
@click.stop="$emit('test-connection', componentKey)">
45+
<v-icon>mdi-connection</v-icon>
46+
<v-tooltip activator="parent" location="bottom"> Test Connection </v-tooltip>
47+
</v-btn>
48+
</template>
49+
</v-text-field>
50+
51+
<v-checkbox
52+
v-if="componentKey === 'AASRepo' || componentKey === 'SubmodelRepo'"
53+
:model-value="components[componentKey].hasRegistryIntegration ?? true"
54+
label="Backend creates descriptors automatically"
55+
hide-details
56+
density="compact"
57+
class="mt-n1 mb-1"
58+
@update:model-value="handleRegistryIntegrationUpdate(componentKey, $event)" />
59+
60+
<v-checkbox
61+
v-if="componentKey === 'AASRegistry'"
62+
:model-value="components[componentKey].hasDiscoveryIntegration ?? true"
63+
label="Backend creates AAS discovery asset links automatically"
64+
hide-details
65+
density="compact"
66+
class="mt-n1 mb-1"
67+
@update:model-value="handleDiscoveryIntegrationUpdate(componentKey, $event)" />
68+
</div>
5269
</v-container>
5370
</template>
5471

@@ -73,10 +90,20 @@
7390
'test-connection': [componentKey: BaSyxComponentKey];
7491
'update:componentUrl': [componentKey: BaSyxComponentKey, url: string];
7592
'update:connectionStatus': [componentKey: BaSyxComponentKey, status: boolean | null];
93+
'update:registryIntegration': [componentKey: BaSyxComponentKey, enabled: boolean];
94+
'update:discoveryIntegration': [componentKey: BaSyxComponentKey, enabled: boolean];
7695
}>();
7796
7897
function handleUrlUpdate(componentKey: BaSyxComponentKey, url: string): void {
7998
emit('update:componentUrl', componentKey, url);
8099
emit('update:connectionStatus', componentKey, null);
81100
}
101+
102+
function handleRegistryIntegrationUpdate(componentKey: BaSyxComponentKey, value: boolean | null): void {
103+
emit('update:registryIntegration', componentKey, Boolean(value));
104+
}
105+
106+
function handleDiscoveryIntegrationUpdate(componentKey: BaSyxComponentKey, value: boolean | null): void {
107+
emit('update:discoveryIntegration', componentKey, Boolean(value));
108+
}
82109
</script>

aas-web-ui/src/components/AppNavigation/Settings/InfrastructureManagement.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060
:component-testing-loading="componentTestingLoading"
6161
@test-connection="testComponentConnection"
6262
@update:component-url="handleComponentUrlUpdate"
63-
@update:connection-status="handleConnectionStatusUpdate" />
63+
@update:connection-status="handleConnectionStatusUpdate"
64+
@update:registry-integration="handleRegistryIntegrationUpdate"
65+
@update:discovery-integration="handleDiscoveryIntegrationUpdate" />
6466
<!-- Security Configuration -->
6567
<v-divider></v-divider>
6668
<v-list-subheader class="mb-3">Security Configuration</v-list-subheader>
@@ -368,4 +370,12 @@
368370
function handleConnectionStatusUpdate(componentKey: BaSyxComponentKey, status: boolean | null): void {
369371
componentConnectionStatus.value[componentKey] = status;
370372
}
373+
374+
function handleRegistryIntegrationUpdate(componentKey: BaSyxComponentKey, enabled: boolean): void {
375+
editingInfrastructure.value.components[componentKey].hasRegistryIntegration = enabled;
376+
}
377+
378+
function handleDiscoveryIntegrationUpdate(componentKey: BaSyxComponentKey, enabled: boolean): void {
379+
editingInfrastructure.value.components[componentKey].hasDiscoveryIntegration = enabled;
380+
}
371381
</script>

0 commit comments

Comments
 (0)