Skip to content

Commit 13b1fa1

Browse files
committed
Refactors Code
1 parent cd47eec commit 13b1fa1

File tree

1 file changed

+17
-15
lines changed
  • aas-gui/Frontend/aas-web-gui/src/components/AppNavigation

1 file changed

+17
-15
lines changed

aas-gui/Frontend/aas-web-gui/src/components/AppNavigation/AASList.vue

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<!-- Download AAS -->
5858
<v-btn v-if="aasRepoURL" @click.stop="downloadAAS(item)" icon="mdi-download" size="x-small" variant="plain" style="z-index: 9000; margin-left: -6px"></v-btn>
5959
<!-- Remove from AAS Registry Button -->
60-
<v-btn @click.stop="showDeleteDialog = true; aasToDelete = item" icon="mdi-close" size="x-small" variant="plain" style="z-index: 9000; margin-left: -6px"></v-btn>
60+
<v-btn @click.stop="showDeleteDialog(item)" icon="mdi-close" size="x-small" variant="plain" style="z-index: 9000; margin-left: -6px"></v-btn>
6161
</template>
6262
<v-overlay :model-value="isSelected(item)" scrim="primary" style="opacity: 0.2" contained persistent></v-overlay>
6363
</v-list-item>
@@ -79,20 +79,18 @@
7979
</v-list>
8080
</v-card>
8181
</v-container>
82-
<v-dialog v-model="showDeleteDialog" max-width="500px">
82+
<v-dialog v-model="deleteDialogShowing" max-width="500px">
8383
<v-card>
84-
<v-card-title class="headline">Confirm Delete</v-card-title>
84+
<v-card-title>Confirm Delete</v-card-title>
8585
<v-divider></v-divider>
8686
<v-card-text class="pb-0">
87-
Are you sure you want to delete the AAS?
87+
<span>Are you sure you want to delete the AAS?</span>
8888
<v-checkbox v-model="deleteSubmodels" label="Also delete Submodels" hide-details></v-checkbox>
89-
<v-alert class="mb-2" variant="tonal" border v-if="deleteSubmodels" color="warning">
90-
Warning: If other shells refer to the same submodels, those references are not deleted!
91-
</v-alert>
89+
<v-alert class="mb-2" variant="tonal" border v-if="deleteSubmodels" color="warning">Warning: If other shells refer to the same submodels, those references are not deleted!</v-alert>
9290
</v-card-text>
9391
<v-card-actions>
9492
<v-spacer></v-spacer>
95-
<v-btn @click="showDeleteDialog = false">Cancel</v-btn>
93+
<v-btn @click="deleteDialogShowing = false">Cancel</v-btn>
9694
<v-btn variant="tonal" color="error" @click="confirmDelete" :loading="deleteLoading">Delete</v-btn>
9795
</v-card-actions>
9896
</v-card>
@@ -138,7 +136,7 @@ export default defineComponent({
138136
detailsObject: {} as any, // Variable to store the AAS Data of the currently selected AAS
139137
showDetailsCard: false, // Variable to store if the Details Card should be shown
140138
listLoading: false, // Variable to store if the AAS List is loading
141-
showDeleteDialog: false, // Variable to store if the Delete Dialog should be shown
139+
deleteDialogShowing: false, // Variable to store if the Delete Dialog should be shown
142140
deleteSubmodels: false, // Variable to store if the Submodels should be deleted
143141
aasToDelete: {} as any, // Variable to store the AAS to be deleted
144142
deleteLoading: false, // Variable to store if the AAS is being deleted
@@ -461,7 +459,7 @@ export default defineComponent({
461459
this.navigationStore.dispatchSnackbar({ status: true, timeout: 4000, color: 'error', btnColor: 'buttonText', text: 'Please wait for the current Request to finish.' });
462460
return;
463461
}
464-
console.log('Remove AAS: ', AAS);
462+
// console.log('Remove AAS: ', AAS);
465463
let path = AAS.endpoints[0].protocolInformation.href;
466464
let context = 'removing AAS';
467465
let disableMessage = false;
@@ -479,7 +477,6 @@ export default defineComponent({
479477
const response = await this.getRequest(path, context, disableMessage);
480478
if (response.success) {
481479
const submodelRefs = response.data.result;
482-
const aasIds = this.URLEncode(this.aasToDelete.id);
483480
// Extract all references in an array called submodelIds from each keys[0].value
484481
const submodelIds = submodelRefs.map((ref:any) => ref.keys[0].value);
485482
this.removeAAS(this.aasToDelete);
@@ -490,21 +487,21 @@ export default defineComponent({
490487
if (submodelResponse.success) {
491488
const deletePath = submodelResponse.data.endpoints[0].protocolInformation.href;
492489
await this.deleteRequest(deletePath, 'removing Submodel', disableMessage);
493-
}else{
490+
} else {
494491
error = true;
495492
}
496493
}
497-
}else{
494+
} else {
498495
error = true;
499496
}
500497
} else {
501498
this.removeAAS(this.aasToDelete);
502499
}
503500
} finally {
504-
this.showDeleteDialog = false;
501+
this.deleteDialogShowing = false;
505502
this.aasToDelete = {};
506503
this.deleteSubmodels = false;
507-
if(!error){
504+
if (!error) {
508505
//remove query from URL
509506
this.$router.push({ path: this.$route.path, query: {} });
510507
this.aasStore.dispatchSelectedAAS({});
@@ -515,6 +512,11 @@ export default defineComponent({
515512
this.deleteLoading = false;
516513
}
517514
},
515+
516+
showDeleteDialog(AAS: any){
517+
this.deleteDialogShowing = true;
518+
this.aasToDelete = AAS
519+
}
518520
},
519521
});
520522
</script>

0 commit comments

Comments
 (0)