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

ilogs

parent 32e49924
...@@ -10,20 +10,37 @@ export interface IVariable { ...@@ -10,20 +10,37 @@ export interface IVariable {
modifiable: boolean; //set command ? modifiable: boolean; //set command ?
} }
// export enum ILogLvl { export enum ILogLvl {
// error="error", error = "error",
// warn="warn", warn = "warn",
// analysis="analysis", analysis = "analysis",
// info="info", info = "info",
// debug="debug", debug = "debug",
// trace="trace" trace = "trace"
// } }
// export interface ICmdResp {
// component: string; export enum ILogOutput {
// level: ILogLvl; stdout = "stdout",
// enabled: boolean; telnet = "telnet",
// output: string; 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 { export enum IArgType {
boolean = "boolean", boolean = "boolean",
...@@ -50,7 +67,7 @@ export class CommandsApi { ...@@ -50,7 +67,7 @@ export class CommandsApi {
public readCommands$ = (moduleName?: string) => this.httpClient.get<ICommand[]>(environment.backend + route + '/' + (moduleName ? ('/' + moduleName) : "") + '/commands/'); 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); public setVariable$ = (variable: IVariable, moduleName?: string) => this.httpClient.post<string[]>(environment.backend + route + (moduleName ? ('/' + moduleName) : "") + '/variables/', variable);
......
...@@ -81,7 +81,8 @@ export class CommandsComponent { ...@@ -81,7 +81,8 @@ export class CommandsComponent {
onCmdSubmit(control: CmdCtrl) { onCmdSubmit(control: CmdCtrl) {
this.commandsApi.runCommand$(control.api(), `${this.selectedModule!.nameFC.value}`).pipe( 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(); ).subscribe();
} }
......
<div fxLayout="column" fxLayoutAlign="center center"> <div fxLayout="column" fxLayoutAlign="center center">
<h3>{{ data.title }}</h3> <h3>{{ data.title }}</h3>
<p>{{ data.body }}</p> <pre [innerHTML]="data.body"></pre>
</div> </div>
\ No newline at end of file
...@@ -22,7 +22,7 @@ export class DialogService { ...@@ -22,7 +22,7 @@ export class DialogService {
this.isDialogOpen = true; this.isDialogOpen = true;
const dialogRef = this._dialog.open(ErrorDialogComponent, { const dialogRef = this._dialog.open(ErrorDialogComponent, {
width: '300px', width: '900px',
data, 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