|
|
@@ -9,17 +9,17 @@ import { FormControl } from '@angular/forms'; |
|
|
|
}) |
|
|
|
export class AppComponent { |
|
|
|
title = 'TBConsoleClient'; |
|
|
|
|
|
|
|
logMessages = ''; |
|
|
|
|
|
|
|
commandControl: FormControl = new FormControl(''); |
|
|
|
commands: { command: string, line: string }[] = []; |
|
|
|
|
|
|
|
constructor(private http: HttpClient) { |
|
|
|
this.getCommandList(); |
|
|
|
} |
|
|
|
|
|
|
|
async sendCommand() { |
|
|
|
try { |
|
|
|
const res = await this.http.post('http://localhost:8019/', this.commandControl.value, {responseType: 'text'}).toPromise(); |
|
|
|
const res = await this.http.post('http://localhost:8019/command', this.commandControl.value, {responseType: 'text'}).toPromise(); |
|
|
|
this.logMessages += res + "\n"; |
|
|
|
} catch (e) { |
|
|
|
if (e.status == 0) |
|
|
@@ -28,4 +28,9 @@ export class AppComponent { |
|
|
|
this.logMessages += e.message + "\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async getCommandList() { |
|
|
|
const res = await this.http.post('http://localhost:8019/commands', '', {responseType: 'text'}).toPromise(); |
|
|
|
this.commands = res.split('\n').map(cmd => ({command: cmd.split(' - ')[0], line: cmd})); |
|
|
|
} |
|
|
|
} |