From 171c608ea8d034e414d50665bd7e2efa5bc6b4f0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 23 Sep 2023 16:55:47 +0200 Subject: [PATCH] Move botname to the title --- src/shared/alerts.ts | 4 ++-- src/shared/notifications.ts | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/shared/alerts.ts b/src/shared/alerts.ts index 1c836d25..478cb0de 100644 --- a/src/shared/alerts.ts +++ b/src/shared/alerts.ts @@ -1,8 +1,8 @@ import { AlertSeverity } from '@/types/alertTypes'; import { useToast } from 'bootstrap-vue-next'; -export function showAlert(message: string, severity: AlertSeverity = 'warning') { +export function showAlert(message: string, severity: AlertSeverity = 'warning', bot: string = '') { const { show } = useToast(); - show(message, { title: 'Msg', variant: severity }); + show(message, { title: `${bot ? 'Bot: ' + bot : 'Notification'}`, variant: severity }); } diff --git a/src/shared/notifications.ts b/src/shared/notifications.ts index fd78c41c..33ef768e 100644 --- a/src/shared/notifications.ts +++ b/src/shared/notifications.ts @@ -8,25 +8,19 @@ export function showNotification(msg: FTWsMessage, botname: string) { switch (msg.type) { case FtWsMessageTypes.entryFill: console.log('entryFill', msg); - showAlert(`${botname}: Entry fill for ${msg.pair} at ${msg.open_rate}`, 'success'); + showAlert(`Entry fill for ${msg.pair} at ${msg.open_rate}`, 'success', botname); break; case FtWsMessageTypes.exitFill: console.log('exitFill', msg); - showAlert(`${botname}: Exit fill for ${msg.pair} at ${msg.open_rate}`, 'success'); + showAlert(`Exit fill for ${msg.pair} at ${msg.open_rate}`, 'success', botname); break; case FtWsMessageTypes.exitCancel: console.log('exitCancel', msg); - showAlert( - `${botname}: Exit order cancelled for ${msg.pair} due to ${msg.reason}`, - 'warning', - ); + showAlert(`Exit order cancelled for ${msg.pair} due to ${msg.reason}`, 'warning', botname); break; case FtWsMessageTypes.entryCancel: console.log('entryCancel', msg); - showAlert( - `${botname}: Entry order cancelled for ${msg.pair} due to ${msg.reason}`, - 'warning', - ); + showAlert(`Entry order cancelled for ${msg.pair} due to ${msg.reason}`, 'warning', botname); break; } } else {