Added routing by permissions #130

This commit is contained in:
2023-02-16 21:24:29 +01:00
parent e2ef4f3bde
commit f847841582
17 changed files with 260 additions and 26 deletions

View File

@@ -122,7 +122,7 @@ export class DashboardComponent implements OnInit {
}
selectServer(server: Server) {
this.sidebar.serverName$.next(server.name ?? "");
this.sidebar.server$.next(server);
this.router.navigate(["/server", server.id]);
}

View File

@@ -0,0 +1 @@
<p>profile works!</p>

View File

@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProfileComponent } from './profile.component';
describe('ProfileComponent', () => {
let component: ProfileComponent;
let fixture: ComponentFixture<ProfileComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProfileComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ProfileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.scss']
})
export class ProfileComponent {
}

View File

@@ -42,7 +42,7 @@ export class ServerDashboardComponent implements OnInit {
}
).subscribe(server => {
this.server = server;
this.sidebar.serverName$.next(server.name ?? "");
this.sidebar.server$.next(server);
this.spinner.hideSpinner();
});
}

View File

@@ -1,9 +1,11 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { ServerDashboardComponent } from "./server-dashboard/server-dashboard.component";
import { ProfileComponent } from "./profile/profile.component";
const routes: Routes = [
{ path: '', component: ServerDashboardComponent },
{ path: 'profile', component: ProfileComponent },
];
@NgModule({

View File

@@ -3,12 +3,14 @@ import { CommonModule } from '@angular/common';
import { ServerDashboardComponent } from './server-dashboard/server-dashboard.component';
import { ServerRoutingModule } from './server-routing.module';
import { SharedModule } from '../../shared/shared.module';
import { ProfileComponent } from './profile/profile.component';
@NgModule({
declarations: [
ServerDashboardComponent
ServerDashboardComponent,
ProfileComponent
],
imports: [
CommonModule,