From 5fa395414382bf31df557b3d0a83027262a609d3 Mon Sep 17 00:00:00 2001 From: derek john grech Date: Sat, 5 Sep 2026 09:22:17 +0200 Subject: [PATCH 1/3] adding save messages --- .../content_value/ContentPubsub.vue | 58 ++++++++++++++++++- frontend/src/langs/en-us.json | 1 + frontend/src/langs/es-es.json | 1 + frontend/src/langs/fr-fr.json | 1 + frontend/src/langs/ja-jp.json | 1 + frontend/src/langs/ko-kr.json | 1 + frontend/src/langs/pt-br.json | 1 + frontend/src/langs/ru-ru.json | 1 + frontend/src/langs/tr-tr.json | 1 + frontend/src/langs/zh-cn.json | 1 + frontend/src/langs/zh-tw.json | 1 + 11 files changed, 66 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/content_value/ContentPubsub.vue b/frontend/src/components/content_value/ContentPubsub.vue index 5e36b335..9f7bc083 100644 --- a/frontend/src/components/content_value/ContentPubsub.vue +++ b/frontend/src/components/content_value/ContentPubsub.vue @@ -15,9 +15,10 @@ import Checked from '@/components/icons/Checked.vue' import Bottom from '@/components/icons/Bottom.vue' import IconButton from '@/components/common/IconButton.vue' import EditableTableColumn from '@/components/common/EditableTableColumn.vue' +import Save from '@/components/icons/Save.vue' const themeVars = useThemeVars() - +const datetimeFormat = 'YYYY-MM-DD HH:mm:ss.SSS'; const browserStore = useBrowserStore() const i18n = useI18n() const props = defineProps({ @@ -44,6 +45,10 @@ const publishData = reactive({ const tableRef = ref(null) +const getFormattedDateTime = (timestamp) => { + return dayjs(timestamp).format(datetimeFormat); +} + const columns = computed(() => [ { title: () => i18n.t('pubsub.time'), @@ -52,7 +57,7 @@ const columns = computed(() => [ align: 'center', titleAlign: 'center', render: ({ timestamp }, index) => { - return dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss.SSS') + return getFormattedDateTime(timestamp); }, }, { @@ -181,6 +186,48 @@ const onCleanLog = () => { data.list = [] } +const onSave = async () => { + if (data.list.length == 0) { + $message.error("no messages"); + return; + } + + const headers = Object.keys(data.list[0]) + + const csv = [ + headers.join(','), + ...data.list.map(row => + headers.map(header => `${String(header == 'timestamp' ? getFormattedDateTime(dayjs(row[header])) : row[header] ?? '')}`).join(',') + ) + ].join('\n'); + + try + { + const handle = await window.showSaveFilePicker({ + suggestedName: 'download.csv', + types: [ + { + description: 'Csv file', + accept: { + 'text/plain': ['.csv'] + } + } + ] + }); + + const writable = await handle.createWritable(); + await writable.write(csv); + await writable.close(); + } + catch (error) { + if (error.name === 'AbortError') { + return; + } + throw error; + } + +} + const onPublish = async () => { if (isEmpty(publishData.channel)) { return @@ -245,6 +292,13 @@ const onPublish = async () => { stroke-width="3.5" t-tooltip="monitor.always_show_last" @click="data.autoShowLast = !data.autoShowLast" /> +
Date: Sat, 5 Sep 2026 13:47:58 +0200 Subject: [PATCH 2/3] updated --- frontend/src/components/content_value/ContentPubsub.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/content_value/ContentPubsub.vue b/frontend/src/components/content_value/ContentPubsub.vue index 9f7bc083..4e3b0d21 100644 --- a/frontend/src/components/content_value/ContentPubsub.vue +++ b/frontend/src/components/content_value/ContentPubsub.vue @@ -192,7 +192,7 @@ const onSave = async () => { return; } - const headers = Object.keys(data.list[0]) + const headers = Object.keys(data.list[0]); const csv = [ headers.join(','), From b03fd513744456fab7a89ae908dd4c622b6c89f4 Mon Sep 17 00:00:00 2001 From: djgrech <39998811+djgrech@users.noreply.github.com> Date: Sat, 5 Sep 2026 14:08:26 +0200 Subject: [PATCH 3/3] formatting --- frontend/src/components/content_value/ContentPubsub.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/content_value/ContentPubsub.vue b/frontend/src/components/content_value/ContentPubsub.vue index 4e3b0d21..e71b5d06 100644 --- a/frontend/src/components/content_value/ContentPubsub.vue +++ b/frontend/src/components/content_value/ContentPubsub.vue @@ -225,7 +225,6 @@ const onSave = async () => { } throw error; } - } const onPublish = async () => {