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 { 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 });
}

View File

@ -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 {