-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates separate component for SpecificAssetIds
- Loading branch information
Showing
2 changed files
with
89 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
aas-web-ui/src/components/UIComponents/SpecificAssetIds.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
<v-container fluid class="pa-0"> | ||
<v-list-item v-if="Array.isArray(assetObject?.specificAssetIds) && assetObject?.specificAssetIds.length > 0"> | ||
<template #title> | ||
<div class="mt-2 mb-2 text-subtitle-2"> | ||
{{ 'Specific Asset IDs:' }} | ||
</div> | ||
</template> | ||
<v-list-item-subtitle v-for="(specificAssetId, index) in assetObject.specificAssetIds" :key="index"> | ||
<div class="px-2"> | ||
<v-list-item-title> | ||
<v-hover v-slot="{ isHovering, props }"> | ||
<div | ||
v-bind="props" | ||
:class="isHovering ? 'cursor-pointer' : ''" | ||
class="text-caption" | ||
@click="copyToClipboard(specificAssetId.value, specificAssetId.name)"> | ||
<span class="text-subtitle-2">{{ specificAssetId.name + ': ' }}</span> | ||
<v-icon v-if="isHovering" color="subtitleText" size="x-small" class="mr-1" | ||
>mdi-clipboard-file-outline</v-icon | ||
> | ||
<span>{{ specificAssetId.value }}</span> | ||
</div> | ||
</v-hover> | ||
</v-list-item-title> | ||
<v-list-item-subtitle> | ||
<SemanticID | ||
v-if=" | ||
Array.isArray(specificAssetId?.semanticId?.keys) && | ||
specificAssetId.semanticId.keys.length > 0 | ||
" | ||
:semantic-id-object="specificAssetId.semanticId" | ||
:semantic-title=" | ||
specificAssetId.semanticId.keys.length > 0 ? 'Semantic IDs' : 'Semantic ID:' | ||
" | ||
:small="true" | ||
class="mt-n3"></SemanticID> | ||
</v-list-item-subtitle> | ||
</div> | ||
<v-divider v-if="index < assetObject.specificAssetIds.length - 1" class="my-2"></v-divider> | ||
</v-list-item-subtitle> | ||
</v-list-item> | ||
</v-container> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import SemanticID from '@/components/UIComponents/SemanticID.vue'; | ||
import { useNavigationStore } from '@/store/NavigationStore'; | ||
export default defineComponent({ | ||
name: 'SpecificAssetIds', | ||
components: { | ||
SemanticID, | ||
}, | ||
props: ['assetObject'], | ||
setup() { | ||
const navigationStore = useNavigationStore(); | ||
return { | ||
navigationStore, // NavigationStore Object | ||
}; | ||
}, | ||
methods: { | ||
// Function to copy the id to the clipboard | ||
copyToClipboard(value: string, name: string) { | ||
if (!value || !value) return; | ||
// console.log('Copy ID to Clipboard: ', this.identificationObject.id); | ||
// copy the path to the clipboard | ||
navigator.clipboard.writeText(value); | ||
// open Snackbar to inform the user that the path was copied to the clipboard | ||
this.navigationStore.dispatchSnackbar({ | ||
status: true, | ||
timeout: 2000, | ||
color: 'success', | ||
btnColor: 'buttonText', | ||
text: (name ? name : value) + ' copied to Clipboard.', | ||
}); | ||
}, | ||
}, | ||
}); | ||
</script> |