Skip to content

Commit 5cb48b9

Browse files
committed
feat(Embedded Management): Exposing the assistant ID for three-party docking
1 parent bf43221 commit 5cb48b9

File tree

1 file changed

+45
-6
lines changed
  • frontend/src/views/system/embedded

1 file changed

+45
-6
lines changed

frontend/src/views/system/embedded/Card.vue

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<script lang="ts" setup>
22
import delIcon from '@/assets/svg/icon_delete.svg'
3+
import icon_copy_outlined from '@/assets/embedded/icon_copy_outlined.svg'
34
import icon_more_outlined from '@/assets/svg/icon_more_outlined.svg'
45
import icon_embedded_outlined from '@/assets/embedded/icon_embedded_outlined.svg'
56
import IconOpeEdit from '@/assets/svg/icon_edit_outlined.svg'
67
import Lock from '@/assets/embedded/LOGO-sql.png'
78
import { useAppearanceStoreWithOut } from '@/stores/appearance'
89
import LOGO from '@/assets/svg/logo-custom_small.svg'
910
import { ref, unref, computed } from 'vue'
11+
import { useClipboard } from '@vueuse/core'
12+
import { useI18n } from 'vue-i18n'
1013
import { ClickOutside as vClickOutside } from 'element-plus-secondary'
1114
import icon_style_set_outlined from '@/assets/svg/icon_style-set_outlined.svg'
1215
@@ -26,7 +29,8 @@ const props = withDefaults(
2629
logo: '',
2730
}
2831
)
29-
32+
const { copy } = useClipboard({ legacy: true })
33+
const { t } = useI18n()
3034
const emits = defineEmits(['edit', 'del', 'embedded', 'ui'])
3135
const appearanceStore = useAppearanceStoreWithOut()
3236
@@ -45,7 +49,15 @@ const handleDel = () => {
4549
const handleEmbedded = () => {
4650
emits('embedded')
4751
}
48-
52+
const copyCode = () => {
53+
copy(props.id)
54+
.then(function () {
55+
ElMessage.success(t('embedded.copy_successful'))
56+
})
57+
.catch(function () {
58+
ElMessage.error(t('embedded.copy_successful'))
59+
})
60+
}
4961
const buttonRef = ref()
5062
const popoverRef = ref()
5163
const onClickOutside = () => {
@@ -66,7 +78,17 @@ const pageLogo = computed(() => {
6678
<LOGO></LOGO>
6779
</el-icon>
6880
<img v-else :src="Lock" width="32px" height="32px" />
69-
<span class="name ellipsis" :title="name">{{ name }}</span>
81+
<div class="id-name">
82+
<span class="name ellipsis" :title="name">{{ name }}</span>
83+
<div class="id-copy">
84+
<span class="id ellipsis" :title="id">{{ id }}</span>
85+
<el-tooltip :offset="12" effect="dark" :content="t('datasource.copy')" placement="top">
86+
<el-icon style="cursor: pointer" size="16" @click="copyCode">
87+
<icon_copy_outlined></icon_copy_outlined>
88+
</el-icon>
89+
</el-tooltip>
90+
</div>
91+
</div>
7092
<span class="default" :class="isBase && 'is-base'">{{
7193
isBase ? $t('embedded.basic_application') : $t('embedded.advanced_application')
7294
}}</span>
@@ -120,7 +142,7 @@ const pageLogo = computed(() => {
120142
<style lang="less" scoped>
121143
.card {
122144
width: 100%;
123-
height: 168px;
145+
height: 180px;
124146
border: 1px solid #dee0e3;
125147
padding: 16px;
126148
border-radius: 12px;
@@ -135,12 +157,29 @@ const pageLogo = computed(() => {
135157
display: flex;
136158
align-items: center;
137159
margin-bottom: 12px;
138-
.name {
160+
.id-name {
139161
margin-left: 12px;
162+
max-width: calc(100% - 115px);
163+
display: flex;
164+
flex-direction: column;
165+
166+
.id-copy {
167+
display: flex;
168+
align-items: center;
169+
.id {
170+
font-weight: 400;
171+
font-size: 12px;
172+
line-height: 20px;
173+
color: #646a73;
174+
margin-right: 8px;
175+
}
176+
}
177+
}
178+
.name {
140179
font-weight: 500;
141180
font-size: 16px;
142181
line-height: 24px;
143-
max-width: calc(100% - 115px);
182+
max-width: 100%;
144183
}
145184
146185
.default {

0 commit comments

Comments
 (0)