diff --git a/projects/cobbler-frontend/src/app/app-routing.module.ts b/projects/cobbler-frontend/src/app/app-routing.module.ts
index 81ca2f19..879d7545 100644
--- a/projects/cobbler-frontend/src/app/app-routing.module.ts
+++ b/projects/cobbler-frontend/src/app/app-routing.module.ts
@@ -39,10 +39,16 @@ import { SettingsViewComponent } from './settings/view/settings-view.component';
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
import { SignaturesComponent } from './signatures/signatures.component';
import { MkloadersComponent } from './actions/mkloaders/mkloaders.component';
+import { PreferencesComponent } from './user/preferences/preferences.component';
/* eslint-enable max-len */
export const routes: Routes = [
{ path: 'login', component: LogInFormComponent },
+ {
+ path: 'user/:name/preferences',
+ component: PreferencesComponent,
+ canActivate: [AuthGuardService],
+ },
{ path: '', pathMatch: 'full', redirectTo: '/login' },
{ path: 'unauthorized', component: UnauthorizedComponent },
{
diff --git a/projects/cobbler-frontend/src/app/navbar/navbar.component.html b/projects/cobbler-frontend/src/app/navbar/navbar.component.html
index 36ed3032..a8685dcc 100644
--- a/projects/cobbler-frontend/src/app/navbar/navbar.component.html
+++ b/projects/cobbler-frontend/src/app/navbar/navbar.component.html
@@ -20,27 +20,39 @@
-
-
- Server: {{ cobbler_server }}
- Version: {{ cobbler_version }}
-
-
- @if (!islogged) {
-
- login
-
- }
@if (islogged) {
-
-
- logout
-
-
+
+ } @else {
+
}
+
+
+
+ @if (islogged) {
+
+
+ } @else {
+
+ }
+
diff --git a/projects/cobbler-frontend/src/app/navbar/navbar.component.ts b/projects/cobbler-frontend/src/app/navbar/navbar.component.ts
index b371a2ae..2a8cf6c2 100644
--- a/projects/cobbler-frontend/src/app/navbar/navbar.component.ts
+++ b/projects/cobbler-frontend/src/app/navbar/navbar.component.ts
@@ -1,9 +1,11 @@
import { Component, EventEmitter, OnDestroy, Output } from '@angular/core';
import { MatIconModule, MatIconRegistry } from '@angular/material/icon';
+import { MatMenuModule } from '@angular/material/menu';
import { MatSnackBar } from '@angular/material/snack-bar';
+import { MatTooltipModule } from '@angular/material/tooltip';
import { DomSanitizer } from '@angular/platform-browser';
import { Router, RouterLink } from '@angular/router';
-import { CobblerApiService } from 'cobbler-api';
+import { CobblerApiService, ExtendedVersion } from 'cobbler-api';
import { Subject, Subscription } from 'rxjs';
import { AuthGuardService } from '../services/auth-guard.service';
import { UserService } from '../services/user.service';
@@ -23,6 +25,8 @@ import { takeUntil } from 'rxjs/operators';
MatIconModule,
CommonModule,
MatButtonModule,
+ MatMenuModule,
+ MatTooltipModule,
],
})
export class NavbarComponent implements OnDestroy {
@@ -63,24 +67,25 @@ export class NavbarComponent implements OnDestroy {
this.islogged = value;
} else {
this.islogged = false;
+ this.guard.setBool(false);
}
});
// should not call version unless user has authenticated
// as it could try to hit an invalid / incorrect URL
if (this.islogged) {
- cobblerApiService
+ this.cobblerApiService
.extended_version()
.pipe(takeUntil(this.ngUnsubscribe))
- .subscribe(
- (value) => {
+ .subscribe({
+ next: (value: ExtendedVersion) => {
this.cobbler_version = value.version;
},
- (error) => {
+ error: (error) => {
this.cobbler_version = 'Error';
this._snackBar.open(error.message, 'Close');
},
- );
+ });
}
}
@@ -89,6 +94,14 @@ export class NavbarComponent implements OnDestroy {
this.ngUnsubscribe.complete();
}
+ redirectToLogin() {
+ this.router.navigate(['/login']);
+ }
+
+ redirectToAccountPreferences() {
+ this.router.navigate(['/user', this.authO.username, 'preferences']);
+ }
+
logout(): void {
this.authO.changeAuthorizedState(false);
this.authO.username = 'username';
diff --git a/projects/cobbler-frontend/src/app/user/preferences/preferences.component.html b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.html
new file mode 100644
index 00000000..40c111cc
--- /dev/null
+++ b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.html
@@ -0,0 +1,38 @@
+User Preferences
+
+
+
+
+ User Information
+
+ User information is not retrievable with Cobbler 3.3.x.
+
+
+
+ User Preferences
+
+
+
+
diff --git a/projects/cobbler-frontend/src/app/user/preferences/preferences.component.scss b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.scss
new file mode 100644
index 00000000..03b91d94
--- /dev/null
+++ b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.scss
@@ -0,0 +1,13 @@
+.preferences-form {
+ min-width: 150px;
+ max-width: 800px;
+ width: 100%;
+}
+
+.full-width {
+ width: 100%;
+}
+
+.pad-bottom {
+ padding-bottom: 1em;
+}
diff --git a/projects/cobbler-frontend/src/app/user/preferences/preferences.component.spec.ts b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.spec.ts
new file mode 100644
index 00000000..536b727d
--- /dev/null
+++ b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { NoopAnimationsModule } from '@angular/platform-browser/animations';
+
+import { PreferencesComponent } from './preferences.component';
+
+describe('PreferencesComponent', () => {
+ let component: PreferencesComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [PreferencesComponent, NoopAnimationsModule],
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(PreferencesComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/projects/cobbler-frontend/src/app/user/preferences/preferences.component.ts b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.ts
new file mode 100644
index 00000000..22496653
--- /dev/null
+++ b/projects/cobbler-frontend/src/app/user/preferences/preferences.component.ts
@@ -0,0 +1,25 @@
+import { Component } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { MatOptionModule } from '@angular/material/core';
+import { MatExpansionModule } from '@angular/material/expansion';
+import { MatFormFieldModule } from '@angular/material/form-field';
+import { MatInputModule } from '@angular/material/input';
+import { MatSelectModule } from '@angular/material/select';
+import { MatSlideToggleModule } from '@angular/material/slide-toggle';
+
+@Component({
+ selector: 'cobbler-preferences',
+ standalone: true,
+ imports: [
+ MatExpansionModule,
+ FormsModule,
+ MatInputModule,
+ MatFormFieldModule,
+ MatSelectModule,
+ MatOptionModule,
+ MatSlideToggleModule,
+ ],
+ templateUrl: './preferences.component.html',
+ styleUrl: './preferences.component.scss',
+})
+export class PreferencesComponent {}