diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index ffee8d5..ab34212 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@
-

{{u.name}}

+

{{u.name}}

diff --git a/ui/src/app/app.component.scss b/ui/src/app/app.component.scss index cbdde49..dd8143d 100644 --- a/ui/src/app/app.component.scss +++ b/ui/src/app/app.component.scss @@ -3,12 +3,7 @@ height: 100% - 2.5%; } -.sidenav-content { - display: flex; - //height: 100%; - align-items: center; - justify-content: center; -} +.sidenav-content {} .sidenav { padding: 20px; @@ -17,3 +12,9 @@ .spacer { flex: 1 1 auto; } + +.routeUrl:hover { + background: rgba(0, 0, 0, 0.13); + cursor: pointer; + border-radius: 5px; +} diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index f8336b6..3288fd8 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import {Route, Router} from "@angular/router"; @Component({ selector: 'app-root', @@ -6,10 +7,17 @@ import { Component } from '@angular/core'; styleUrls: ['./app.component.scss'] }) export class AppComponent { + constructor(private route: Router) { + } + routes: {name: string, url: string}[] = [ {name: "Команды бота", url:""}, {name: "История сообщений", url:""}, - {name: "Прямые ноды", url:""}, + {name: "Прямые ноды", url:"nodes/direct"}, {name: "Все ноды", url:""}, ] + + goTo(url: string) { + this.route.navigate([url]); + } } diff --git a/ui/src/app/components/nodes/DirectNodes.component.ts b/ui/src/app/components/nodes/DirectNodes.component.ts index bffd966..e2319bf 100644 --- a/ui/src/app/components/nodes/DirectNodes.component.ts +++ b/ui/src/app/components/nodes/DirectNodes.component.ts @@ -7,21 +7,23 @@ import {NodeDTO} from "../../entities/NodeDTO"; styleUrls: ['nodes.styles.scss'], template: ` -
- - - {{node.long_name}} - {{node.short_name}} ({{node.num}}) - - -

график

-
- - - - - -
+
+
+ + + {{node.long_name}} + {{node.short_name}} ({{node.num}}) + + +

график

+
+ + + + + +
+
` }) diff --git a/ui/src/app/components/nodes/nodes.styles.scss b/ui/src/app/components/nodes/nodes.styles.scss index 8b71b74..4b5a21a 100644 --- a/ui/src/app/components/nodes/nodes.styles.scss +++ b/ui/src/app/components/nodes/nodes.styles.scss @@ -1,11 +1,5 @@ .card-wrapper { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); - gap: 8px; -} - -.grid-card { - width: 100%; - height: 100%; - /* Additional styling as needed */ + gap: 24px; } diff --git a/webExtensions/publicEndpoints.py b/webExtensions/publicEndpoints.py index ac22e86..388d302 100644 --- a/webExtensions/publicEndpoints.py +++ b/webExtensions/publicEndpoints.py @@ -2,6 +2,7 @@ from fastapi import FastAPI from fastapi.requests import Request from fastapi.responses import Response, JSONResponse from fastapi.exceptions import HTTPException +from extra.NodeDTO import NodeDTO class WebExtension: app: FastAPI @@ -48,4 +49,14 @@ class WebExtension: @self.app.get(f"{self.core.context}/auth/logout") async def clearSession(request:Request): - return self.core.authManager.setAuth(JSONResponse({"status":True}), 0, True) \ No newline at end of file + return self.core.authManager.setAuth(JSONResponse({"status":True}), 0, True) + + @self.app.get(f"{self.core.context}/auth/me") + @self.core.authManager.authRequest() + async def userNode(request:Request): + userNum = request.cookies.get(self.core.authManager.NUM, None) + userNode = await self.dbService.oneNode(userNum) + if userNum: + return NodeDTO(userNode) + else: + return {} \ No newline at end of file