Skip to content

Commit d0e8648

Browse files
committed
feat: add quick copy message action to pub/sub (#397)
1 parent 0eb8978 commit d0e8648

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

frontend/src/components/common/EditableTableColumn.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const emit = defineEmits(['edit', 'delete', 'copy', 'refresh', 'save', 'cancel']
2727
<icon-button v-if="props.canRefresh" :icon="Refresh" :title="$t('interface.reload')" @click="emit('refresh')" />
2828
<icon-button v-if="!props.readonly" :icon="Edit" :title="$t('interface.edit_row')" @click="emit('edit')" />
2929
<n-popconfirm
30+
v-if="props.bindKey"
3031
:negative-text="$t('common.cancel')"
3132
:positive-text="$t('common.confirm')"
3233
@positive-click="emit('delete')">

frontend/src/components/content_value/ContentPubsub.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'
2+
import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'
33
import { debounce, get, isEmpty, size, uniq } from 'lodash'
44
import { useI18n } from 'vue-i18n'
55
import { useThemeVars } from 'naive-ui'
@@ -14,6 +14,8 @@ import { Publish as PublishSend, StartSubscribe, StopSubscribe } from 'wailsjs/g
1414
import Checked from '@/components/icons/Checked.vue'
1515
import Bottom from '@/components/icons/Bottom.vue'
1616
import IconButton from '@/components/common/IconButton.vue'
17+
import EditableTableColumn from '@/components/common/EditableTableColumn.vue'
18+
import copy from 'copy-text-to-clipboard'
1719
1820
const themeVars = useThemeVars()
1921
@@ -97,6 +99,26 @@ const columns = computed(() => [
9799
return value === '' || !!~row.cmd.indexOf(value.toString())
98100
},
99101
},
102+
{
103+
title: () => i18n.t('interface.action'),
104+
key: 'action',
105+
width: 60,
106+
titleAlign: 'center',
107+
align: 'center',
108+
fixed: 'right',
109+
render: (row, index) => {
110+
return h(EditableTableColumn, {
111+
editing: false,
112+
readonly: true,
113+
canRefresh: false,
114+
canDelete: false,
115+
onCopy: async () => {
116+
copy(row.message)
117+
$message.success(i18n.t('interface.copy_succ'))
118+
},
119+
})
120+
},
121+
},
100122
])
101123
102124
onMounted(() => {

0 commit comments

Comments
 (0)