-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add markdown component to verify single Task
- Loading branch information
Showing
7 changed files
with
215 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...rkdown/single-task-verification-markdown/single-task-verification-markdown.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<details | ||
[ngClass]="task?.success ? 'greenBorder' : 'redBorder'" | ||
(toggle)="detailsOpen = !detailsOpen" | ||
> | ||
<summary class="flex-container"> | ||
<div> | ||
<cds-icon | ||
shape="angle" | ||
[ngClass]="detailsOpen ? 'down' : 'sideways'" | ||
></cds-icon> | ||
Verify: {{ taskName }} on {{ target }} | ||
</div> | ||
<div class="label-container"> | ||
<button id=refreshButton (click)="elementClicked()" class="label label-info"><clr-icon shape="sync"></clr-icon></button> | ||
<div *ngIf="task?.success" class="label label-success"><clr-icon shape="check"></clr-icon></div> | ||
<div *ngIf="!task?.success" class="label label-danger"><clr-icon shape="times"></clr-icon></div> | ||
</div> | ||
</summary> | ||
|
||
<ul class="list-group" *ngIf="task"> | ||
<li class="list-group-item"> | ||
<p>Description: {{ task.description }}</p> | ||
<p>Command: {{ task.command }}</p> | ||
</li> | ||
<li class="list-group-item"> | ||
<p>Expected Output: {{ task.expected_output_value }}</p> | ||
<p>Actual Output: {{ task.actual_output_value }}</p> | ||
</li> | ||
<li class="list-group-item"> | ||
<p>Expected Returncode: {{ task.expected_return_code }}</p> | ||
<p>Actual Returncode: {{ task.actual_return_code }}</p> | ||
</li> | ||
<li class="list-group-item"> | ||
<p>Success: {{ task.success }}</p> | ||
</li> | ||
</ul> | ||
</details> | ||
|
||
|
78 changes: 78 additions & 0 deletions
78
...rkdown/single-task-verification-markdown/single-task-verification-markdown.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.task-verification-box { | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
border: 0; | ||
border-left: 3px solid; | ||
border-radius: 5px; | ||
} | ||
|
||
.down { | ||
transform: rotate(180deg); | ||
} | ||
|
||
.sideways { | ||
transform: rotate(90deg); | ||
} | ||
|
||
.label { | ||
margin-bottom: 7%; | ||
} | ||
|
||
.flex-container { | ||
display: flex !important; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
} | ||
|
||
.label-container { | ||
display: flex !important; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
width: fit-content; | ||
} | ||
|
||
.label { | ||
margin:auto; | ||
margin-left: 4px; | ||
} | ||
.label:hover { | ||
cursor: default; | ||
} | ||
|
||
#refreshButton:hover { | ||
cursor: pointer !important; | ||
} | ||
|
||
.list-group { | ||
width: 100%; | ||
} | ||
|
||
.greenBorder { | ||
border-left-color: var(--clr-color-success-500, green) !important; | ||
} | ||
|
||
.redBorder { | ||
border-left-color: #f0ad4e !important; | ||
} | ||
|
||
|
||
details { | ||
border: 1px solid var(--clr-color-neutral-400, #cccccc); | ||
border-left: 3px solid; | ||
border-radius: 4px; | ||
padding: 0.5em 0.5em 0; | ||
&[open] { | ||
padding: 0.5em; | ||
summary { | ||
margin-bottom: 0.5em; | ||
} | ||
} | ||
} | ||
|
||
summary { | ||
font-weight: bold; | ||
margin: -0.5em -0.5em 0; | ||
padding: 0.5em; | ||
display: list-item; | ||
cursor: pointer; | ||
} |
35 changes: 35 additions & 0 deletions
35
...markdown/single-task-verification-markdown/single-task-verification-markdown.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { TaskCommand } from 'src/app/scenario/taskVerification.type'; | ||
import { VerificationService } from 'src/app/services/verification.service'; | ||
|
||
@Component({ | ||
selector: 'app-single-task-verification-markdown', | ||
templateUrl: './single-task-verification-markdown.component.html', | ||
styleUrls: ['./single-task-verification-markdown.component.scss'] | ||
}) | ||
export class SingleTaskVerificationMarkdownComponent implements OnInit { | ||
|
||
@Input() target: string; | ||
@Input() message: string; | ||
@Input() taskName: string; | ||
|
||
detailsOpen = false | ||
|
||
|
||
task?: TaskCommand | ||
|
||
constructor( | ||
private verificationService: VerificationService | ||
) { } | ||
|
||
ngOnInit(): void { | ||
this.verificationService.currentVerifications.subscribe((verificationMap) => { | ||
let temp = verificationMap.get(this.target) | ||
this.task = temp?.task_command?.filter(taskCommand => taskCommand.name == this.taskName)[0] | ||
}) | ||
} | ||
|
||
elementClicked() { | ||
this.verificationService.verifyTask(this.target, this.taskName)?.subscribe() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
export type TaskVerification = { | ||
vm_id: string, | ||
vm_name: string, | ||
task_command?: TaskCommand[] | ||
task_command_output?: TaskCommand[] | ||
|
||
|
||
type BaseTaskVerification = { | ||
vm_id: string; | ||
vm_name: string; | ||
}; | ||
|
||
export type TaskVerification = BaseTaskVerification & { | ||
task_command: TaskCommand[]; | ||
}; | ||
|
||
export type TaskVerificationResponse = BaseTaskVerification & { | ||
task_command_output?: TaskCommand[]; | ||
} | ||
|
||
export type TaskCommand = { | ||
name: string, | ||
description: string, | ||
command: string, | ||
expected_output_value: string, | ||
expected_return_code: number | ||
actual_output_value?: string, | ||
actual_return_code?: number, | ||
success?: boolean | ||
} | ||
name: string; | ||
description: string; | ||
command: string; | ||
expected_output_value: string; | ||
expected_return_code: number; | ||
actual_output_value?: string; | ||
actual_return_code?: number; | ||
success?: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters