Skip to content

Commit 8ee9214

Browse files
authored
Copy/Paste feature for Submodels/SubmodelElements (#685)
* Adds functionality to copy Submodels/SubmodelElements to the clipboard store * Adds pasting functionality for Submodels/SubmodelElements * Remove console statement
1 parent c9f7a2a commit 8ee9214

File tree

4 files changed

+471
-134
lines changed

4 files changed

+471
-134
lines changed

aas-web-ui/src/components/SubmodelTree.vue

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,32 @@
106106
</template>
107107
<span>Create a new Submodel from JSON</span>
108108
</v-tooltip>
109+
<v-divider></v-divider>
110+
<!-- Paste Submodel from internal clipboard -->
111+
<v-tooltip open-delay="600" location="end">
112+
<template #activator="{ props }">
113+
<v-list-item
114+
:disabled="
115+
!clipboardElementContentType ||
116+
clipboardElementContentType !== 'Submodel'
117+
"
118+
slim
119+
v-bind="props"
120+
@click="pasteElement">
121+
<template #prepend>
122+
<v-icon size="small">mdi-file-document-multiple-outline</v-icon>
123+
</template>
124+
{{
125+
`Paste ${!clipboardElementContentType || clipboardElementContentType !== 'Submodel' ? '' : clipboardElementContentType}`
126+
}}
127+
</v-list-item>
128+
</template>
129+
<span>
130+
{{
131+
`Paste ${!clipboardElementContentType || clipboardElementContentType !== 'Submodel' ? '' : 'copied ' + clipboardElementContentType}`
132+
}}
133+
</span>
134+
</v-tooltip>
109135
</v-list>
110136
</v-sheet>
111137
</v-menu>
@@ -243,7 +269,9 @@
243269
import { useAASHandling } from '@/composables/AAS/AASHandling';
244270
import { useReferableUtils } from '@/composables/AAS/ReferableUtils';
245271
import { useSMHandling } from '@/composables/AAS/SMHandling';
272+
import { useClipboardUtil } from '@/composables/ClipboardUtil';
246273
import { useAASStore } from '@/store/AASDataStore';
274+
import { useClipboardStore } from '@/store/ClipboardStore';
247275
import { useEnvStore } from '@/store/EnvironmentStore';
248276
import { useNavigationStore } from '@/store/NavigationStore';
249277
import { isEmptyString } from '@/utils/StringUtils';
@@ -255,11 +283,13 @@
255283
const { fetchAasSmListById } = useAASHandling();
256284
const { fetchSmList } = useSMHandling();
257285
const { nameToDisplay, descriptionToDisplay } = useReferableUtils();
286+
const { pasteElement } = useClipboardUtil();
258287
259288
// Stores
260289
const navigationStore = useNavigationStore();
261290
const aasStore = useAASStore();
262291
const envStore = useEnvStore();
292+
const clipboardStore = useClipboardStore();
263293
264294
// Data
265295
const submodelTree = ref([] as Array<any>) as Ref<Array<any>>; // Submodel Treeview Data
@@ -301,6 +331,7 @@
301331
const singleAas = computed(() => envStore.getSingleAas); // Get the single AAS state from the Store
302332
const editorMode = computed(() => ['AASEditor', 'SMEditor'].includes(route.name as string));
303333
const triggerTreeviewReload = computed(() => navigationStore.getTriggerTreeviewReload); // Reload the Treeview
334+
const clipboardElementContentType = computed(() => clipboardStore.getClipboardElementModelType()); // Get the Clipboard Element Content Type
304335
305336
// Watchers
306337
watch(

0 commit comments

Comments
 (0)