Commit dac3bc1a authored by El Mghazli Yacine's avatar El Mghazli Yacine

ilogs

parent 32e49924
......@@ -10,20 +10,37 @@ export interface IVariable {
modifiable: boolean; //set command ?
}
// export enum ILogLvl {
// error="error",
// warn="warn",
// analysis="analysis",
// info="info",
// debug="debug",
// trace="trace"
// }
// export interface ICmdResp {
// component: string;
// level: ILogLvl;
// enabled: boolean;
// output: string;
// }
export enum ILogLvl {
error = "error",
warn = "warn",
analysis = "analysis",
info = "info",
debug = "debug",
trace = "trace"
}
export enum ILogOutput {
stdout = "stdout",
telnet = "telnet",
web = "web",
file = "/tmp/<component>.log",
}
export interface ILog {
component: string;
level: ILogLvl;
output: ILogOutput;
enabled: boolean;
}
export interface ILog2 {
enabled: boolean;
}
export interface IResp {
display: string[],
logs?: ILog[]
}
export enum IArgType {
boolean = "boolean",
......@@ -50,7 +67,7 @@ export class CommandsApi {
public readCommands$ = (moduleName?: string) => this.httpClient.get<ICommand[]>(environment.backend + route + '/' + (moduleName ? ('/' + moduleName) : "") + '/commands/');
public runCommand$ = (command: ICommand, moduleName: string) => this.httpClient.post<string[]>(environment.backend + route + '/' + moduleName + '/commands/', command);
public runCommand$ = (command: ICommand, moduleName: string) => this.httpClient.post<IResp>(environment.backend + route + '/' + moduleName + '/commands/', command);
public setVariable$ = (variable: IVariable, moduleName?: string) => this.httpClient.post<string[]>(environment.backend + route + (moduleName ? ('/' + moduleName) : "") + '/variables/', variable);
......
......@@ -81,7 +81,8 @@ export class CommandsComponent {
onCmdSubmit(control: CmdCtrl) {
this.commandsApi.runCommand$(control.api(), `${this.selectedModule!.nameFC.value}`).pipe(
map(array => this.success('runCommand ' + control.nameFC.value + ' OK', array[0]))
// map(array => this.success('runCommand ' + control.nameFC.value + ' OK', "&nbsp" + array.join("&nbsp</p><p>&nbsp") + "&nbsp"))
map(resp => this.success('runCommand ' + control.nameFC.value + ' OK', resp.display!.join("</p><p>")))
).subscribe();
}
......
<div fxLayout="column" fxLayoutAlign="center center">
<h3>{{ data.title }}</h3>
<p>{{ data.body }}</p>
<pre [innerHTML]="data.body"></pre>
</div>
\ No newline at end of file
......@@ -22,7 +22,7 @@ export class DialogService {
this.isDialogOpen = true;
const dialogRef = this._dialog.open(ErrorDialogComponent, {
width: '300px',
width: '900px',
data,
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment