diff --git a/ui/src/app/app-routing.module.ts b/ui/src/app/app-routing.module.ts index 06a8d29..2262358 100644 --- a/ui/src/app/app-routing.module.ts +++ b/ui/src/app/app-routing.module.ts @@ -2,9 +2,11 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import {DirectNodesComponent} from "./components/nodes/DirectNodes.component"; import {BotCommandsComponent} from "./components/botCommands/BotCommands.component"; +import {MessageHistoryComponent} from "./components/messages/MessageHistory.component"; const routes: Routes = [ {path: "nodes/direct", component: DirectNodesComponent}, + {path: "messages", component: MessageHistoryComponent}, {path: "", component: BotCommandsComponent} ]; diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index ab34212..37c00e4 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -4,9 +4,10 @@ MeshCenter -
Имя ноды чела который авторизовался (мб еще snnr rxxi шуе)
+{{userNode.long_name}} ({{userNode.num}}) snr: {{userNode.snr}}
+ -{{u.name}}
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index 3288fd8..3674400 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -1,23 +1,40 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {Route, Router} from "@angular/router"; +import {NodeDTO} from "./entities/NodeDTO"; +import {HttpClient} from "@angular/common/http"; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) -export class AppComponent { - constructor(private route: Router) { +export class AppComponent implements OnInit { + constructor(private route: Router, + private http: HttpClient) { } + ngOnInit() { + this.http.get(`api/auth/me`).subscribe( + (res) => this.userNode = res as NodeDTO + ) + } + + userNode!: NodeDTO + routes: {name: string, url: string}[] = [ - {name: "Команды бота", url:""}, - {name: "История сообщений", url:""}, + //{name: "Команды бота", url:""}, + {name: "История сообщений", url:"messages"}, {name: "Прямые ноды", url:"nodes/direct"}, - {name: "Все ноды", url:""}, + //{name: "Все ноды", url:""}, ] goTo(url: string) { this.route.navigate([url]); } + + logout() { + this.http.get(`api/auth/logout`).subscribe( + () => location.reload() + ) + } } diff --git a/ui/src/app/app.module.ts b/ui/src/app/app.module.ts index 5204118..bbd2447 100644 --- a/ui/src/app/app.module.ts +++ b/ui/src/app/app.module.ts @@ -11,7 +11,7 @@ import {MatButtonModule} from "@angular/material/button"; import {HttpClientModule, HTTP_INTERCEPTORS} from "@angular/common/http"; import {BotCommandsComponent} from "./components/botCommands/BotCommands.component"; import {MessageHistoryComponent} from "./components/messages/MessageHistory.component"; -import {DirectNodesComponent} from "./components/nodes/DirectNodes.component"; +import {DirectNodesComponent, NodeDtoSortPipe} from "./components/nodes/DirectNodes.component"; import {AllNodesComponent} from "./components/nodes/AllNodes.component"; import {AuthDialog, AuthInterceptor} from "./auth/AuthInterceptor"; import {MatDialogModule} from "@angular/material/dialog"; @@ -22,6 +22,7 @@ import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {MatSnackBarModule} from "@angular/material/snack-bar"; import {MatDividerModule} from "@angular/material/divider"; import {MatCardModule} from "@angular/material/card"; +import {MatSelectModule} from "@angular/material/select"; @NgModule({ declarations: [ @@ -49,7 +50,9 @@ import {MatCardModule} from "@angular/material/card"; FormsModule, MatSnackBarModule, MatDividerModule, - MatCardModule + MatCardModule, + NodeDtoSortPipe, + MatSelectModule ], providers: [{ provide: HTTP_INTERCEPTORS, diff --git a/ui/src/app/auth/AuthInterceptor.ts b/ui/src/app/auth/AuthInterceptor.ts index 5986a88..c3b104b 100644 --- a/ui/src/app/auth/AuthInterceptor.ts +++ b/ui/src/app/auth/AuthInterceptor.ts @@ -12,6 +12,7 @@ import {MatDialog, MatDialogRef} from "@angular/material/dialog"; import {FormControl} from "@angular/forms"; import {NodeMiniDTO} from "../entities/NodeMiniDTO"; import {MatSnackBar} from "@angular/material/snack-bar"; +import {D} from "@angular/cdk/keycodes"; @Component({ @@ -22,7 +23,7 @@ import {MatSnackBar} from "@angular/material/snack-bar";график
-