mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:31:33 +00:00
Remove unnecessary parentheses and refactor bot messages
This commit is contained in:
parent
6e22e7efe9
commit
0b65b9f5f3
@ -57,7 +57,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
initCommandHandling() {
|
||||
this.webSocketService.observeKey<WebSocketMessage>('dashboard').subscribe((message) => {
|
||||
this.webSocketService.observeKey<WebSocketMessage>('dashboard').subscribe(message => {
|
||||
this.command_handlers[message.key](message);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
|
@ -73,7 +73,7 @@ export class IdeComponent implements OnInit {
|
||||
}
|
||||
|
||||
subscribeWS() {
|
||||
this.webSocketService.observeKey<WebSocketMessage>('ide').subscribe((message) => {
|
||||
this.webSocketService.observeKey<WebSocketMessage>('ide').subscribe(message => {
|
||||
this.command_handlers[message.key](message);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
@ -89,7 +89,7 @@ export class IdeComponent implements OnInit {
|
||||
this.processManagerService.init();
|
||||
this.processManagerService.subscribeCallback(
|
||||
config.ide.deployProcessName,
|
||||
(message) => {
|
||||
message => {
|
||||
this.deploymentNotificationService.deploying.next(false);
|
||||
this.newLogs.emit({
|
||||
stdout: message.stdout,
|
||||
@ -100,7 +100,7 @@ export class IdeComponent implements OnInit {
|
||||
|
||||
this.processManagerService.subscribeSuccessCallback(
|
||||
config.ide.deployProcessName,
|
||||
(message) => this.setDeployButtonState(DeployButtonState.DEPLOYED)
|
||||
message => this.setDeployButtonState(DeployButtonState.DEPLOYED)
|
||||
);
|
||||
|
||||
this.processManagerService.subscribeErrorCallback(
|
||||
|
@ -23,6 +23,12 @@ export class MessagesComponent implements OnInit {
|
||||
messages: MessageData[] = [];
|
||||
messageQueueAttender: MessageQueueAttender;
|
||||
|
||||
command_handlers = {
|
||||
'message.queue': this.handleQueueMessage.bind(this),
|
||||
'message.config': this.configureMessages.bind(this),
|
||||
'message.send': () => {}
|
||||
};
|
||||
|
||||
constructor(
|
||||
private markdownService: MarkdownService,
|
||||
private websocketService: WebSocketService,
|
||||
@ -33,7 +39,7 @@ export class MessagesComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.newMessage.subscribe(
|
||||
(message) => {
|
||||
message => {
|
||||
this.writeMessage(message);
|
||||
this.newMessageEvent.emit();
|
||||
});
|
||||
@ -43,13 +49,10 @@ export class MessagesComponent implements OnInit {
|
||||
|
||||
this.websocketService.connect();
|
||||
this.websocketService.observeKey<Message>('message.send').subscribe(
|
||||
(message) => this.newMessage.next(message)
|
||||
message => this.newMessage.next(message)
|
||||
);
|
||||
this.websocketService.observeKey<MessageQueue>('message.queue').subscribe(
|
||||
(message) => this.handleQueueMessage(message)
|
||||
);
|
||||
this.websocketService.observeKey<MessageConfig>('message.config').subscribe(
|
||||
(message) => this.configureMessages(message)
|
||||
this.websocketService.observeKey<MessageQueue>('message').subscribe(
|
||||
message => this.command_handlers[message.key](message)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ export class FSMUpdateService {
|
||||
constructor(private websocketService: WebSocketService) {}
|
||||
|
||||
public init(): void {
|
||||
this.websocketService.observeKey<FSMUpdateMessage>('fsm.update').subscribe((message) => {
|
||||
this.websocketService.observeKey<FSMUpdateMessage>('fsm.update').subscribe(message => {
|
||||
this.current_state = message.current_state;
|
||||
this.valid_transitions = message.valid_transitions;
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ export class ProcessLogService {
|
||||
constructor(private webSocketService: WebSocketService) {
|
||||
this.webSocketService.connect();
|
||||
this.webSocketService.observeKey<ProcessLogMessage>('process.log.new').subscribe(
|
||||
(message) => this.newLogsHandler(message)
|
||||
message => this.newLogsHandler(message)
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user