diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index e8f4bf31..09ce80b4 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -17,93 +17,85 @@ import { StepComponent } from './step/step-component/step.component';
import { TerminalComponent } from './step/terminal/terminal.component';
import { RolesComponent } from './configuration/roles/roles/roles.component';
import { SessionStatisticsComponent } from './session-statistics/session-statistics.component';
-import {SettingsComponent} from './configuration/settings/settings.component';
+import { SettingsComponent } from './configuration/settings/settings.component';
import { DashboardDetailsComponent } from './dashboards/dashboard-details/dashboard-details.component';
const routes: Routes = [
- {path: '', redirectTo: '/home', pathMatch: 'full'},
- {path: 'login', component: LoginComponent},
+ { path: '', redirectTo: '/home', pathMatch: 'full' },
+ { path: 'login', component: LoginComponent },
{
path: 'home',
component: HomeComponent,
- canActivate: [
- AuthGuard
- ],
+ canActivate: [AuthGuard],
children: [
{
path: 'statistics/sessions',
- component: SessionStatisticsComponent
- }
- ]
+ component: SessionStatisticsComponent,
+ },
+ ],
},
{
path: 'dashboards',
component: DashboardsComponent,
- canActivate: [
- AuthGuard
- ],
+ canActivate: [AuthGuard],
children: [
{
path: 'event/:id',
- component: DashboardDetailsComponent
- }
- ]
+ component: DashboardDetailsComponent,
+ },
+ ],
},
{
path: 'events',
component: EventComponent,
- canActivate: [
- AuthGuard
- ]
+ canActivate: [AuthGuard],
},
{
path: 'content',
component: ContentComponent,
- canActivate: [
- AuthGuard
- ],
+ canActivate: [AuthGuard],
children: [
{
path: 'scenarios',
- component: ScenarioComponent
+ component: ScenarioComponent,
},
{
path: 'courses',
- component: CourseComponent
- }
- ]
+ component: CourseComponent,
+ },
+ ],
},
{
path: 'users',
component: UserComponent,
- canActivate: [
- AuthGuard
- ]
+ canActivate: [AuthGuard],
},
{
path: 'configuration',
component: ConfigurationComponent,
- canActivate: [
- AuthGuard
- ],
+ canActivate: [AuthGuard],
children: [
+ {
+ path: 'settings/:scope',
+ component: SettingsComponent,
+ },
{
path: 'settings',
- component: SettingsComponent
+ component: SettingsComponent,
},
{
path: 'environments',
- component: EnvironmentsComponent
+ component: EnvironmentsComponent,
},
{
path: 'vmtemplates',
- component: VmtemplatesComponent
+ component: VmtemplatesComponent,
},
{
path: 'roles',
- component: RolesComponent
- }
- ]
+ component: RolesComponent,
+ },
+ ],
},
{
path: 'session/:session/steps/:step',
@@ -113,14 +105,12 @@ const routes: Routes = [
{
path: 'scenario/:scenario/printable',
component: PrintableComponent,
- canActivate: [
- AuthGuard
- ]
- }
+ canActivate: [AuthGuard],
+ },
];
@NgModule({
imports: [RouterModule.forRoot(routes, {})],
- exports: [RouterModule]
+ exports: [RouterModule],
})
-export class AppRoutingModule { }
\ No newline at end of file
+export class AppRoutingModule {}
diff --git a/src/app/configuration/configuration.component.html b/src/app/configuration/configuration.component.html
index 453ff1d6..d6409d1b 100644
--- a/src/app/configuration/configuration.component.html
+++ b/src/app/configuration/configuration.component.html
@@ -2,13 +2,6 @@
- Settings
Roles
+
+
+
+ Settings
+
+
+ {{ scope.displayName }}
+
+
+
diff --git a/src/app/configuration/configuration.component.ts b/src/app/configuration/configuration.component.ts
index 3bf3d97e..0dfcd654 100644
--- a/src/app/configuration/configuration.component.ts
+++ b/src/app/configuration/configuration.component.ts
@@ -1,6 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { RbacService } from '../data/rbac.service';
import { Router } from '@angular/router';
+import {
+ PreparedScope,
+ TypedSettingsService,
+} from '../data/typedSettings.service';
@Component({
selector: 'app-configuration',
@@ -12,7 +16,15 @@ export class ConfigurationComponent implements OnInit {
public listVMTemplates = false;
public listRoles = false;
- constructor(private rbacService: RbacService, private router: Router) {}
+ public scopes: PreparedScope[] = [];
+ public scopesLoading: boolean = true;
+ public expandedSettingsGroup = true;
+
+ constructor(
+ private rbacService: RbacService,
+ private router: Router,
+ private typedSettingsService: TypedSettingsService
+ ) {}
ngOnInit() {
const authorizationRequests = Promise.all([
@@ -31,15 +43,19 @@ export class ConfigurationComponent implements OnInit {
this.listRoles = permissions[4];
if (this.showSettings) {
- this.router.navigateByUrl(`/configuration/settings`);
- } else if (this.listEnvironments) {
- this.router.navigateByUrl(`/configuration/environments`);
- } else if (this.listVMTemplates) {
- this.router.navigateByUrl(`/configuration/vmtemplates`);
- } else if (this.listRoles) {
- this.router.navigateByUrl(`/configuration/roles`);
+ this.getScopes();
}
}
);
}
+
+ getScopes() {
+ this.scopes = [];
+ this.typedSettingsService.listScopes().subscribe({
+ next: (scopes: PreparedScope[]) => {
+ this.scopes = scopes;
+ this.scopesLoading = false;
+ },
+ });
+ }
}
diff --git a/src/app/configuration/environments/edit-environment/edit-environment.component.ts b/src/app/configuration/environments/edit-environment/edit-environment.component.ts
index 6871e64f..641caabd 100644
--- a/src/app/configuration/environments/edit-environment/edit-environment.component.ts
+++ b/src/app/configuration/environments/edit-environment/edit-environment.component.ts
@@ -81,7 +81,6 @@ export class EditEnvironmentComponent implements OnInit, OnChanges {
.Grants('virtualmachinetemplates', 'list')
.then((allowVMTemplateList: boolean) => {
if (!allowVMTemplateList) {
- console.log('Disallow');
return;
}
vmTemplateService
diff --git a/src/app/configuration/environments/environment-detail/environment-detail.component.ts b/src/app/configuration/environments/environment-detail/environment-detail.component.ts
index 79aae051..8df7f788 100644
--- a/src/app/configuration/environments/environment-detail/environment-detail.component.ts
+++ b/src/app/configuration/environments/environment-detail/environment-detail.component.ts
@@ -29,7 +29,6 @@ export class EnvironmentDetailComponent implements OnInit {
.Grants('virtualmachinetemplates', 'list')
.then((allowVMTemplateList: boolean) => {
if (!allowVMTemplateList) {
- console.log("Disallow")
return;
}
vmTemplateService
diff --git a/src/app/configuration/settings/settings.component.html b/src/app/configuration/settings/settings.component.html
index a74ca3c4..c39684e2 100644
--- a/src/app/configuration/settings/settings.component.html
+++ b/src/app/configuration/settings/settings.component.html
@@ -2,64 +2,34 @@
Settings
- {{ this.selectedScope?.displayName ?? "scope" }}
+ {{
+ this.selectedScope?.displayName ?? "scope"
+ }}
-
-
+
+
+
+
Please wait...
- Scopes are being loaded...
+ Settings are being loaded...
-
-
-
-
-
-
-
- {{ sc.displayName }}
-
-
-
-
-
-
- Please wait...
- Settings are being loaded...
-
-
-
- 0"
- [typedInputs]="settings"
- (syncedInputs)="onFormChange($event)"
- (inputsValid)="changeFormValidity($event)"
- [groupType]="FormGroupType.TABS"
- >
-
- No settings available for scope
- {{ this.selectedScope.displayName }}
.
-
-
+
+ 0"
+ [typedInputs]="settings"
+ (syncedInputs)="onFormChange($event)"
+ (inputsValid)="changeFormValidity($event)"
+ [groupType]="FormGroupType.TABS"
+ >
+
+ No settings available for scope
+ {{ this.selectedScope.displayName }}
.
+
diff --git a/src/app/configuration/settings/settings.component.ts b/src/app/configuration/settings/settings.component.ts
index 7c19fccc..12f3cde9 100644
--- a/src/app/configuration/settings/settings.component.ts
+++ b/src/app/configuration/settings/settings.component.ts
@@ -1,4 +1,4 @@
-import { Component, ViewChild } from '@angular/core';
+import { Component, OnChanges, OnInit, ViewChild } from '@angular/core';
import { TypedInput, FormGroupType } from '../../typed-form/TypedInput';
import {
PreparedScope,
@@ -6,6 +6,7 @@ import {
} from 'src/app/data/typedSettings.service';
import { AlertComponent } from 'src/app/alert/alert.component';
import { ServerResponse } from 'src/app/step/ServerResponse';
+import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
@Component({
selector: 'app-settings',
@@ -27,9 +28,19 @@ export class SettingsComponent {
private alertTime = 2000;
private alertErrorTime = 10000;
+ public alertClosed: boolean = true;
- constructor(public typedSettingsService: TypedSettingsService) {
+ constructor(
+ public typedSettingsService: TypedSettingsService,
+ private route: ActivatedRoute,
+ private router: Router
+ ) {
this.getScopes();
+ this.router.events.subscribe((val) => {
+ if (val instanceof NavigationEnd) {
+ this.testPath();
+ }
+ });
}
onFormChange(data: TypedInput[]) {
@@ -45,10 +56,8 @@ export class SettingsComponent {
if (!this.updatedSettings) {
return;
}
- console.log(this.updatedSettings);
this.typedSettingsService.updateCollection(this.updatedSettings).subscribe({
next: (resp: ServerResponse) => {
- console.log(resp);
this.hasChanges = false;
this.alert.success(
'Settings successfully saved',
@@ -82,11 +91,31 @@ export class SettingsComponent {
next: (scopes: PreparedScope[]) => {
this.scopes = scopes;
this.scopesLoading = false;
- this.setScope(this.scopes[0]);
+ this.testPath();
},
error: (err) => {
this.alert.danger(err.error.message, true, this.alertErrorTime);
},
});
}
+
+ testPath() {
+ const { paramMap } = this.route.snapshot;
+ const scope = paramMap.get('scope')!;
+ if (this.scopes.length < 1) {
+ return;
+ }
+
+ if (scope != '') {
+ const findScope = this.scopes.filter((a) => {
+ return a.name == scope;
+ });
+
+ if (findScope && findScope[0]) {
+ this.setScope(findScope[0]);
+ }
+ } else {
+ this.setScope(this.scopes[0]);
+ }
+ }
}
diff --git a/src/app/content/content.component.ts b/src/app/content/content.component.ts
index 03edfd5b..70dd8144 100644
--- a/src/app/content/content.component.ts
+++ b/src/app/content/content.component.ts
@@ -20,7 +20,7 @@ export class ContentComponent implements OnInit {
ngOnInit(): void {
this.contentNavigation();
}
- ngOnChanges(changes: SimpleChanges): void {
+ ngOnChanges(): void {
this.contentNavigation();
}
diff --git a/src/app/course/course-wizard/course-wizard.component.ts b/src/app/course/course-wizard/course-wizard.component.ts
index 955ae6e4..b4d17479 100644
--- a/src/app/course/course-wizard/course-wizard.component.ts
+++ b/src/app/course/course-wizard/course-wizard.component.ts
@@ -214,7 +214,6 @@ export class CourseWizardComponent implements OnChanges, OnInit {
}
setVM(vms: {}[]) {
- console.log("vms = " + vms)
this.editVirtualMachines = vms;
this.VMSAllow();
this.setModified();