Skip to content
Snippets Groups Projects
Commit 7bff18b4 authored by Lukáš Majdan's avatar Lukáš Majdan
Browse files

Forbidden commands integration

parent 8e53bd14
No related branches found
No related tags found
No related merge requests found
15.1.5 Update boolean directive of command.
15.1.4 Fix behavior subject for forbidden commands. 15.1.4 Fix behavior subject for forbidden commands.
15.1.3 Change background color for forbidden commands. 15.1.3 Change background color for forbidden commands.
15.1.2 Update detected forbidden command model. 15.1.2 Update detected forbidden command model.
......
...@@ -29,7 +29,14 @@ ...@@ -29,7 +29,14 @@
{{command.trainingTime}} {{command.trainingTime}}
</mgl-timeline-entry-side> </mgl-timeline-entry-side>
<mgl-timeline-entry-header> <mgl-timeline-entry-header>
<div>{{commandPrefix(command)}}{{command.cmd}} {{command.options}}</div> <ng-container *ngIf="checkCommandColor(command) | async as isCommandForbidden">
<div *ngIf="isCommandForbidden" [style.color]="'red'">
[x] {{command.cmd}} {{command.options}}
</div>
<div *ngIf="!isCommandForbidden">
{{command.cmd}} {{command.options}}
</div>
</ng-container>
</mgl-timeline-entry-header> </mgl-timeline-entry-header>
<mgl-timeline-entry-content [expandAnimationTiming]="'200ms ease'" <mgl-timeline-entry-content [expandAnimationTiming]="'200ms ease'"
......
...@@ -59,16 +59,15 @@ export class TimelineComponent implements OnInit { ...@@ -59,16 +59,15 @@ export class TimelineComponent implements OnInit {
} }
} }
commandPrefix(command: Command): Observable<string> { checkCommandColor(command: Command): Observable<boolean> {
if (!this.isForbidden) { if (!this.isForbidden) {
return of(''); of(false);
} }
return this.forbiddenCommands$.pipe( return this.forbiddenCommands$.pipe(
map((forbiddenCommands) => { map((forbiddenCommands) => {
const isForbidden = forbiddenCommands.some((forbiddenCommand) => { return forbiddenCommands.some((forbiddenCommand) => {
return command.cmd === forbiddenCommand.command; return command.cmd === forbiddenCommand.command;
}); });
return isForbidden ? '[x] ' : '';
}) })
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment