Move botname to the title

This commit is contained in:
Matthias 2023-09-23 16:55:47 +02:00
parent e6ccb4ebfe
commit 171c608ea8
2 changed files with 6 additions and 12 deletions

View File

@ -1,8 +1,8 @@
import { AlertSeverity } from '@/types/alertTypes'; import { AlertSeverity } from '@/types/alertTypes';
import { useToast } from 'bootstrap-vue-next'; 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(); const { show } = useToast();
show(message, { title: 'Msg', variant: severity }); show(message, { title: `${bot ? 'Bot: ' + bot : 'Notification'}`, variant: severity });
} }

View File

@ -8,25 +8,19 @@ export function showNotification(msg: FTWsMessage, botname: string) {
switch (msg.type) { switch (msg.type) {
case FtWsMessageTypes.entryFill: case FtWsMessageTypes.entryFill:
console.log('entryFill', msg); 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; break;
case FtWsMessageTypes.exitFill: case FtWsMessageTypes.exitFill:
console.log('exitFill', msg); 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; break;
case FtWsMessageTypes.exitCancel: case FtWsMessageTypes.exitCancel:
console.log('exitCancel', msg); console.log('exitCancel', msg);
showAlert( showAlert(`Exit order cancelled for ${msg.pair} due to ${msg.reason}`, 'warning', botname);
`${botname}: Exit order cancelled for ${msg.pair} due to ${msg.reason}`,
'warning',
);
break; break;
case FtWsMessageTypes.entryCancel: case FtWsMessageTypes.entryCancel:
console.log('entryCancel', msg); console.log('entryCancel', msg);
showAlert( showAlert(`Entry order cancelled for ${msg.pair} due to ${msg.reason}`, 'warning', botname);
`${botname}: Entry order cancelled for ${msg.pair} due to ${msg.reason}`,
'warning',
);
break; break;
} }
} else { } else {