diff --git a/src/app/course/course.ts b/src/app/course/course.ts index dcd1d728..3c053256 100644 --- a/src/app/course/course.ts +++ b/src/app/course/course.ts @@ -6,4 +6,5 @@ export class Course { // These are Scenario IDs scenarios: string[]; keep_vm: boolean; + virtualmachines: Map[]; } diff --git a/src/app/home.component.html b/src/app/home.component.html index 79daa67e..4c8fce80 100644 --- a/src/app/home.component.html +++ b/src/app/home.component.html @@ -43,6 +43,14 @@

Active session

+
+
+

Add AccessCode

+ Add AccessCodes to your account by clicking on your username on the top + right. +
+
+

{{ ctx.scheduledEvent.name }}

@@ -65,13 +73,7 @@

Select a scenario

-
-
-

Add AccessCode

- Add AccessCodes to your account by clicking on your username on the top - right. -
- +
-
- -

{{ c.name | atob }}

-
-

{{ c.description | atob }}

+
+
+ +

{{ c.name | atob }}

+
+

{{ c.description | atob }}

-
- -
- -
-
- -
-

No scenarios found.

-
-
-
-
+
+ +
+ +
+
+ +
+

No scenarios found.

+
+
+
+ +
diff --git a/src/app/scenario/scenario.component.ts b/src/app/scenario/scenario.component.ts index f83aafe5..0af54fa0 100644 --- a/src/app/scenario/scenario.component.ts +++ b/src/app/scenario/scenario.component.ts @@ -7,6 +7,9 @@ import { ScenarioService } from '../services/scenario.service'; import { SessionService } from '../services/session.service'; import { VMClaimService } from '../services/vmclaim.service'; import { VMClaim } from '../VMClaim'; +import { Router } from '@angular/router'; +import { CourseService } from '../services/course.service'; +import { Course } from '../course/course'; @Component({ selector: 'app-scenario', @@ -25,14 +28,17 @@ export class ScenarioComponent implements OnInit { public scenarioModal = new EventEmitter(); public scenario: Scenario = new Scenario(); + public course: Course = new Course(); public session: Session = new Session(); public vmclaims: VMClaim[] = []; public error = false; constructor( private scenarioService: ScenarioService, + private courseService: CourseService, private ssService: SessionService, private vmClaimService: VMClaimService, + private router: Router, ) {} onReady(vmc: VMClaim) { @@ -58,6 +64,26 @@ export class ScenarioComponent implements OnInit { this.scenario = s; }); + if (this.courseid) { + this.courseService.get(this.courseid).subscribe((c: Course) => { + this.course = c; + }); + } + + // Cotent-only scenario or courses do not require VMclaims to be fetched and we can navigate directly to the content + if ( + this.scenario.virtualmachines.length == 0 || + (this.courseid && this.course.virtualmachines.length == 0) + ) { + this.showScenarioModal = false; + this.ssService + .new(this.scenarioid, this.courseid, this.accessCode) + .subscribe((s: Session) => { + this.router.navigateByUrl('/app/session/' + s.id + '/steps/0'); + }); + return; + } + this.ssService .new(this.scenarioid, this.courseid, this.accessCode) .pipe( diff --git a/src/app/scenario/step.component.html b/src/app/scenario/step.component.html index cdc6bf07..ab8c449c 100644 --- a/src/app/scenario/step.component.html +++ b/src/app/scenario/step.component.html @@ -15,12 +15,13 @@

{{ scenario.name | atob }}

[class.btn-success-outline]="!isLastStepActive" [class.btn-success]="isLastStepActive" (click)="goFinish()" + *ngIf="!isContentOnly" > Finish - + @@ -88,7 +89,7 @@

- +
@@ -235,7 +236,7 @@