From 45b3e3737f651c7ade6f2d44f2169be1e4c8f857 Mon Sep 17 00:00:00 2001 From: csba1652 <Bilal.Hassan@student.uibk.ac.at> Date: Mon, 15 May 2023 08:16:09 +0100 Subject: [PATCH] pushing work of last week refactoring -remove unused components -remove dead code -rename components --- angular.json | 4 +- src/app/app-routing.module.ts | 84 ++--- src/app/app.component.html | 32 -- src/app/app.module.ts | 57 ++- .../comparing/barChart}/compare.component.css | 0 .../barChart}/compare.component.html | 0 .../barChart}/compare.component.spec.ts | 0 .../comparing/barChart}/compare.component.ts | 2 +- .../comparing/chartBar}/zoom.component.css | 0 .../comparing/chartBar}/zoom.component.html | 0 .../chartBar}/zoom.component.spec.ts | 0 .../comparing/chartBar}/zoom.component.ts | 2 +- .../fourInOne}/summary.component.css | 0 .../fourInOne}/summary.component.html | 0 .../fourInOne}/summary.component.spec.ts | 0 .../comparing/fourInOne}/summary.component.ts | 2 +- .../coming-soon/coming-soon.component.html | 6 - .../coming-soon/coming-soon.component.scss | 22 -- .../coming-soon/coming-soon.component.spec.ts | 23 -- .../coming-soon/coming-soon.component.ts | 10 - .../cooming-soon-header.component.html | 1 - .../cooming-soon-header.component.spec.ts | 23 -- .../cooming-soon-header.component.ts | 10 - .../slider/slider.component.css | 0 .../slider/slider.component.html | 0 .../slider/slider.component.spec.ts | 0 .../{ => customUX}/slider/slider.component.ts | 0 .../thermometer/thermometer.component.html | 0 .../thermometer/thermometer.component.scss | 0 .../thermometer/thermometer.component.spec.ts | 0 .../thermometer/thermometer.component.ts | 0 .../components/lev0/lev0.component.html | 180 --------- .../components/lev0/lev0.component.scss | 350 ------------------ .../components/lev0/lev0.component.spec.ts | 23 -- .../module/components/lev0/lev0.component.ts | 97 ----- .../pro-view/pro-view.component.html | 194 ++++------ .../components/pro-view/pro-view.component.ts | 38 +- .../summaryIcons.component.html} | 72 +--- .../summaryIcons.component.scss} | 0 .../summaryIcons.component.spec.ts} | 11 +- .../summaryIcons.component.ts} | 15 +- .../summaryList.html} | 202 ---------- .../summaryList.scss} | 0 .../summaryList.spec.ts} | 10 +- .../summaryList.ts} | 10 +- .../client/client.component.css | 0 .../client/client.component.html | 0 .../client/client.component.spec.ts | 0 .../client/client.component.ts | 7 +- .../stationManagement}/client/client.model.ts | 0 .../config-header/config-header.component.css | 0 .../config-header.component.html | 0 .../config-header.component.spec.ts | 0 .../config-header/config-header.component.ts | 0 .../data-header/data-header.component.css | 0 .../data-header/data-header.component.html | 0 .../data-header/data-header.component.spec.ts | 0 .../data-header/data-header.component.ts | 0 .../host/host.component.css | 0 .../host/host.component.html | 0 .../host/host.component.spec.ts | 0 .../stationManagement}/host/host.component.ts | 2 +- .../stationManagement}/host/host.model.ts | 0 .../sensor/sensor.component.css | 0 .../sensor/sensor.component.html | 0 .../sensor/sensor.component.spec.ts | 0 .../sensor/sensor.component.ts | 2 +- .../stationManagement}/sensor/sensor.model.ts | 0 .../station/station.component.css | 0 .../station/station.component.html | 0 .../station/station.component.spec.ts | 0 .../station/station.component.ts | 2 +- .../station/station.model.ts | 0 .../stationManagement.component.html | 45 +++ .../stationManagement.component.scss} | 0 .../stationManagement.component.spec.ts | 23 ++ .../stationManagement.component.ts | 220 +++++++++++ .../userManagment}/user.model.ts | 0 .../userManagement.component.css} | 0 .../userManagement.component.html} | 0 .../userManagement.component.spec.ts} | 10 +- .../userManagement.component.ts} | 10 +- .../pages/dashboard/dashboard.component.css | 0 .../pages/dashboard/dashboard.component.html | 25 -- .../dashboard/dashboard.component.spec.ts | 23 -- .../pages/dashboard/dashboard.component.ts | 112 ------ .../home-tailwindcss.component.css | 0 .../home-tailwindcss.component.html | 101 ----- .../home-tailwindcss.component.spec.ts | 0 .../home-tailwindcss.component.ts | 37 -- .../home.component.css} | 0 src/app/module/pages/home/home.component.html | 72 ++-- .../module/pages/home/home.component.spec.ts | 23 -- src/app/module/pages/home/home.component.ts | 234 ++---------- .../login-tailwindcss.component.spec.ts | 23 -- .../login-tailwindcss.component.ts | 47 --- .../login-tailwindcss.component.css | 0 .../login-tailwindcss.component.html | 0 .../module/pages/login/login.component.css | 26 -- .../module/pages/login/login.component.html | 27 -- .../pages/login/login.component.spec.ts | 12 +- src/app/module/pages/login/login.component.ts | 77 ++-- .../mobile-home/mobile-home.component.css | 0 .../mobile-home/mobile-home.component.html | 44 --- .../mobile-home/mobile-home.component.spec.ts | 23 -- .../mobile-home/mobile-home.component.ts | 16 - 106 files changed, 561 insertions(+), 2162 deletions(-) rename src/app/module/components/{compare => charts/comparing/barChart}/compare.component.css (100%) rename src/app/module/components/{compare => charts/comparing/barChart}/compare.component.html (100%) rename src/app/module/components/{compare => charts/comparing/barChart}/compare.component.spec.ts (100%) rename src/app/module/components/{compare => charts/comparing/barChart}/compare.component.ts (98%) rename src/app/module/components/{zoom => charts/comparing/chartBar}/zoom.component.css (100%) rename src/app/module/components/{zoom => charts/comparing/chartBar}/zoom.component.html (100%) rename src/app/module/components/{zoom => charts/comparing/chartBar}/zoom.component.spec.ts (100%) rename src/app/module/components/{zoom => charts/comparing/chartBar}/zoom.component.ts (98%) rename src/app/module/components/{summary => charts/comparing/fourInOne}/summary.component.css (100%) rename src/app/module/components/{summary => charts/comparing/fourInOne}/summary.component.html (100%) rename src/app/module/components/{summary => charts/comparing/fourInOne}/summary.component.spec.ts (100%) rename src/app/module/components/{summary => charts/comparing/fourInOne}/summary.component.ts (99%) delete mode 100644 src/app/module/components/coming-soon/coming-soon.component.html delete mode 100644 src/app/module/components/coming-soon/coming-soon.component.scss delete mode 100644 src/app/module/components/coming-soon/coming-soon.component.spec.ts delete mode 100644 src/app/module/components/coming-soon/coming-soon.component.ts delete mode 100644 src/app/module/components/cooming-soon-header/cooming-soon-header.component.html delete mode 100644 src/app/module/components/cooming-soon-header/cooming-soon-header.component.spec.ts delete mode 100644 src/app/module/components/cooming-soon-header/cooming-soon-header.component.ts rename src/app/module/components/{ => customUX}/slider/slider.component.css (100%) rename src/app/module/components/{ => customUX}/slider/slider.component.html (100%) rename src/app/module/components/{ => customUX}/slider/slider.component.spec.ts (100%) rename src/app/module/components/{ => customUX}/slider/slider.component.ts (100%) rename src/app/module/components/{ => customUX}/thermometer/thermometer.component.html (100%) rename src/app/module/components/{ => customUX}/thermometer/thermometer.component.scss (100%) rename src/app/module/components/{ => customUX}/thermometer/thermometer.component.spec.ts (100%) rename src/app/module/components/{ => customUX}/thermometer/thermometer.component.ts (100%) delete mode 100644 src/app/module/components/lev0/lev0.component.html delete mode 100644 src/app/module/components/lev0/lev0.component.scss delete mode 100644 src/app/module/components/lev0/lev0.component.spec.ts delete mode 100644 src/app/module/components/lev0/lev0.component.ts rename src/app/module/components/{lev0Ver2/lev0.component.html => summaryIcons/summaryIcons.component.html} (70%) rename src/app/module/components/{lev0Ver2/lev0.component.scss => summaryIcons/summaryIcons.component.scss} (100%) rename src/app/module/components/{lev0Ver2/lev0.component.spec.ts => summaryIcons/summaryIcons.component.spec.ts} (57%) rename src/app/module/components/{lev0Ver2/lev0.component.ts => summaryIcons/summaryIcons.component.ts} (90%) rename src/app/module/components/{lev0-ver3/lev0-ver3.component.html => summaryList/summaryList.html} (56%) rename src/app/module/components/{lev0-ver3/lev0-ver3.component.scss => summaryList/summaryList.scss} (100%) rename src/app/module/components/{lev0-ver3/lev0-ver3.component.spec.ts => summaryList/summaryList.spec.ts} (59%) rename src/app/module/components/{lev0-ver3/lev0-ver3.component.ts => summaryList/summaryList.ts} (93%) rename src/app/module/pages/{station => admin/stationManagement}/client/client.component.css (100%) rename src/app/module/pages/{station => admin/stationManagement}/client/client.component.html (100%) rename src/app/module/pages/{station => admin/stationManagement}/client/client.component.spec.ts (100%) rename src/app/module/pages/{station => admin/stationManagement}/client/client.component.ts (92%) rename src/app/module/pages/{station => admin/stationManagement}/client/client.model.ts (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/config-header/config-header.component.css (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/config-header/config-header.component.html (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/config-header/config-header.component.spec.ts (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/config-header/config-header.component.ts (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/data-header/data-header.component.css (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/data-header/data-header.component.html (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/data-header/data-header.component.spec.ts (100%) rename src/app/module/{components => pages/admin/stationManagement}/header/data-header/data-header.component.ts (100%) rename src/app/module/pages/{station => admin/stationManagement}/host/host.component.css (100%) rename src/app/module/pages/{station => admin/stationManagement}/host/host.component.html (100%) rename src/app/module/pages/{station => admin/stationManagement}/host/host.component.spec.ts (100%) rename src/app/module/pages/{station => admin/stationManagement}/host/host.component.ts (96%) rename src/app/module/pages/{station => admin/stationManagement}/host/host.model.ts (100%) rename src/app/module/pages/{station => admin/stationManagement}/sensor/sensor.component.css (100%) rename src/app/module/pages/{station => admin/stationManagement}/sensor/sensor.component.html (100%) rename src/app/module/pages/{station => admin/stationManagement}/sensor/sensor.component.spec.ts (100%) rename src/app/module/pages/{station => admin/stationManagement}/sensor/sensor.component.ts (97%) rename src/app/module/pages/{station => admin/stationManagement}/sensor/sensor.model.ts (100%) rename src/app/module/pages/{ => admin/stationManagement}/station/station.component.css (100%) rename src/app/module/pages/{ => admin/stationManagement}/station/station.component.html (100%) rename src/app/module/pages/{ => admin/stationManagement}/station/station.component.spec.ts (100%) rename src/app/module/pages/{ => admin/stationManagement}/station/station.component.ts (98%) rename src/app/module/pages/{ => admin/stationManagement}/station/station.model.ts (100%) create mode 100644 src/app/module/pages/admin/stationManagement/stationManagement.component.html rename src/app/module/pages/{home/home.component.scss => admin/stationManagement/stationManagement.component.scss} (100%) create mode 100644 src/app/module/pages/admin/stationManagement/stationManagement.component.spec.ts create mode 100644 src/app/module/pages/admin/stationManagement/stationManagement.component.ts rename src/app/module/pages/{admin-dashboard => admin/userManagment}/user.model.ts (100%) rename src/app/module/{components/cooming-soon-header/cooming-soon-header.component.css => pages/admin/userManagment/userManagement.component.css} (100%) rename src/app/module/pages/{admin-dashboard/admin-dashboard.component.html => admin/userManagment/userManagement.component.html} (100%) rename src/app/module/pages/{admin-dashboard/admin-dashboard.component.spec.ts => admin/userManagment/userManagement.component.spec.ts} (56%) rename src/app/module/pages/{admin-dashboard/admin-dashboard.component.ts => admin/userManagment/userManagement.component.ts} (92%) delete mode 100644 src/app/module/pages/dashboard/dashboard.component.css delete mode 100644 src/app/module/pages/dashboard/dashboard.component.html delete mode 100644 src/app/module/pages/dashboard/dashboard.component.spec.ts delete mode 100644 src/app/module/pages/dashboard/dashboard.component.ts delete mode 100644 src/app/module/pages/home-tailwindcss/home-tailwindcss.component.css delete mode 100644 src/app/module/pages/home-tailwindcss/home-tailwindcss.component.html delete mode 100644 src/app/module/pages/home-tailwindcss/home-tailwindcss.component.spec.ts delete mode 100644 src/app/module/pages/home-tailwindcss/home-tailwindcss.component.ts rename src/app/module/pages/{admin-dashboard/admin-dashboard.component.css => home/home.component.css} (100%) delete mode 100644 src/app/module/pages/login-tailwindcss/login-tailwindcss.component.spec.ts delete mode 100644 src/app/module/pages/login-tailwindcss/login-tailwindcss.component.ts rename src/app/module/pages/{login-tailwindcss => login}/login-tailwindcss.component.css (100%) rename src/app/module/pages/{login-tailwindcss => login}/login-tailwindcss.component.html (100%) delete mode 100644 src/app/module/pages/login/login.component.css delete mode 100644 src/app/module/pages/login/login.component.html delete mode 100644 src/app/module/pages/mobile-home/mobile-home.component.css delete mode 100644 src/app/module/pages/mobile-home/mobile-home.component.html delete mode 100644 src/app/module/pages/mobile-home/mobile-home.component.spec.ts delete mode 100644 src/app/module/pages/mobile-home/mobile-home.component.ts diff --git a/angular.json b/angular.json index ca762c4..6b2d2f5 100644 --- a/angular.json +++ b/angular.json @@ -39,12 +39,12 @@ { "type": "initial", "maximumWarning": "500kb", - "maximumError": "1mb" + "maximumError": "20MB" }, { "type": "anyComponentStyle", "maximumWarning": "2kb", - "maximumError": "4kb" + "maximumError": "20MB" } ], "outputHashing": "all" diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d29e4fc..94c65be 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,59 +1,52 @@ import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; -import {LoginComponent} from "./module/pages/login/login.component"; import {SignupComponent} from "./module/pages/signup/signup.component"; -import {AdminDashboardComponent} from "./module/pages/admin-dashboard/admin-dashboard.component"; -import {AuthGuard} from "./shared/auth/auth.guard"; -import {RoleGuard} from "./shared/auth/role.guard"; -import {StationComponent} from "./module/pages/station/station.component"; -import {SensorComponent} from "./module/pages/station/sensor/sensor.component"; -import {ClientComponent} from "./module/pages/station/client/client.component"; -import {HostComponent} from "./module/pages/station/host/host.component"; -import {DashboardComponent} from "./module/pages/dashboard/dashboard.component"; -import {ZoomComponent} from "./module/components/zoom/zoom.component"; -import {SummaryComponent} from "./module/components/summary/summary.component"; -import {CompareComponent} from "./module/components/compare/compare.component"; -import {DataHeaderComponent} from "./module/components/header/data-header/data-header.component"; -import {ConfigHeaderComponent} from "./module/components/header/config-header/config-header.component"; -import {HomeComponent} from "./module/pages/home/home.component"; -import {CoomingSoonHeaderComponent} from "./module/components/cooming-soon-header/cooming-soon-header.component"; -import {ComingSoonComponent} from "./module/components/coming-soon/coming-soon.component"; -import {Lev0Ver2Component} from "./module/components/lev0Ver2/lev0.component"; +import {UserManagementComponent} from "./module/pages/admin/userManagment/userManagement.component"; +import {StationComponent} from "./module/pages/admin/stationManagement/station/station.component"; +import {SensorComponent} from "./module/pages/admin/stationManagement/sensor/sensor.component"; +import {ClientComponent} from "./module/pages/admin/stationManagement/client/client.component"; +import {HostComponent} from "./module/pages/admin/stationManagement/host/host.component"; +import {ZoomComponent} from "./module/components/charts/comparing/chartBar/zoom.component"; +import {SummaryComponent} from "./module/components/charts/comparing/fourInOne/summary.component"; +import {CompareComponent} from "./module/components/charts/comparing/barChart/compare.component"; +import {DataHeaderComponent} from "./module/pages/admin/stationManagement/header/data-header/data-header.component"; +import {ConfigHeaderComponent} from "./module/pages/admin/stationManagement/header/config-header/config-header.component"; +import {SummaryIconsComponent} from "./module/components/summaryIcons/summaryIcons.component"; import {ProViewComponent} from "./module/components/pro-view/pro-view.component"; -import {HomeTailwindcssComponent} from "./module/pages/home-tailwindcss/home-tailwindcss.component"; -import {LoginTailwindcssComponent} from "./module/pages/login-tailwindcss/login-tailwindcss.component"; -import {Lev0Ver3Component} from "./module/components/lev0-ver3/lev0-ver3.component"; +import {HomeComponent} from "./module/pages/home/home.component"; +import {LoginTailwindcssComponent} from "./module/pages/login/login.component"; +import {SummaryList} from "./module/components/summaryList/summaryList"; const routes: Routes = [ {path: '', redirectTo: 'login', pathMatch: 'full'}, // {path: 'dashboard', component: Lev0Ver2Component, canActivate: [AuthGuard]}, - {path: 'dashboard', component: Lev0Ver2Component}, + {path: 'dashboard', component: SummaryIconsComponent}, {path: 'chart2', component: ProViewComponent}, {path: '', component: LoginTailwindcssComponent,outlet:'main'}, {path: 'login', component: LoginTailwindcssComponent,outlet:'main'}, - { path: 'homeDash', component: HomeTailwindcssComponent,outlet:'main', + { path: 'homeDash', component: HomeComponent,outlet:'main', children: [ - { path: '', component: Lev0Ver2Component, outlet: 'homeDash' }, + { path: '', component: SummaryIconsComponent, outlet: 'homeDash' }, { path: 'chart', component: ProViewComponent, outlet: 'homeDash' }, - { path: 'dayData', component: Lev0Ver2Component, outlet: 'homeDash' }, - { path: 'dayDataList', component: Lev0Ver3Component, outlet: 'homeDash' } + { path: 'dayData', component: SummaryIconsComponent, outlet: 'homeDash' }, + { path: 'dayDataList', component: SummaryList, outlet: 'homeDash' } ] }, {path: 'signup', component: SignupComponent}, - {path: 'admin', component: AdminDashboardComponent}, - {path: 'station', component: StationComponent,outlet: 'home'}, - {path: 'station/sensor', component: SensorComponent,outlet: 'home'}, - {path: 'station/client', component: ClientComponent,outlet: 'home'}, - {path: 'station/host', component: HostComponent,outlet: 'home'}, - { path: 'zoom', component: ZoomComponent, outlet: 'home' }, - { path: 'summary', component: SummaryComponent, outlet: 'home' }, - { path: 'compare', component: CompareComponent, outlet: 'home' }, - { path: 'host', component: HostComponent, outlet: 'home' }, - { path: 'client', component:ClientComponent, outlet: 'home' }, - { path: 'sensor', component: SensorComponent, outlet: 'home' }, - { path: '', component: SummaryComponent, outlet: 'home' }, - // {path:'',component:Lev0Ver2Component,outlet:'home'}, - {path:'data',component:Lev0Ver2Component,outlet:'home'}, + {path: 'admin', component: UserManagementComponent}, + {path: 'station', component: StationComponent,outlet: 'stationManagement'}, + {path: 'station/sensor', component: SensorComponent,outlet: 'stationManagement'}, + {path: 'station/client', component: ClientComponent,outlet: 'stationManagement'}, + {path: 'station/host', component: HostComponent,outlet: 'stationManagement'}, + { path: 'chartBar', component: ZoomComponent, outlet: 'stationManagement' }, + { path: 'summary', component: SummaryComponent, outlet: 'stationManagement' }, + { path: 'compare', component: CompareComponent, outlet: 'stationManagement' }, + { path: 'host', component: HostComponent, outlet: 'stationManagement' }, + { path: 'client', component:ClientComponent, outlet: 'stationManagement' }, + { path: 'sensor', component: SensorComponent, outlet: 'stationManagement' }, + { path: '', component: SummaryComponent, outlet: 'stationManagement' }, + // {path:'',component:Lev0Ver2Component,outlet:'stationManagement'}, + {path:'data',component:SummaryIconsComponent,outlet:'stationManagement'}, { path: 'summary', component: DataHeaderComponent, outlet: 'header' }, { path: 'station', component: ConfigHeaderComponent, outlet: 'header' }, { path: '', component: ConfigHeaderComponent, outlet: 'header' }, @@ -64,20 +57,11 @@ const routes: Routes = [ { path: 'homeConfigHost', children: [ { path: '', component: ConfigHeaderComponent, outlet: 'child1'}, { path: '', component: HostComponent, outlet: 'child2'}]}, { path: 'homeConfigClient', children: [ { path: '', component: ConfigHeaderComponent, outlet: 'child1'}, { path: '', component: ClientComponent, outlet: 'child2'}]}, { path: 'homeConfigSensor', children: [ { path: '', component: ConfigHeaderComponent, outlet: 'child1'}, { path: '', component: SensorComponent, outlet: 'child2'}]}, - { path: 'ComingSoon', children: [ { path: '', component: CoomingSoonHeaderComponent, outlet: 'child1'}, { path: '', component: ComingSoonComponent, outlet: 'child2'}]}, - { path: 'data', children: [ { path: '', component: DataHeaderComponent, outlet: 'child1'}, { path: '', component: Lev0Ver2Component, outlet: 'child2'}]}, + { path: 'data', children: [ { path: '', component: DataHeaderComponent, outlet: 'child1'}, { path: '', component: SummaryIconsComponent, outlet: 'child2'}]}, ]; -/* Adding it again later - {path: 'admin', component: AdminDashboardComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, - {path: 'station', component: StationComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, - {path: 'station/sensor', component: SensorComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, - {path: 'station/client', component: ClientComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, - {path: 'station/host', component: HostComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, - */ - @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] diff --git a/src/app/app.component.html b/src/app/app.component.html index 7890aed..8f1fd9f 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,34 +1,2 @@ -<!-- -<nav class="navbar navbar-expand-lg navbar-light bg-success"> - <div class="container"> - <a class="navbar-brand">Forte</a> - <ng-container *ngIf="isLoggedIn"> - <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> - <div class="navbar-nav"> - <button type="button" class="btn btn-success" (click)="navigate(5)">Home</button> - <div *ngIf="isAdmin"> - <button type="button" class="btn btn-success" (click)="navigate(0)">Stations</button> - <button type="button" class="btn btn-success" (click)="navigate(1)">Hosts</button> - <button type="button" class="btn btn-success" (click)="navigate(2)">Clients</button> - <button type="button" class="btn btn-success" (click)="navigate(3)">Sensors</button> - <button type="button" class="btn btn-success" (click)="navigate(4)">Users</button> - </div> - </div> - </div> - <div class="d-flex"> - <button type="button" class="btn btn-danger" (click)="logout()"> - Logout - </button> - </div> - </ng-container> - </div> -</nav> ---> - - <router-outlet name="main"></router-outlet> - - - - diff --git a/src/app/app.module.ts b/src/app/app.module.ts index bc8cbca..f1cbc19 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,36 +2,31 @@ import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {AppRoutingModule} from './app-routing.module'; import {AppComponent} from './app.component'; -import {AdminDashboardComponent} from './module/pages/admin-dashboard/admin-dashboard.component'; +import {UserManagementComponent} from './module/pages/admin/userManagment/userManagement.component'; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {MatFormFieldModule} from '@angular/material/form-field'; import {HTTP_INTERCEPTORS, HttpClientModule} from "@angular/common/http"; -import { LoginComponent } from './module/pages/login/login.component'; import { SignupComponent } from './module/pages/signup/signup.component'; -import {StationComponent} from "./module/pages/station/station.component"; -import {ClientComponent} from "./module/pages/station/client/client.component"; -import {SensorComponent} from "./module/pages/station/sensor/sensor.component"; -import {HostComponent} from "./module/pages/station/host/host.component"; +import {StationComponent} from "./module/pages/admin/stationManagement/station/station.component"; +import {ClientComponent} from "./module/pages/admin/stationManagement/client/client.component"; +import {SensorComponent} from "./module/pages/admin/stationManagement/sensor/sensor.component"; +import {HostComponent} from "./module/pages/admin/stationManagement/host/host.component"; import {EventEmitterService} from "./shared/event.emitter.service"; -import { DashboardComponent } from './module/pages/dashboard/dashboard.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import {MatIconModule} from "@angular/material/icon"; -import {HomeComponent} from "./module/pages/home/home.component"; +import {StationManagementComponent} from "./module/pages/admin/stationManagement/stationManagement.component"; import {MatSelectModule} from "@angular/material/select"; import {MatDatepickerModule} from '@angular/material/datepicker'; import {MatInputModule} from "@angular/material/input"; import { MatNativeDateModule} from "@angular/material/core"; -import { SummaryComponent } from './module/components/summary/summary.component'; -import { ZoomComponent } from './module/components/zoom/zoom.component'; -import { CompareComponent } from './module/components/compare/compare.component'; -import { DataHeaderComponent } from './module/components/header/data-header/data-header.component'; -import { ConfigHeaderComponent } from './module/components/header/config-header/config-header.component'; -import { ComingSoonComponent } from './module/components/coming-soon/coming-soon.component'; -import { CoomingSoonHeaderComponent } from './module/components/cooming-soon-header/cooming-soon-header.component'; -import { Lev0Component } from './module/components/lev0/lev0.component'; +import { SummaryComponent } from './module/components/charts/comparing/fourInOne/summary.component'; +import { ZoomComponent } from './module/components/charts/comparing/chartBar/zoom.component'; +import { CompareComponent } from './module/components/charts/comparing/barChart/compare.component'; +import { DataHeaderComponent } from './module/pages/admin/stationManagement/header/data-header/data-header.component'; +import { ConfigHeaderComponent } from './module/pages/admin/stationManagement/header/config-header/config-header.component'; import { LightChartComponent } from './module/components/charts/light-chart/light-chart.component'; -import {Lev0Ver2Component} from "./module/components/lev0Ver2/lev0.component"; +import {SummaryIconsComponent} from "./module/components/summaryIcons/summaryIcons.component"; import {CjsTimline} from "./module/components/charts/Cjs-timeline/light-chart.component"; import { ProViewComponent } from './module/components/pro-view/pro-view.component'; import {MatAutocompleteModule} from "@angular/material/autocomplete"; @@ -40,48 +35,40 @@ import {ApiModule} from "../../projects/swagger-client/src"; import { InterceptorService } from './shared/auth/interceptor.service'; import {CjsTimelineMultiple} from "./module/components/charts/Cjs-timeline-multiple/light-chart.component"; import {MatButtonModule} from "@angular/material/button"; -import { ThermometerComponent } from './module/components/thermometer/thermometer.component'; -import { HomeTailwindcssComponent } from './module/pages/home-tailwindcss/home-tailwindcss.component'; -import {isNamespaceImportNode} from "@angular/cdk/schematics"; +import { ThermometerComponent } from './module/components/customUX/thermometer/thermometer.component'; +import { HomeComponent } from './module/pages/home/home.component'; import {ServerControllerService} from "../../projects/generated-api/src"; -import { LoginTailwindcssComponent } from './module/pages/login-tailwindcss/login-tailwindcss.component'; -import { Lev0Ver3Component } from './module/components/lev0-ver3/lev0-ver3.component'; -import { MobileHomeComponent } from './module/pages/mobile-home/mobile-home.component'; +import { LoginTailwindcssComponent } from './module/pages/login/login.component'; +import { SummaryList } from './module/components/summaryList/summaryList'; import {FontAwesomeModule} from "@fortawesome/angular-fontawesome"; -import { SliderComponent } from './module/components/slider/slider.component'; +import { SliderComponent } from './module/components/customUX/slider/slider.component'; import {MatSliderModule} from "@angular/material/slider"; import {MatCardModule} from "@angular/material/card"; @NgModule({ declarations: [ AppComponent, - AdminDashboardComponent, - LoginComponent, + UserManagementComponent, SignupComponent, StationComponent, HostComponent, ClientComponent, SensorComponent, - DashboardComponent, - HomeComponent, + StationManagementComponent, SummaryComponent, ZoomComponent, CompareComponent, DataHeaderComponent, ConfigHeaderComponent, - ComingSoonComponent, - CoomingSoonHeaderComponent, - Lev0Component, - Lev0Ver2Component, + SummaryIconsComponent, CjsTimline, LightChartComponent, ProViewComponent, CjsTimelineMultiple, ThermometerComponent, - HomeTailwindcssComponent, + HomeComponent, LoginTailwindcssComponent, - Lev0Ver3Component, - MobileHomeComponent, + SummaryList, SliderComponent ], diff --git a/src/app/module/components/compare/compare.component.css b/src/app/module/components/charts/comparing/barChart/compare.component.css similarity index 100% rename from src/app/module/components/compare/compare.component.css rename to src/app/module/components/charts/comparing/barChart/compare.component.css diff --git a/src/app/module/components/compare/compare.component.html b/src/app/module/components/charts/comparing/barChart/compare.component.html similarity index 100% rename from src/app/module/components/compare/compare.component.html rename to src/app/module/components/charts/comparing/barChart/compare.component.html diff --git a/src/app/module/components/compare/compare.component.spec.ts b/src/app/module/components/charts/comparing/barChart/compare.component.spec.ts similarity index 100% rename from src/app/module/components/compare/compare.component.spec.ts rename to src/app/module/components/charts/comparing/barChart/compare.component.spec.ts diff --git a/src/app/module/components/compare/compare.component.ts b/src/app/module/components/charts/comparing/barChart/compare.component.ts similarity index 98% rename from src/app/module/components/compare/compare.component.ts rename to src/app/module/components/charts/comparing/barChart/compare.component.ts index 3112b41..f6f65f7 100644 --- a/src/app/module/components/compare/compare.component.ts +++ b/src/app/module/components/charts/comparing/barChart/compare.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; import {Chart} from "chart.js/auto"; @Component({ - selector: 'app-compare', + selector: 'app-barChart', templateUrl: './compare.component.html', styleUrls: ['./compare.component.css'] }) diff --git a/src/app/module/components/zoom/zoom.component.css b/src/app/module/components/charts/comparing/chartBar/zoom.component.css similarity index 100% rename from src/app/module/components/zoom/zoom.component.css rename to src/app/module/components/charts/comparing/chartBar/zoom.component.css diff --git a/src/app/module/components/zoom/zoom.component.html b/src/app/module/components/charts/comparing/chartBar/zoom.component.html similarity index 100% rename from src/app/module/components/zoom/zoom.component.html rename to src/app/module/components/charts/comparing/chartBar/zoom.component.html diff --git a/src/app/module/components/zoom/zoom.component.spec.ts b/src/app/module/components/charts/comparing/chartBar/zoom.component.spec.ts similarity index 100% rename from src/app/module/components/zoom/zoom.component.spec.ts rename to src/app/module/components/charts/comparing/chartBar/zoom.component.spec.ts diff --git a/src/app/module/components/zoom/zoom.component.ts b/src/app/module/components/charts/comparing/chartBar/zoom.component.ts similarity index 98% rename from src/app/module/components/zoom/zoom.component.ts rename to src/app/module/components/charts/comparing/chartBar/zoom.component.ts index 4dc9677..8c4c26d 100644 --- a/src/app/module/components/zoom/zoom.component.ts +++ b/src/app/module/components/charts/comparing/chartBar/zoom.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; import {Chart} from "chart.js/auto"; @Component({ - selector: 'app-zoom', + selector: 'app-chartBar', templateUrl: './zoom.component.html', styleUrls: ['./zoom.component.css'] }) diff --git a/src/app/module/components/summary/summary.component.css b/src/app/module/components/charts/comparing/fourInOne/summary.component.css similarity index 100% rename from src/app/module/components/summary/summary.component.css rename to src/app/module/components/charts/comparing/fourInOne/summary.component.css diff --git a/src/app/module/components/summary/summary.component.html b/src/app/module/components/charts/comparing/fourInOne/summary.component.html similarity index 100% rename from src/app/module/components/summary/summary.component.html rename to src/app/module/components/charts/comparing/fourInOne/summary.component.html diff --git a/src/app/module/components/summary/summary.component.spec.ts b/src/app/module/components/charts/comparing/fourInOne/summary.component.spec.ts similarity index 100% rename from src/app/module/components/summary/summary.component.spec.ts rename to src/app/module/components/charts/comparing/fourInOne/summary.component.spec.ts diff --git a/src/app/module/components/summary/summary.component.ts b/src/app/module/components/charts/comparing/fourInOne/summary.component.ts similarity index 99% rename from src/app/module/components/summary/summary.component.ts rename to src/app/module/components/charts/comparing/fourInOne/summary.component.ts index 1dd7475..641957b 100644 --- a/src/app/module/components/summary/summary.component.ts +++ b/src/app/module/components/charts/comparing/fourInOne/summary.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core'; import {Chart} from "chart.js/auto"; @Component({ - selector: 'app-summary', + selector: 'app-fourInOne', templateUrl: './summary.component.html', styleUrls: ['./summary.component.css'] }) diff --git a/src/app/module/components/coming-soon/coming-soon.component.html b/src/app/module/components/coming-soon/coming-soon.component.html deleted file mode 100644 index 732c930..0000000 --- a/src/app/module/components/coming-soon/coming-soon.component.html +++ /dev/null @@ -1,6 +0,0 @@ -<div class="coming-soon"> - <div class="coming-soon-text"> - <h1>COMING SOON :)</h1> - </div> - -</div> diff --git a/src/app/module/components/coming-soon/coming-soon.component.scss b/src/app/module/components/coming-soon/coming-soon.component.scss deleted file mode 100644 index f8a6e0e..0000000 --- a/src/app/module/components/coming-soon/coming-soon.component.scss +++ /dev/null @@ -1,22 +0,0 @@ -.coming-soon{ - height: 120vh; - width: 100%; - - background-image: url("../../../../assets/comingSoon.jpg"); - background-repeat: no-repeat; - background-size: cover; - - display: flex; - justify-content: center; - align-items: center; -} - -h1{ - color: white; -} - -.coming-soon-text{ - -} - - diff --git a/src/app/module/components/coming-soon/coming-soon.component.spec.ts b/src/app/module/components/coming-soon/coming-soon.component.spec.ts deleted file mode 100644 index 3044c45..0000000 --- a/src/app/module/components/coming-soon/coming-soon.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ComingSoonComponent } from './coming-soon.component'; - -describe('ComingSoonComponent', () => { - let component: ComingSoonComponent; - let fixture: ComponentFixture<ComingSoonComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ComingSoonComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ComingSoonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/components/coming-soon/coming-soon.component.ts b/src/app/module/components/coming-soon/coming-soon.component.ts deleted file mode 100644 index 6c31917..0000000 --- a/src/app/module/components/coming-soon/coming-soon.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-coming-soon', - templateUrl: './coming-soon.component.html', - styleUrls: ['./coming-soon.component.scss'] -}) -export class ComingSoonComponent { - -} diff --git a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.html b/src/app/module/components/cooming-soon-header/cooming-soon-header.component.html deleted file mode 100644 index 6fa26eb..0000000 --- a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.html +++ /dev/null @@ -1 +0,0 @@ -<p>cooming-soon-header works!</p> diff --git a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.spec.ts b/src/app/module/components/cooming-soon-header/cooming-soon-header.component.spec.ts deleted file mode 100644 index 9df1034..0000000 --- a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CoomingSoonHeaderComponent } from './cooming-soon-header.component'; - -describe('CoomingSoonHeaderComponent', () => { - let component: CoomingSoonHeaderComponent; - let fixture: ComponentFixture<CoomingSoonHeaderComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ CoomingSoonHeaderComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(CoomingSoonHeaderComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.ts b/src/app/module/components/cooming-soon-header/cooming-soon-header.component.ts deleted file mode 100644 index 533005a..0000000 --- a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-cooming-soon-header', - templateUrl: './cooming-soon-header.component.html', - styleUrls: ['./cooming-soon-header.component.css'] -}) -export class CoomingSoonHeaderComponent { - -} diff --git a/src/app/module/components/slider/slider.component.css b/src/app/module/components/customUX/slider/slider.component.css similarity index 100% rename from src/app/module/components/slider/slider.component.css rename to src/app/module/components/customUX/slider/slider.component.css diff --git a/src/app/module/components/slider/slider.component.html b/src/app/module/components/customUX/slider/slider.component.html similarity index 100% rename from src/app/module/components/slider/slider.component.html rename to src/app/module/components/customUX/slider/slider.component.html diff --git a/src/app/module/components/slider/slider.component.spec.ts b/src/app/module/components/customUX/slider/slider.component.spec.ts similarity index 100% rename from src/app/module/components/slider/slider.component.spec.ts rename to src/app/module/components/customUX/slider/slider.component.spec.ts diff --git a/src/app/module/components/slider/slider.component.ts b/src/app/module/components/customUX/slider/slider.component.ts similarity index 100% rename from src/app/module/components/slider/slider.component.ts rename to src/app/module/components/customUX/slider/slider.component.ts diff --git a/src/app/module/components/thermometer/thermometer.component.html b/src/app/module/components/customUX/thermometer/thermometer.component.html similarity index 100% rename from src/app/module/components/thermometer/thermometer.component.html rename to src/app/module/components/customUX/thermometer/thermometer.component.html diff --git a/src/app/module/components/thermometer/thermometer.component.scss b/src/app/module/components/customUX/thermometer/thermometer.component.scss similarity index 100% rename from src/app/module/components/thermometer/thermometer.component.scss rename to src/app/module/components/customUX/thermometer/thermometer.component.scss diff --git a/src/app/module/components/thermometer/thermometer.component.spec.ts b/src/app/module/components/customUX/thermometer/thermometer.component.spec.ts similarity index 100% rename from src/app/module/components/thermometer/thermometer.component.spec.ts rename to src/app/module/components/customUX/thermometer/thermometer.component.spec.ts diff --git a/src/app/module/components/thermometer/thermometer.component.ts b/src/app/module/components/customUX/thermometer/thermometer.component.ts similarity index 100% rename from src/app/module/components/thermometer/thermometer.component.ts rename to src/app/module/components/customUX/thermometer/thermometer.component.ts diff --git a/src/app/module/components/lev0/lev0.component.html b/src/app/module/components/lev0/lev0.component.html deleted file mode 100644 index ae0d4b4..0000000 --- a/src/app/module/components/lev0/lev0.component.html +++ /dev/null @@ -1,180 +0,0 @@ -<div class="container-flex"> - <div class="header"> - <div class="header-left"> - <h4>Level 1 Summary</h4> - </div> - <div class="header-right"> - <div class="container-flex-cover"> - <mat-form-field appearance="outline"> - <mat-label>Enter a date range</mat-label> - <mat-date-range-input [formGroup]="range" [rangePicker]="picker"> - <input matStartDate formControlName="start" placeholder="Start date"> - <input matEndDate formControlName="end" placeholder="End date"> - </mat-date-range-input> - <mat-hint>MM/DD/YYYY – MM/DD/YYYY</mat-hint> - <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> - <mat-date-range-picker #picker></mat-date-range-picker> - - <mat-error *ngIf="range.controls.start.hasError('matStartDateInvalid')">Invalid start date</mat-error> - <mat-error *ngIf="range.controls.end.hasError('matEndDateInvalid')">Invalid end date</mat-error> - </mat-form-field> - </div> - </div> - </div> - - <div class="scroller"> - <div *ngFor="let sumAvg of sumOrAvg"> - <div class="card-b"> - <div class="header-left"> - <h5>{{sumAvg.name}}</h5> - <h2>{{sumAvg.value.toFixed(1)}}{{" "+unitMapper.get(sumAvg.sensorType)}}</h2> - <div class="display-flex"><h4>{{typeMapper.get( sumAvg.type)}}</h4></div> - </div> - <div class="header-right"> - <i class="material-icons" style="font-size:80px;color: black">{{iconMapper.get(sumAvg.sensorType)}}</i> - </div> - </div> - </div> - - </div> - - <div class="scroller" style="height: 500px"> - - <div *ngFor="let avgMMax of avgMinMax;let iX=index;"> - <div class="card-group" [ngStyle]="{'box-shadow':avgMMax.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':''}"> - <header> - <h5>{{avgMMax.name}}</h5> - </header> - <main> - <div class="min"> - <h3>Min</h3> - <h3>{{avgMMax.min.value.toFixed(2)}}</h3> - </div> - - <div class="avg"> - <h3>Avg</h3> - <h3>{{avgMMax.avg.toFixed(2)}}</h3> - </div> - - <div class="max"> - <h3>Min</h3> - <h3>{{avgMMax.max.value.toFixed(2)}}</h3> - </div> - </main> - - <div class="light-chart"> - <app-light-chart></app-light-chart> - </div> - - </div> - </div> - - - - </div> - - - - - - <p>Selected range: {{range.value.start | json}}</p> - - <button mat-button color="primary" (click)="send()">Primary</button> -</div> - - - - - - - -<!-- -<div class="container-flex"> - <div class="header"> - <div class="header-left"> - <h4>Level 0 Summary</h4> - </div> - <div class="header-right"> - <div class="container-flex-cover"> - <mat-form-field appearance="outline"> - <mat-label>From</mat-label> - <input matInput [matDatepicker]="picker"> - <mat-hint>MM/DD/YYYY</mat-hint> - <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> - <mat-datepicker #picker></mat-datepicker> - </mat-form-field> - </div> - </div> - </div> - - - <div class="main-lev0"> - <div class="header"> - - <div class="card-b"> - <div class="header-left"> - <h5>Rain Percipatation</h5> - <h2>230 mm</h2> - <div class="display-flex"><h4>12%</h4> <h6>more than yesterday</h6></div> - </div> - <div class="header-right"> - <svg xmlns="http://www.w3.org/2000/svg" width="75.557" height="75.557" viewBox="0 0 75.557 75.557"> - <path id="Icon_awesome-cloud-rain" data-name="Icon awesome-cloud-rain" d="M61.39,18.889c-.089,0-.162.03-.236.03a11.524,11.524,0,0,0,.236-2.391A11.759,11.759,0,0,0,40.582,8.972,16.472,16.472,0,0,0,9.445,16.528a16.782,16.782,0,0,0,.31,3.129,14.131,14.131,0,0,0,4.412,27.567H61.39a14.167,14.167,0,0,0,0-28.334Zm-48.4,36.332c-1.889,6.552-5.9,8.323-5.9,12.942a7.241,7.241,0,0,0,7.083,7.393,7.241,7.241,0,0,0,7.083-7.393c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,12.986,55.222Zm23.612,0c-1.889,6.552-5.9,8.323-5.9,12.942a7.09,7.09,0,1,0,14.167,0c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,36.6,55.222Zm23.612,0c-1.889,6.552-5.9,8.323-5.9,12.942a7.09,7.09,0,1,0,14.167,0c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,60.21,55.222Z"/> - </svg> - </div> - </div> - - <div class="card-b"> - <div class="header-left"> - <h5>Rain Percipatation</h5> - <h2>230 mm</h2> - <div class="display-flex"><h4>12%</h4> <h6>more than yesterday</h6></div> - - </div> - <div class="header-right"> - <svg xmlns="http://www.w3.org/2000/svg" width="75.557" height="75.557" viewBox="0 0 75.557 75.557"> - <path id="Icon_awesome-cloud-rain" data-name="Icon awesome-cloud-rain" d="M61.39,18.889c-.089,0-.162.03-.236.03a11.524,11.524,0,0,0,.236-2.391A11.759,11.759,0,0,0,40.582,8.972,16.472,16.472,0,0,0,9.445,16.528a16.782,16.782,0,0,0,.31,3.129,14.131,14.131,0,0,0,4.412,27.567H61.39a14.167,14.167,0,0,0,0-28.334Zm-48.4,36.332c-1.889,6.552-5.9,8.323-5.9,12.942a7.241,7.241,0,0,0,7.083,7.393,7.241,7.241,0,0,0,7.083-7.393c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,12.986,55.222Zm23.612,0c-1.889,6.552-5.9,8.323-5.9,12.942a7.09,7.09,0,1,0,14.167,0c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,36.6,55.222Zm23.612,0c-1.889,6.552-5.9,8.323-5.9,12.942a7.09,7.09,0,1,0,14.167,0c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,60.21,55.222Z"/> - </svg> - </div> - </div> - - - <div class="card-b"> - <div class="header-left"> - <h5>Rain Percipatation</h5> - <h2>230 mm</h2> - <div class="display-flex"><h4>12%</h4> <h6>more than yesterday</h6></div> - - </div> - <div class="header-right"> - <svg xmlns="http://www.w3.org/2000/svg" width="75.557" height="75.557" viewBox="0 0 75.557 75.557"> - <path id="Icon_awesome-cloud-rain" data-name="Icon awesome-cloud-rain" d="M61.39,18.889c-.089,0-.162.03-.236.03a11.524,11.524,0,0,0,.236-2.391A11.759,11.759,0,0,0,40.582,8.972,16.472,16.472,0,0,0,9.445,16.528a16.782,16.782,0,0,0,.31,3.129,14.131,14.131,0,0,0,4.412,27.567H61.39a14.167,14.167,0,0,0,0-28.334Zm-48.4,36.332c-1.889,6.552-5.9,8.323-5.9,12.942a7.241,7.241,0,0,0,7.083,7.393,7.241,7.241,0,0,0,7.083-7.393c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,12.986,55.222Zm23.612,0c-1.889,6.552-5.9,8.323-5.9,12.942a7.09,7.09,0,1,0,14.167,0c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,36.6,55.222Zm23.612,0c-1.889,6.552-5.9,8.323-5.9,12.942a7.09,7.09,0,1,0,14.167,0c0-4.634-4.014-6.36-5.9-12.942A1.218,1.218,0,0,0,60.21,55.222Z"/> - </svg> - </div> - </div> - - </div> - <div class="main"> - <app-light-chart></app-light-chart> - </div> - - </div> - - -</div> -<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,600,0,0" /> -<div class="scroller"> - <div *ngFor="let sumAvg of sumOrAvg"> - <div class="card-b"> - <div class="header-left"> - <h5>{{sumAvg.name}}</h5> - <h2>{{sumAvg.value.toFixed(1)}}{{" "+unitMapper.get(sumAvg.sensorType)}}</h2> - <div class="display-flex"><h4>{{typeMapper.get( sumAvg.type)}}</h4></div> - </div> - <div class="header-right"> - <i class="material-icons" style="font-size:80px;color: black">{{iconMapper.get(sumAvg.sensorType)}}</i> - </div> - </div> - </div> -</div> ---> diff --git a/src/app/module/components/lev0/lev0.component.scss b/src/app/module/components/lev0/lev0.component.scss deleted file mode 100644 index b156198..0000000 --- a/src/app/module/components/lev0/lev0.component.scss +++ /dev/null @@ -1,350 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700;800&display=swap'); -.display-flex{ - display: flex; - flex-direction: row; - - align-items: flex-end; - -} - -.container-flex{ - height: 100vh; - width: 100%; - background-color: #F5F7FC; - display: flex; - flex-direction: column; -} - -.container-flex-cover{ - margin-top: 7vh; - margin-right: 5vh; -} - -.header{ -// background-color: black; - min-height: 200px; - width: 100%; - display: flex; - flex-wrap: wrap; -} - -.header-left{ - // background-color: white; - flex: 50%; - - h4{ - margin-top: 10vh; - margin-left: 15vh; - font-family: 'Poppins', sans-serif; - font-weight:600; - } -} - -.header-right{ - // background-color: brown; - flex: 50%; - display: flex; - justify-content: flex-end; -} - - -.main-lev0{ - display: flex; - height:80vh; - width: 100%; - flex-direction: column; - // background-color: #f1f1f1; - .main{ - height: 100vh; - width: 100%; - } -} - -.card-b{ - height: 150px; - width: 400px; - background-color: white; - margin-left: 30px; - border-radius: 6px; - display: flex; - flex: 0 0 400px; - flex-wrap: nowrap; - flex-shrink: 0; - - - .header-left{ - display: flex; - flex-direction: column; - padding-left: 10px; - justify-content: space-around; - - h5{ - font-family: 'Poppins', sans-serif; - font-weight:400; - font-size: 16px; - color: #7E84A3; - } - h2{ - margin: 0px; - font-family: 'Poppins', sans-serif; - font-weight:600; - font-size: 28px; - color: black; - - } - - h4{ - margin: 0px; - font-family: 'Poppins', sans-serif; - font-weight:600; - font-size: 16px; - color: #6ED29D; - - - } - h6{ - margin: 0px; - font-family: 'Poppins', sans-serif; - font-weight:400; - font-size: 12px; - color: #7E84A3; - padding-bottom: 2px; - padding-left: 5px; - } - } - - .header-right{ - display: flex; - align-items: center; - justify-content: center; - - .img{ - height: 50px; - width: 50px; - background-image: url("../../../../assets/Icon-awesome-cloud-rain.png"); - background-repeat: no-repeat; - background-size: cover; - } - } - -} - -.scroller{ - margin-top: 20px; - background-color: #F5F7FC; - line-height: 1; - display: grid; - grid-auto-flow: column; - grid-auto-columns: 38%; - overflow-x: auto; - flex-shrink: 0; - -} - -@media only screen and (min-width: 1600px) { - .scroller{ - grid-auto-columns: 25%; - } -} - -@media only screen and (max-width: 1100px) { - .scroller{ - grid-auto-columns: 60%; - } -} - - -@media only screen and (max-width: 730px) { - .scroller{ - grid-auto-columns: 120%; - } -} - -@media only screen and (max-width: 600px) { - .scroller{ - grid-auto-columns: 140%; - } -} - -.scroller:hover { - overflow-x: scroll; - -} - - -.card-group{ - - - width: 450px; - background-color:white; - margin-left: 30px; - border-radius: 6px; - display: flex; - flex-direction: column; - - - header{ - margin-top: 20px; - display: flex; - justify-content: center; - align-content: center; - width: 100%; - } - - main{ - display: flex; - flex-direction: row; - width: 100%; - justify-content: space-around; - } - - - - .light-chart{ - display: flex; - height: 300px; - width: 100%; - justify-content: center; - } - .min{ - height: 90px; - width: 90px; - border: 2px solid green; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - margin-left: 20px; - } - - .max { - @extend .min; - border: 2px solid #ff0000; - } - - .avg{ - @extend .min; - border: 2px solid black; - } - - h5{ - font-family: 'Poppins', sans-serif; - font-weight:400; - font-size: 16px; - color: #7E84A3; - } - h2{ - margin: 0px; - font-family: 'Poppins', sans-serif; - font-weight:600; - font-size: 28px; - color: black; - - } - - h4{ - margin: 0px; - font-family: 'Poppins', sans-serif; - font-weight:600; - font-size: 16px; - color: #6ED29D; - - - } - h6{ - margin: 0px; - font-family: 'Poppins', sans-serif; - font-weight:400; - font-size: 12px; - color: #7E84A3; - padding-bottom: 2px; - padding-left: 5px; - } -} - -@import "https://unpkg.com/open-props"; -@import "https://unpkg.com/open-props/normalize.min.css"; - -.media-scroller { - --_spacer: var(--size-3); - display: grid; - gap: var(--_spacer); - grid-auto-flow: column; - grid-auto-columns: 21%; - - padding: 0 var(--_spacer) var(--_spacer); - - overflow-x: auto; - overscroll-behavior-inline: contain; -} - -.media-scroller--with-groups { - grid-auto-columns: 80%; -} - -.media-group { - display: grid; - gap: var(--_spacer); - grid-auto-flow: column; -} - -.media-element { - display: grid; - grid-template-rows: min-content; - - gap: var(--_spacer); - padding: var(--_spacer); - background: var(--surface-2); - border-radius: var(--radius-2); - box-shadow: var(--shadow-2); -} - -.media-element > img { - inline-size: 100%; - aspect-ratio: 16 / 9; - object-fit: cover; -} - -.snaps-inline { - scroll-snap-type: inline mandatory; - scroll-padding-inline: var(--_spacer, 1rem); -} - -.snaps-inline > * { - scroll-snap-align: start; -} - -/* general styling */ - -.container { - inline-size: min(100% - 4rem, 70rem); - margin-inline: auto; -} - -.flow { - display: grid; - gap: var(--size-3); -} - -.page-header { - padding-block: var(--size-9); - margin-block-end: var(--size-9); - background: var(--gradient-16); - color: var(--gray-0); - box-shadow: var(--shadow-2); -} - -.page-title { - font-size: var(--font-size-fluid-3); -} - -.page-subtitle { - font-size: var(--font-size-fluid-1); -} - -.section-title { - padding-inline-start: var(--size-6); - margin-block: var(--size-9) var(--size-3); -} - - diff --git a/src/app/module/components/lev0/lev0.component.spec.ts b/src/app/module/components/lev0/lev0.component.spec.ts deleted file mode 100644 index cfe4f39..0000000 --- a/src/app/module/components/lev0/lev0.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Lev0Component } from './lev0.component'; - -describe('Lev0Component', () => { - let component: Lev0Component; - let fixture: ComponentFixture<Lev0Component>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ Lev0Component ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(Lev0Component); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/components/lev0/lev0.component.ts b/src/app/module/components/lev0/lev0.component.ts deleted file mode 100644 index a62e093..0000000 --- a/src/app/module/components/lev0/lev0.component.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { Component } from '@angular/core'; -import {ApiService} from "../../../shared/api.service"; -import {Lv1} from "../../../core/service/level1/Lv1"; -import {AvgMinMax} from "../../../core/service/level1/AvgMinMax"; -import {SumOrAvg} from "../../../core/service/level1/SumOrAvg"; -import {FormControl, FormGroup} from "@angular/forms"; -import {DatePipe} from "@angular/common"; - -@Component({ - selector: 'app-lev0', - templateUrl: './lev0.component.html', - styleUrls: ['./lev0.component.scss'] -}) -export class Lev0Component { - heros: Hero[] = [ - { id: 12, name: 'Dr. Nice' }, - { id: 13, name: 'Bombasto' }, - { id: 14, name: 'Celeritas' }, - { id: 15, name: 'Magneta' }, - { id: 16, name: 'RubberMan' }, - { id: 17, name: 'Dynama' }, - { id: 18, name: 'Dr. IQ' }, - { id: 19, name: 'Magma' }, - { id: 20, name: 'Tornado' } - ]; - constructor(private api:ApiService) { - } - lv1:Lv1|undefined; - avgMinMax:AvgMinMax[]=[] - sumOrAvg:SumOrAvg[]=[] - - range = new FormGroup({ - start: new FormControl<Date | null>(null), - end: new FormControl<Date | null>(null), - }); - - iconMapper = new Map<String, String>([ - ["SOLAR_RADIATION", "sunny"], - ["SOIL_MOISTURE", "water"] - ]); - - unitMapper = new Map<String, String>([ - ["SOLAR_RADIATION", "w/m2"], - ["SOIL_MOISTURE", "vwc"] - ]); - - typeMapper = new Map<String, String>([ - ["AVG", "Durchschnitt"], - ["SUM", "Totale Summe"] - ]); - - - ngOnInit(){ - this.api.get("http://localhost:8080/api/v1/server/get/lvl1/IBK?from=15.04.2022 00:00:00&to=15.04.2022 23:30:00").subscribe( - res=>{ - this.lv1=res - console.log(res) - console.log("avgMinMax",this.lv1?.avgMinMax[0].min.value) - // @ts-ignore - this.avgMinMax=this.lv1.avgMinMax - console.log("sumOrAvg",this.lv1?.sumOrAvg[0].type) - // @ts-ignore - this.sumOrAvg=this.lv1.sumOrAvg - } - ) - } - - send() { - console.log(this.range.value.start?.toISOString().replace("T"," ").replace("Z","")) - let from=this.range.value.start?.toISOString().replace("T"," ").replace("Z","").replaceAll(':',"."); - let to=this.range.value.end?.toISOString().replace("T"," ").replace("Z","").replaceAll(':',"."); - console.log(from+"&"+to) - let datePipe = new DatePipe('en-US'); - let dateStart = datePipe.transform(this.range.value.start, 'dd.MM.yyyy HH:mm:ss'); - let dateEnd = datePipe.transform(this.range.value.end, 'dd.MM.yyyy HH:mm:ss'); - console.log(dateStart) - console.log(dateEnd) - console.log("http://localhost:8080/api/v1/server/get/lvl1/IBK?from="+dateStart+"&to="+dateEnd) - this.api.get("http://localhost:8080/api/v1/server/get/lvl1/IBK?from="+dateStart+"&to="+dateEnd).subscribe( - res=>{ - this.lv1=res - console.log(res) - console.log("avgMinMax",this.lv1?.avgMinMax[0].min.value) - // @ts-ignore - this.avgMinMax=this.lv1.avgMinMax - console.log(this.avgMinMax) - console.log("sumOrAvg",this.lv1?.sumOrAvg[0].type) - // @ts-ignore - this.sumOrAvg=this.lv1.sumOrAvg - } - ) - } -} -export interface Hero { - id: number; - name: string; -} diff --git a/src/app/module/components/pro-view/pro-view.component.html b/src/app/module/components/pro-view/pro-view.component.html index c94d559..ef86952 100644 --- a/src/app/module/components/pro-view/pro-view.component.html +++ b/src/app/module/components/pro-view/pro-view.component.html @@ -1,139 +1,82 @@ <div class="flex-col"> -<form class="mt-10 flex flex-wrap justify-center sm:justify-between w-full - [&>*]:w-full [&>*]:sm:w-1/4 [&>*]:p-2"> - <mat-form-field class=" " appearance="fill"> - <mat-label>Select a Station</mat-label> - <input type="text" - placeholder="Pick one" - aria-label="Number" - matInput - [formControl]="stationControl" - [matAutocomplete]="auto1" - (ngModelChange)="checkSelect(stationControl,$event)"> - <mat-error *ngIf="stationControl.hasError('invalid')">This Station does not exists</mat-error> - <mat-autocomplete #auto1="matAutocomplete"> - - <mat-option *ngFor="let option1 of filteredStation | async" [value]="option1" > - <mat-checkbox class="example-margin"></mat-checkbox> - {{option1}} - </mat-option> - </mat-autocomplete> - </mat-form-field> - - <mat-form-field> - <mat-select placeholder="Host/Client" [formControl]="hostClientControl" (selectionChange)="onSelectionChangeClientHostInput($event.value)" multiple> - <mat-option *ngFor="let topping of availableHostClientsO" [value]="topping" >{{topping.value}}</mat-option> - </mat-select> - </mat-form-field> - - <mat-form-field> - <mat-select placeholder="Sensors" [formControl]="sensorControl" multiple (selectionChange)="onSelectionChange2($event.value)"> - <mat-option *ngFor="let topping of availableSensors" [value]="topping" >{{topping}} </mat-option> - </mat-select> - </mat-form-field> - - <mat-form-field appearance="fill" > - <mat-label>Enter a date range</mat-label> - <mat-date-range-input [formGroup]="range" [rangePicker]="picker"> - <input matStartDate formControlName="start" placeholder="Start date"> - <input matEndDate formControlName="end" placeholder="End date"> - </mat-date-range-input> - <mat-hint>MM/DD/YYYY – MM/DD/YYYY</mat-hint> - <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> - <mat-date-range-picker #picker></mat-date-range-picker> - <mat-error *ngIf="range.controls.start.hasError('matStartDateInvalid')">Invalid start date</mat-error> - <mat-error *ngIf="range.controls.end.hasError('matEndDateInvalid')">Invalid end date</mat-error> - </mat-form-field> -</form> - -<!-- -<mat-form-field class=" " appearance="fill" *ngIf="t_bool"> - <mat-label>Select a Station</mat-label> - <input type="text" - placeholder="Pick one" - aria-label="Number" - matInput - [formControl]="t_control" - [matAutocomplete]="auto2"> - <mat-error *ngIf="stationControl.hasError('invalid')">This Station does not exists</mat-error> - - - <mat-autocomplete #auto2="matAutocomplete"> - <div *ngIf="t_bool"> - <mat-select> - <mat-option *ngFor="let option2 of t_filterdString | async" [value]="option2" > - <mat-checkbox class="example-margin"></mat-checkbox> - {{option2}} - </mat-option> - </mat-select> - </div> - </mat-autocomplete> - -</mat-form-field> - - -<mat-form-field class="" appearance="fill"> - <mat-label>Favorite food</mat-label> - <input matInput placeholder="Ex. Pizza" value="Sushi" [formControl]="t_control2" (focus)="onFocus()" - (blur)="onBlur()" #inputField> -</mat-form-field> - -<div *ngIf="isFocused " class="relative inline-block text-left" > - <div class="absolute overflow-y-auto h-32 right-0 z-10 mt-2 w-56 origin-top-right rounded-md - bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none" - role="menu" aria-orientation="vertical" aria-labelledby="menu-button" tabindex="-1" - tabindex="-1" - (focus)="menuOpen=true" (blur)="menuOpen=false"> - <div *ngFor="let x of t_string" class="py-1" role="none" > - <a class="text-gray-700 block px-4 py-0.5 text-sm" role="menuitem" id="menu-item-0" - (click)="isFocused=true; inputField.focus()"> - <mat-checkbox class="example-margin" ></mat-checkbox>{{x}} - </a> - </div> - </div> -</div> -{{isFocused}}{{menuOpen}} + <!--Input field --> + <form class="mt-10 flex flex-wrap justify-center sm:justify-between w-full + [&>*]:w-full [&>*]:sm:w-1/4 [&>*]:p-2"> ---> -<div class="flex flex-wrap w-full justify-center sm:justify-end + <mat-form-field class=" " appearance="fill"> + <mat-label>Select a Station</mat-label> + <input type="text" + placeholder="Pick one" + aria-label="Number" + matInput + [formControl]="stationControl" + [matAutocomplete]="auto1" + (ngModelChange)="checkSelect(stationControl,$event)"> + <mat-error *ngIf="stationControl.hasError('invalid')">This Station does not exists</mat-error> + <mat-autocomplete #auto1="matAutocomplete"> + + <mat-option *ngFor="let option1 of filteredStation | async" [value]="option1"> + <mat-checkbox class="example-margin"></mat-checkbox> + {{option1}} + </mat-option> + </mat-autocomplete> + </mat-form-field> + + <mat-form-field> + <mat-select placeholder="Host/Client" [formControl]="hostClientControl" + (selectionChange)="onSelectionChangeClientHostInput($event.value)" multiple> + <mat-option *ngFor="let topping of availableHostClientsO" [value]="topping">{{topping.value}}</mat-option> + </mat-select> + </mat-form-field> + + <mat-form-field> + <mat-select placeholder="Sensors" [formControl]="sensorControl" multiple + (selectionChange)="onSelectionChange2($event.value)"> + <mat-option *ngFor="let topping of availableSensors" [value]="topping">{{topping}} </mat-option> + </mat-select> + </mat-form-field> + + <mat-form-field appearance="fill"> + <mat-label>Enter a date range</mat-label> + <mat-date-range-input [formGroup]="range" [rangePicker]="picker"> + <input matStartDate formControlName="start" placeholder="Start date"> + <input matEndDate formControlName="end" placeholder="End date"> + </mat-date-range-input> + <mat-hint>MM/DD/YYYY – MM/DD/YYYY</mat-hint> + <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> + <mat-date-range-picker #picker></mat-date-range-picker> + <mat-error *ngIf="range.controls.start.hasError('matStartDateInvalid')">Invalid start date</mat-error> + <mat-error *ngIf="range.controls.end.hasError('matEndDateInvalid')">Invalid end date</mat-error> + </mat-form-field> + </form> + + <div class="flex flex-wrap w-full justify-center sm:justify-end [&>*]:w-full [&>*]:sm:w-1/4 [&>*]:h-16 [&>*]:p-2 "> -<!-- - <div class=""> - <section class="bg-slate-100 h-full w-full flex items-center rounded-2xl"> - <mat-checkbox [(ngModel)]="isChecked" class="m-2">Select Me</mat-checkbox> - </section> - </div> ---> - - - - - <div class=""> - <section class=" h-full w-full flex items-center rounded-2xl"> - <button class="w-full h-full" mat-raised-button color="primary" (click)="downloadCSV4()">Download Data <mat-icon>download</mat-icon></button> - </section> + <div class=""> + <section class=" h-full w-full flex items-center rounded-2xl"> + <button class="w-full h-full" mat-raised-button color="primary" (click)="downloadCSV4()">Download Data + <mat-icon>download</mat-icon> + </button> + </section> + </div> </div> -</div> - -<app-Cjs-timeline-multiple *ngIf="this.sensorControl.value?.length!=1||!isDendrometer" [chartId]="chartId_chartAll" #timeline [sensorData]="this.sensorData" [sensorDataArray]="this.sensorDataArray" > -</app-Cjs-timeline-multiple> - - + <!--Graph SensorData--> + <app-Cjs-timeline-multiple *ngIf="this.sensorControl.value?.length!=1||!isDendrometer" [chartId]="chartId_chartAll" + #timeline [sensorData]="this.sensorData" [sensorDataArray]="this.sensorDataArray"> + </app-Cjs-timeline-multiple> </div> - - - - - -<div #dendrometer *ngIf="sensorControl.value?.length==1&&isDendrometer" class="w-full flex flex-row items-end justify-center flex-wrap "> +<!--Graph Dendrometer--> +<div #dendrometer *ngIf="sensorControl.value?.length==1&&isDendrometer" + class="w-full flex flex-row items-end justify-center flex-wrap "> <div class="card-dendrometer"> + <!--Header of Dendrometer --> <h1>Dendrometer</h1> <div class="headers"> @@ -152,8 +95,9 @@ <h5>tatsächliche Ausdehnung</h5> </div> </div> - - <app-Cjs-timline [chartId]="chartId_dendrometer" *ngIf="threePhaseDendromete" [threePhaseDenrometer]="this.threePhaseDendromete"></app-Cjs-timline> + <!--Graph Dendrometer--> + <app-Cjs-timline [chartId]="chartId_dendrometer" *ngIf="threePhaseDendromete" + [threePhaseDenrometer]="this.threePhaseDendromete"></app-Cjs-timline> </div> </div> diff --git a/src/app/module/components/pro-view/pro-view.component.ts b/src/app/module/components/pro-view/pro-view.component.ts index a53097b..9e78848 100644 --- a/src/app/module/components/pro-view/pro-view.component.ts +++ b/src/app/module/components/pro-view/pro-view.component.ts @@ -5,7 +5,6 @@ import {map, startWith} from 'rxjs/operators'; import { ClientControllerService, HostControllerService, SensorControllerService, - ServerControllerService, Station, StationControllerService } from "../../../../../projects/swagger-client/src"; @@ -15,8 +14,6 @@ import {LogLevel, MyLoggerServiceService} from "../../../shared/service/my-logge import {ThreePhaseDendrometer} from "../../../core/service/level1/ThreePhaseDendrometer"; import {HttpClient} from "@angular/common/http"; -//TODOS after from this.serverControllerService.getReadingsBySensorIdAndTimeRange return type is changed i can uncomment the @ts-ignore -// @Component({ selector: 'app-pro-view', templateUrl: './pro-view.component.html', @@ -75,33 +72,17 @@ t_bool:boolean=true showDendrometer:boolean=this.isDendrometer&&this.sensorControl.value?.length==1 station!: Observable<Array<Station>>; constructor(private stationControllerService: StationControllerService,private hostControllerService:HostControllerService, - private clientControllerService:ClientControllerService,private serverControllerService:ServerControllerService, + private clientControllerService:ClientControllerService, private sensorControllerService:SensorControllerService, private datePipe: DatePipe, private logger:MyLoggerServiceService, - private http:HttpClient, - private elementRef: ElementRef + private http:HttpClient ) { this.logger.setLevel(LogLevel.LOG) this.logger.setTopic("ProViewInputParent") } ngOnInit() { - - -/* - this.http.get("http://localhost:8080/api/v1/server/get/dendrometer/range?sensorId=ddm_id_1&from=15-04-2022T00:00:00&to=15-04-2022T23:59:59").subscribe( - // @ts-ignore - x=>this.logger.info("dendrometer",this.threePhaseDendromete=x)) -*/ - //test for dendrometer - const date = new Date('2022-04-15T00:00:00'); - const formattedDate = this.datePipe.transform(date, 'dd-MM-yyyy'); - this.serverControllerService.getLevelOneResponseForGroupAndTimeRange("as",date).subscribe( - x=>this.logger.info("dendrometer",x) - ) - - //If Date Input changes than call Selected Method this.range.valueChanges.subscribe((value) => { this.onSelectionChange2([]) @@ -260,7 +241,10 @@ t_bool:boolean=true console.log("s_id",s_id) //save the data from the API in sensorDataArry=>passed to child element + used for visualisation this.sensorControl.value.forEach((sensor:string)=> - this.serverControllerService.getReadingsBySensorIdAndTimeRange(sensor, dateStart + "", dateEnd + "").subscribe( + // this.serverControllerService.getReadingsBySensorIdAndTimeRange(sensor, dateStart + "", dateEnd + "").subscribe( + this.http.get("http://localhost:8080/api/v1/server/get/sensor/range?sensorId="+sensor + +"&from="+dateStart + +"&to="+ dateEnd).subscribe( s => { console.log(s) // @ts-ignore @@ -273,16 +257,6 @@ t_bool:boolean=true ) } } - - - ngAfterViewInit() { - // const cjsTimeline = this.elementRef.nativeElement.querySelector('#timeline'); - // const firstElement = this.elementRef.nativeElement.querySelector('#dendrometer'); - // cjsTimeline.style.display = 'block'; - // firstElement.style.display = 'block'; - } - - } export interface checkHostsStation{ diff --git a/src/app/module/components/lev0Ver2/lev0.component.html b/src/app/module/components/summaryIcons/summaryIcons.component.html similarity index 70% rename from src/app/module/components/lev0Ver2/lev0.component.html rename to src/app/module/components/summaryIcons/summaryIcons.component.html index c292c03..9b3df3b 100644 --- a/src/app/module/components/lev0Ver2/lev0.component.html +++ b/src/app/module/components/summaryIcons/summaryIcons.component.html @@ -1,68 +1,16 @@ -<!--<div class="w-full bg-gray-100 flex flex-col"> - -<div class="w-full flex flex-row items-end justify-start flex-wrap "> - <div class="header"> - <div class="header-left"> - <h4>Tages-Zusammenfassung der Daten</h4> - </div> - - - - <div class="header-right"> - <div class="container-flex-cover" > - <mat-form-field appearance="outline"> - <mat-select placeholder="Station" [formControl]="stationControl" > - <mat-option *ngFor="let topping of availableStation" [value]="topping" >{{topping}} </mat-option> - </mat-select> - </mat-form-field> - </div> - <div class="container-flex-cover"> - <mat-form-field appearance="outline"> - <mat-label>Wähle ein Datum</mat-label> - <input matInput [matDatepicker]="picker" [formControl]="dateControl"> - <mat-hint>MM/DD/YYYY</mat-hint> - <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> - <mat-datepicker #picker></mat-datepicker> - </mat-form-field> - - </div> - </div> - </div> - - <div *ngFor="let sumAvg of sumOrAvg" > - <div class="card-b"> - <div class="header-left"> - <h5>{{sumAvg.name}}</h5> - <h2 *ngIf="sumAvg.measurementType?.toString()=='SOLAR_RADIATION' "> - {{sumAvg.value?.toFixed(3)}}{{" "}}w/m<sup>2</sup> - </h2> - <h2 *ngIf="sumAvg.measurementType?.toString()!='SOLAR_RADIATION' "> - {{sumAvg.value?.toFixed(3)}}{{" "+unitMapper.get(sumAvg.measurementType+"")}} - </h2> - <div><h4>{{typeMapper.get( sumAvg.type+"")}}</h4></div> - </div> - <div class="header-right"> - <i class="material-icons" style="font-size:80px;color: black">{{iconMapper.get(sumAvg.measurementType+"")}}</i> - </div> - - </div> - </div> - -</div> - - --> - <div class="w-full bg-gray-100 flex flex-col"> - + <!--Input field --> <div class="flex min-h-min w-full "> <div class="flex min-h-full w-1/2 justify-start pl-8 pt-3"> <div class="flex items-center pl-2 rounded h-14 border border-indigo-600"> Tages Sensor Werte - <button (click)="sendSignal1(1)" type="button" class="ml-8 h-full px-4 inline-flex justify-center items-center gap-2 rounded-md border-2 border-indigo-200 font-semibold text-indigo-500 hover:text-white hover:bg-indigo-500 hover:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"> + <button (click)="sendSignal1(1)" type="button" class="ml-8 h-full px-4 inline-flex justify-center items-center gap-2 rounded-md border-2 border-indigo-200 font-semibold text-indigo-500 + hover:text-white hover:bg-indigo-500 hover:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"> <mat-icon >grid_view</mat-icon> </button> - <button (click)="sendSignal1(2)" type="button" class="h-full px-4 inline-flex justify-center items-center gap-2 rounded-md border-2 border-indigo-200 font-semibold text-indigo-500 hover:text-white hover:bg-indigo-500 hover:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"> + <button (click)="sendSignal1(2)" type="button" class="h-full px-4 inline-flex justify-center items-center gap-2 rounded-md border-2 border-indigo-200 font-semibold text-indigo-500 + hover:text-white hover:bg-indigo-500 hover:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"> <mat-icon>table_rows</mat-icon> </button> </div> @@ -89,6 +37,7 @@ <div class="w-full flex flex-row items-end justify-start flex-wrap"> + <!--Data of Sum or Average --> <div *ngFor="let sumAvg of sumOrAvg" > <div class="card-b"> <div class="header-left"> @@ -112,7 +61,7 @@ </div> - + <!--Data of Min Max Avg --> <div class="w-full flex flex-row items-end justify-start flex-wrap"> <div *ngFor="let avgMMax of avgMinMax;let iX=index;"> <div class="card-group" [ngStyle]="{'box-shadow':avgMMax.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':'rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px'}"> @@ -148,10 +97,8 @@ </div> </div> - + <!--Data of Min Max Avg --> <div class="w-full flex flex-row justify-start flex-wrap "> - - <div class="flex-col p-2 m-4 bg-white justify-center items-center rounded" *ngFor="let dent of dentrometerDailyValue" [ngStyle]="{'box-shadow':dent.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':'rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px'}"> @@ -186,10 +133,7 @@ </div> </div> - </div> - - </div> diff --git a/src/app/module/components/lev0Ver2/lev0.component.scss b/src/app/module/components/summaryIcons/summaryIcons.component.scss similarity index 100% rename from src/app/module/components/lev0Ver2/lev0.component.scss rename to src/app/module/components/summaryIcons/summaryIcons.component.scss diff --git a/src/app/module/components/lev0Ver2/lev0.component.spec.ts b/src/app/module/components/summaryIcons/summaryIcons.component.spec.ts similarity index 57% rename from src/app/module/components/lev0Ver2/lev0.component.spec.ts rename to src/app/module/components/summaryIcons/summaryIcons.component.spec.ts index cfe4f39..4a572b2 100644 --- a/src/app/module/components/lev0Ver2/lev0.component.spec.ts +++ b/src/app/module/components/summaryIcons/summaryIcons.component.spec.ts @@ -1,18 +1,17 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Lev0Component } from './lev0.component'; +import {SummaryIconsComponent} from './summaryIcons.component'; describe('Lev0Component', () => { - let component: Lev0Component; - let fixture: ComponentFixture<Lev0Component>; + let component: SummaryIconsComponent; + let fixture: ComponentFixture<SummaryIconsComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ Lev0Component ] + declarations: [ SummaryIconsComponent ] }) .compileComponents(); - fixture = TestBed.createComponent(Lev0Component); + fixture = TestBed.createComponent(SummaryIconsComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/module/components/lev0Ver2/lev0.component.ts b/src/app/module/components/summaryIcons/summaryIcons.component.ts similarity index 90% rename from src/app/module/components/lev0Ver2/lev0.component.ts rename to src/app/module/components/summaryIcons/summaryIcons.component.ts index 116f772..ea999a3 100644 --- a/src/app/module/components/lev0Ver2/lev0.component.ts +++ b/src/app/module/components/summaryIcons/summaryIcons.component.ts @@ -1,8 +1,5 @@ -import {Component, EventEmitter, Output} from '@angular/core'; +import {Component} from '@angular/core'; import {ApiService} from "../../../shared/api.service"; - - -//import {SumOrAvg} from "../../../core/service/level1/SumOrAvg"; import {FormControl, FormGroup} from "@angular/forms"; import {DatePipe} from "@angular/common"; import {ThreePhaseDendrometer} from "../../../core/service/level1/ThreePhaseDendrometer"; @@ -13,8 +10,6 @@ import { ServerControllerService, SumOrAvg } from "../../../../../projects/generated-api/src"; -import {Lv1} from "../../../core/service/level1/Lv1"; -import {map, startWith} from "rxjs/operators"; import { StationControllerService } from 'projects/swagger-client/src'; import {Router} from "@angular/router"; import {SharedService} from "../../../shared/shared-service.service"; @@ -23,11 +18,11 @@ import {SharedService} from "../../../shared/shared-service.service"; @Component({ - selector: 'app-lev0Ver2', - templateUrl: './lev0.component.html', - styleUrls: ['./lev0.component.scss'] + selector: 'app-summaryIcons', + templateUrl: './summaryIcons.component.html', + styleUrls: ['./summaryIcons.component.scss'] }) -export class Lev0Ver2Component { +export class SummaryIconsComponent { diff --git a/src/app/module/components/lev0-ver3/lev0-ver3.component.html b/src/app/module/components/summaryList/summaryList.html similarity index 56% rename from src/app/module/components/lev0-ver3/lev0-ver3.component.html rename to src/app/module/components/summaryList/summaryList.html index b0d6c05..df5cd6a 100644 --- a/src/app/module/components/lev0-ver3/lev0-ver3.component.html +++ b/src/app/module/components/summaryList/summaryList.html @@ -173,205 +173,3 @@ </div> -<!-- -<div class="bg-white"> </div> -<div class="flex w-1/2 rounded-xl bg-violet-300 flex-col divide-y divide-slate-800 [&>*]:py-4 "> - <div class=" flex items-center [&>*]:mx-2"> - <h1 class="text-xs font-bold">Solar Radiation</h1> - <mat-icon>sunny</mat-icon> - <app-slider class="w-32 -translate-y-2"></app-slider> - </div> - - <div class=" flex items-center [&>*]:mx-2"> - <h1 class="text-xs font-bold">Solar Radiation</h1> - <mat-icon>sunny</mat-icon> - <app-slider class="w-32 -translate-y-2"></app-slider> - </div> - - - <div class=" flex items-center [&>*]:mx-2"> - <h1 class="text-xs font-bold">Solar Radiation</h1> - <mat-icon>sunny</mat-icon> - <app-slider class="w-32 -translate-y-2"></app-slider> - </div> -</div> - ---> - - -<!-- -<div class="w-full bg-gray-100 flex flex-col"> - - <div class="w-full flex flex-row items-end justify-start flex-wrap "> - <div class="header"> - <div class="header-left"> - <h4>Tages-Zusammenfassung der Daten</h4> - </div> - - - - <div class="header-right"> - <div class="container-flex-cover" > - <mat-form-field appearance="outline"> - <mat-select placeholder="Station" [formControl]="stationControl" > - <mat-option *ngFor="let topping of availableStation" [value]="topping" >{{topping}} </mat-option> - </mat-select> - </mat-form-field> - </div> - <div class="container-flex-cover"> - <mat-form-field appearance="outline"> - <mat-label>Wähle ein Datum</mat-label> - <input matInput [matDatepicker]="picker" [formControl]="dateControl"> - <mat-hint>MM/DD/YYYY</mat-hint> - <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle> - <mat-datepicker #picker></mat-datepicker> - </mat-form-field> - - </div> - </div> - </div> - - <div *ngFor="let sumAvg of sumOrAvg" > - <div class="card-b"> - <div class="header-left"> - <h5>{{sumAvg.name}}</h5> - <h2 *ngIf="sumAvg.measurementType?.toString()=='SOLAR_RADIATION' "> - {{sumAvg.value?.toFixed(1)}}{{" "}}w/m<sup>2</sup> - </h2> - <h2 *ngIf="sumAvg.measurementType?.toString()!='SOLAR_RADIATION' "> - {{sumAvg.value?.toFixed(1)}}{{" "+unitMapper.get(sumAvg.measurementType+"")}} - </h2> - <div><h4>{{typeMapper.get( sumAvg.type+"")}}</h4></div> - </div> - <div class="header-right"> - <i class="material-icons" style="font-size:80px;color: black">{{iconMapper.get(sumAvg.measurementType+"")}}</i> - </div> - - </div> - </div> - - </div> - - - - - - - - <div class="w-full flex flex-row items-end justify-start flex-wrap"> - <div *ngFor="let avgMMax of avgMinMax;let iX=index;"> - <div class="card-group" [ngStyle]="{'box-shadow':avgMMax.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':''}"> - <header> - <h5>{{avgMMax.name}}</h5> - </header> - <main> - <div class="min"> - <h3>Min</h3> - <h3>{{avgMMax.min?.value?.toFixed(2)}}</h3> - </div> - - <div class="avg"> - <h3>Avg</h3> - <h3>{{avgMMax.avg?.toFixed(2)}}</h3> - </div> - - <div class="max"> - <h3>Max</h3> - <h3>{{avgMMax.max?.value?.toFixed(2)}}</h3> - </div> - </main> - </div> - </div> - </div> - - - <div class="w-full flex flex-row justify-start flex-wrap "> - - - <div class="flex-col p-2 m-4 bg-white justify-center items-center rounded" - *ngFor="let dent of dentrometerDailyValue" - [ngStyle]="{'box-shadow':dent.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':''}"> - - <h1 class="flex font-bold text-4sm mb-6 justify-center">{{dent.name}}</h1> - <div class="mx-8 flex justify-between"> - - <div class="flex-col content-center items-center justify-center"> - <div class="flex mx-2 flex items-center border-b-2 border-black "> - <i class="material-icons text-blue-500 text-2xl mr-2">unfold_less</i> - <h5 class="text-gray-500 text-xs">Maximum daily shrinkage</h5> - </div> - <div class="flex items-end justify-center"> - <h1 class=" flex justify-center text-3xl font-bold">{{dent.mds?.value?.toFixed(2)}}</h1> - <h3 class="mb-1 ml-1 text-slate-400">mm </h3> - </div> - </div> - - <div class="flex-col"> - <div class="flex mx-2 flex items-center border-b-2 border-black "> - <i class="material-icons text-yellow-500 text-2xl mr-2">vertical_align_top</i> - <h5 class="text-gray-500 text-xs">Radius increment</h5> - </div> - <div class="flex items-end justify-center"> - <h1 class=" flex justify-center text-3xl font-bold">{{dent.deltaR?.value?.toFixed(2)}}</h1> - <h3 class="mb-1 ml-1 text-slate-400">mm </h3> - </div> - </div> - - </div> - </div> - - </div> - - -</div> ---> - - - - - - - - -<!-- -<div class="w-full flex flex-row items-end justify-start flex-wrap"> - <div *ngFor="let avgMMax of avgMinMax;let iX=index;"> - <div class="card-group" [ngStyle]="{'box-shadow':avgMMax.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':''}"> - <header> - <h5>{{avgMMax.name}}</h5> - </header> - <main> - <div class="min"> - <h3>Min</h3> - <h3>{{avgMMax.min?.value?.toFixed(2)}}</h3> - </div> - - <div class="avg"> - <h3>Avg</h3> - <h3>{{avgMMax.avg?.toFixed(2)}}</h3> - </div> - - <div class="max"> - <h3>Max</h3> - <h3>{{avgMMax.max?.value?.toFixed(2)}}</h3> - </div> - </main> - </div> - </div> -</div> - - -<div class="w-full flex flex-row items-end justify-start flex-wrap "> - <div *ngFor="let avgMMax of avgMinMax;let iX=index;"> - <div class="card-group " [ngStyle]="{'box-shadow':avgMMax.isSensorGroup ? '15px 15px rgb(173,216,230,0.4) ,30px 30px rgb(173,216,230,0.2)':' rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px'}"> - <header> - <h5>{{avgMMax.name}} <h6>(wemc)</h6></h5> - </header> - <main class="w-full mb-4 flex"> - <app-slider [avg]="avgMMax.avg" [min]="avgMMax.min?.value" [max]="avgMMax.max?.value" class="w-full px-5" ></app-slider> - </main> - </div> - </div> -</div> ---> - diff --git a/src/app/module/components/lev0-ver3/lev0-ver3.component.scss b/src/app/module/components/summaryList/summaryList.scss similarity index 100% rename from src/app/module/components/lev0-ver3/lev0-ver3.component.scss rename to src/app/module/components/summaryList/summaryList.scss diff --git a/src/app/module/components/lev0-ver3/lev0-ver3.component.spec.ts b/src/app/module/components/summaryList/summaryList.spec.ts similarity index 59% rename from src/app/module/components/lev0-ver3/lev0-ver3.component.spec.ts rename to src/app/module/components/summaryList/summaryList.spec.ts index 8256071..75c69a8 100644 --- a/src/app/module/components/lev0-ver3/lev0-ver3.component.spec.ts +++ b/src/app/module/components/summaryList/summaryList.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { Lev0Ver3Component } from './lev0-ver3.component'; +import { SummaryList } from './summaryList'; describe('Lev0Ver3Component', () => { - let component: Lev0Ver3Component; - let fixture: ComponentFixture<Lev0Ver3Component>; + let component: SummaryList; + let fixture: ComponentFixture<SummaryList>; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ Lev0Ver3Component ] + declarations: [ SummaryList ] }) .compileComponents(); - fixture = TestBed.createComponent(Lev0Ver3Component); + fixture = TestBed.createComponent(SummaryList); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/module/components/lev0-ver3/lev0-ver3.component.ts b/src/app/module/components/summaryList/summaryList.ts similarity index 93% rename from src/app/module/components/lev0-ver3/lev0-ver3.component.ts rename to src/app/module/components/summaryList/summaryList.ts index d40acdd..3349ae0 100644 --- a/src/app/module/components/lev0-ver3/lev0-ver3.component.ts +++ b/src/app/module/components/summaryList/summaryList.ts @@ -1,8 +1,6 @@ import {Component, ElementRef, Input, ViewChild} from '@angular/core'; import {ApiService} from "../../../shared/api.service"; import { faChevronLeft, faChevronRight, faLongArrowAltUp, faLongArrowAltDown } from '@fortawesome/free-solid-svg-icons'; - -//import {SumOrAvg} from "../../../core/service/level1/SumOrAvg"; import {FormControl, FormGroup} from "@angular/forms"; import {DatePipe} from "@angular/common"; import {ThreePhaseDendrometer} from "../../../core/service/level1/ThreePhaseDendrometer"; @@ -13,8 +11,6 @@ import { ServerControllerService, SumOrAvg } from "../../../../../projects/generated-api/src"; -import {Lv1} from "../../../core/service/level1/Lv1"; -import {map, startWith} from "rxjs/operators"; import { StationControllerService } from 'projects/swagger-client/src'; import {SharedService} from "../../../shared/shared-service.service"; @@ -23,10 +19,10 @@ import {SharedService} from "../../../shared/shared-service.service"; @Component({ selector: 'app-lev0Ver3', - templateUrl: './lev0-ver3.component.html', - styleUrls: ['./lev0-ver3.component.scss'] + templateUrl: './summaryList.html', + styleUrls: ['./summaryList.scss'] }) -export class Lev0Ver3Component { +export class SummaryList { dentrometerDailyValue:DendrometerDailyValue[]=[] constructor(private api:ApiService, diff --git a/src/app/module/pages/station/client/client.component.css b/src/app/module/pages/admin/stationManagement/client/client.component.css similarity index 100% rename from src/app/module/pages/station/client/client.component.css rename to src/app/module/pages/admin/stationManagement/client/client.component.css diff --git a/src/app/module/pages/station/client/client.component.html b/src/app/module/pages/admin/stationManagement/client/client.component.html similarity index 100% rename from src/app/module/pages/station/client/client.component.html rename to src/app/module/pages/admin/stationManagement/client/client.component.html diff --git a/src/app/module/pages/station/client/client.component.spec.ts b/src/app/module/pages/admin/stationManagement/client/client.component.spec.ts similarity index 100% rename from src/app/module/pages/station/client/client.component.spec.ts rename to src/app/module/pages/admin/stationManagement/client/client.component.spec.ts diff --git a/src/app/module/pages/station/client/client.component.ts b/src/app/module/pages/admin/stationManagement/client/client.component.ts similarity index 92% rename from src/app/module/pages/station/client/client.component.ts rename to src/app/module/pages/admin/stationManagement/client/client.component.ts index fc597e5..ef241fd 100644 --- a/src/app/module/pages/station/client/client.component.ts +++ b/src/app/module/pages/admin/stationManagement/client/client.component.ts @@ -1,7 +1,6 @@ -import {Component, OnInit} from '@angular/core'; -import {FormArray, FormBuilder, FormGroup} from "@angular/forms"; -import {ApiService} from "../../../../shared/api.service"; -import {SensorModel} from "../sensor/sensor.model"; +import {Component} from '@angular/core'; +import {FormBuilder, FormGroup} from "@angular/forms"; +import {ApiService} from "../../../../../shared/api.service"; import {ClientModel} from "./client.model"; interface sensorDataType { diff --git a/src/app/module/pages/station/client/client.model.ts b/src/app/module/pages/admin/stationManagement/client/client.model.ts similarity index 100% rename from src/app/module/pages/station/client/client.model.ts rename to src/app/module/pages/admin/stationManagement/client/client.model.ts diff --git a/src/app/module/components/header/config-header/config-header.component.css b/src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.css similarity index 100% rename from src/app/module/components/header/config-header/config-header.component.css rename to src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.css diff --git a/src/app/module/components/header/config-header/config-header.component.html b/src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.html similarity index 100% rename from src/app/module/components/header/config-header/config-header.component.html rename to src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.html diff --git a/src/app/module/components/header/config-header/config-header.component.spec.ts b/src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.spec.ts similarity index 100% rename from src/app/module/components/header/config-header/config-header.component.spec.ts rename to src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.spec.ts diff --git a/src/app/module/components/header/config-header/config-header.component.ts b/src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.ts similarity index 100% rename from src/app/module/components/header/config-header/config-header.component.ts rename to src/app/module/pages/admin/stationManagement/header/config-header/config-header.component.ts diff --git a/src/app/module/components/header/data-header/data-header.component.css b/src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.css similarity index 100% rename from src/app/module/components/header/data-header/data-header.component.css rename to src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.css diff --git a/src/app/module/components/header/data-header/data-header.component.html b/src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.html similarity index 100% rename from src/app/module/components/header/data-header/data-header.component.html rename to src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.html diff --git a/src/app/module/components/header/data-header/data-header.component.spec.ts b/src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.spec.ts similarity index 100% rename from src/app/module/components/header/data-header/data-header.component.spec.ts rename to src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.spec.ts diff --git a/src/app/module/components/header/data-header/data-header.component.ts b/src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.ts similarity index 100% rename from src/app/module/components/header/data-header/data-header.component.ts rename to src/app/module/pages/admin/stationManagement/header/data-header/data-header.component.ts diff --git a/src/app/module/pages/station/host/host.component.css b/src/app/module/pages/admin/stationManagement/host/host.component.css similarity index 100% rename from src/app/module/pages/station/host/host.component.css rename to src/app/module/pages/admin/stationManagement/host/host.component.css diff --git a/src/app/module/pages/station/host/host.component.html b/src/app/module/pages/admin/stationManagement/host/host.component.html similarity index 100% rename from src/app/module/pages/station/host/host.component.html rename to src/app/module/pages/admin/stationManagement/host/host.component.html diff --git a/src/app/module/pages/station/host/host.component.spec.ts b/src/app/module/pages/admin/stationManagement/host/host.component.spec.ts similarity index 100% rename from src/app/module/pages/station/host/host.component.spec.ts rename to src/app/module/pages/admin/stationManagement/host/host.component.spec.ts diff --git a/src/app/module/pages/station/host/host.component.ts b/src/app/module/pages/admin/stationManagement/host/host.component.ts similarity index 96% rename from src/app/module/pages/station/host/host.component.ts rename to src/app/module/pages/admin/stationManagement/host/host.component.ts index 48a5671..8c45247 100644 --- a/src/app/module/pages/station/host/host.component.ts +++ b/src/app/module/pages/admin/stationManagement/host/host.component.ts @@ -1,7 +1,7 @@ import {Component} from '@angular/core'; import {FormBuilder, FormGroup} from "@angular/forms"; import {HostModel} from "./host.model"; -import {ApiService} from "../../../../shared/api.service"; +import {ApiService} from "../../../../../shared/api.service"; @Component({ selector: 'app-host', diff --git a/src/app/module/pages/station/host/host.model.ts b/src/app/module/pages/admin/stationManagement/host/host.model.ts similarity index 100% rename from src/app/module/pages/station/host/host.model.ts rename to src/app/module/pages/admin/stationManagement/host/host.model.ts diff --git a/src/app/module/pages/station/sensor/sensor.component.css b/src/app/module/pages/admin/stationManagement/sensor/sensor.component.css similarity index 100% rename from src/app/module/pages/station/sensor/sensor.component.css rename to src/app/module/pages/admin/stationManagement/sensor/sensor.component.css diff --git a/src/app/module/pages/station/sensor/sensor.component.html b/src/app/module/pages/admin/stationManagement/sensor/sensor.component.html similarity index 100% rename from src/app/module/pages/station/sensor/sensor.component.html rename to src/app/module/pages/admin/stationManagement/sensor/sensor.component.html diff --git a/src/app/module/pages/station/sensor/sensor.component.spec.ts b/src/app/module/pages/admin/stationManagement/sensor/sensor.component.spec.ts similarity index 100% rename from src/app/module/pages/station/sensor/sensor.component.spec.ts rename to src/app/module/pages/admin/stationManagement/sensor/sensor.component.spec.ts diff --git a/src/app/module/pages/station/sensor/sensor.component.ts b/src/app/module/pages/admin/stationManagement/sensor/sensor.component.ts similarity index 97% rename from src/app/module/pages/station/sensor/sensor.component.ts rename to src/app/module/pages/admin/stationManagement/sensor/sensor.component.ts index 8a56eec..8208846 100644 --- a/src/app/module/pages/station/sensor/sensor.component.ts +++ b/src/app/module/pages/admin/stationManagement/sensor/sensor.component.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {ApiService} from "../../../../shared/api.service"; +import {ApiService} from "../../../../../shared/api.service"; import {FormBuilder, FormGroup} from "@angular/forms"; import {SensorModel} from "./sensor.model"; diff --git a/src/app/module/pages/station/sensor/sensor.model.ts b/src/app/module/pages/admin/stationManagement/sensor/sensor.model.ts similarity index 100% rename from src/app/module/pages/station/sensor/sensor.model.ts rename to src/app/module/pages/admin/stationManagement/sensor/sensor.model.ts diff --git a/src/app/module/pages/station/station.component.css b/src/app/module/pages/admin/stationManagement/station/station.component.css similarity index 100% rename from src/app/module/pages/station/station.component.css rename to src/app/module/pages/admin/stationManagement/station/station.component.css diff --git a/src/app/module/pages/station/station.component.html b/src/app/module/pages/admin/stationManagement/station/station.component.html similarity index 100% rename from src/app/module/pages/station/station.component.html rename to src/app/module/pages/admin/stationManagement/station/station.component.html diff --git a/src/app/module/pages/station/station.component.spec.ts b/src/app/module/pages/admin/stationManagement/station/station.component.spec.ts similarity index 100% rename from src/app/module/pages/station/station.component.spec.ts rename to src/app/module/pages/admin/stationManagement/station/station.component.spec.ts diff --git a/src/app/module/pages/station/station.component.ts b/src/app/module/pages/admin/stationManagement/station/station.component.ts similarity index 98% rename from src/app/module/pages/station/station.component.ts rename to src/app/module/pages/admin/stationManagement/station/station.component.ts index f49d01e..88826a1 100644 --- a/src/app/module/pages/station/station.component.ts +++ b/src/app/module/pages/admin/stationManagement/station/station.component.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {ApiService} from "../../../shared/api.service"; +import {ApiService} from "../../../../../shared/api.service"; import {FormBuilder, FormGroup} from "@angular/forms"; import {StationModel} from "./station.model"; diff --git a/src/app/module/pages/station/station.model.ts b/src/app/module/pages/admin/stationManagement/station/station.model.ts similarity index 100% rename from src/app/module/pages/station/station.model.ts rename to src/app/module/pages/admin/stationManagement/station/station.model.ts diff --git a/src/app/module/pages/admin/stationManagement/stationManagement.component.html b/src/app/module/pages/admin/stationManagement/stationManagement.component.html new file mode 100644 index 0000000..f33a144 --- /dev/null +++ b/src/app/module/pages/admin/stationManagement/stationManagement.component.html @@ -0,0 +1,45 @@ + +<div class="body-container"> + + <section class="sidebar"> + + <div class="container-logo"> + <!-- + <img src="../../assets/images/logo_tree.png"> --> + <mat-icon>forest</mat-icon> + <!-- <div class="logo-font"> #FFF</div> --> + <div class="logo-light">FORTE</div> + </div> + <nav> + <a routerLink="/homeConfigStation" class="item"> <mat-icon class="white-icon">settings</mat-icon> Config </a> + <a routerLink="/data" class="item"> <mat-icon class="white-icon">multiline_chart</mat-icon> Data </a> + <!-- <a routerLink="/ComingSoon" class="item"> <mat-icon class="white-icon">insights</mat-icon> Insights </a> + <a routerLink="/ComingSoon" class="item"> <mat-icon class="white-icon">tasks</mat-icon> Report </a> +--> + </nav> + </section> + + <header class="header"> + + <nav> + <!-- + <a class="item" [routerLink]='[{ outlets: { stationManagement: ["fourInOne"],header: ["data"] } }]' > <mat-icon class="white-icon">table_chart</mat-icon> Summary </a> + <a class="item" [routerLink]='[{ outlets: { stationManagement: ["chartBar"],header: ["data"] } }]'> <mat-icon class="white-icon">zoom_in</mat-icon> Zen Mode </a> + <a class="item" [routerLink]='[{ outlets: { stationManagement: ["barChart"],header: ["data"] } }]'> <mat-icon class="white-icon">barChart</mat-icon> Compare </a> +--> + + <router-outlet name="child1"></router-outlet> + <!-- + <app-data-header></app-data-header> --> + </nav> + + </header> + + + + <main class="main"> + + <router-outlet name="child2"></router-outlet>` + + </main> +</div> diff --git a/src/app/module/pages/home/home.component.scss b/src/app/module/pages/admin/stationManagement/stationManagement.component.scss similarity index 100% rename from src/app/module/pages/home/home.component.scss rename to src/app/module/pages/admin/stationManagement/stationManagement.component.scss diff --git a/src/app/module/pages/admin/stationManagement/stationManagement.component.spec.ts b/src/app/module/pages/admin/stationManagement/stationManagement.component.spec.ts new file mode 100644 index 0000000..e4f1387 --- /dev/null +++ b/src/app/module/pages/admin/stationManagement/stationManagement.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StationManagementComponent } from './stationManagement.component'; + +describe('HomeComponent', () => { + let component: StationManagementComponent; + let fixture: ComponentFixture<StationManagementComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ StationManagementComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(StationManagementComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/module/pages/admin/stationManagement/stationManagement.component.ts b/src/app/module/pages/admin/stationManagement/stationManagement.component.ts new file mode 100644 index 0000000..59d47ab --- /dev/null +++ b/src/app/module/pages/admin/stationManagement/stationManagement.component.ts @@ -0,0 +1,220 @@ +import {Component,OnInit} from '@angular/core'; +import {Chart} from "chart.js/auto"; +import {Router} from "@angular/router"; +@Component({ + selector: 'app-stationManagement', + templateUrl: './stationManagement.component.html', + styleUrls: ['./stationManagement.component.scss'] +}) +export class StationManagementComponent implements OnInit { + + private i:boolean=true +/* + constructor(private router: Router) { + router.events.pipe( + filter(event => event instanceof NavigationEnd) + ) + .subscribe(event => { + console.log(event.toString()); + }); + } + */ + constructor(private router: Router) { + + } + labels:any=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] + +//*************************lineChart-Trio***************************** + data:any ={ + labels:this.labels, + datasets: [ { + label: "Temperature-1", + data: [1400, 3000, 2500, 4500, 2500, 3400, 3000], + fill:true, + // fillColor: '#d20f0f', + borderColor:"rgba(255, 10, 13, 0.8)", + backgroundColor: "rgba(255, 10, 13, 0.1)", + tension:0.2 + }, + { + label: "Temperature-2", + data: [1500, 2500, 2500, 4000, 2600, 3500, 2900], + fill:true, + // fillColor: '#d20f0f', + // borderColor:"#200", + borderColor:"rgba(136,26,28,0.8)", + backgroundColor: "rgba(255, 10, 13, 0.1)", + tension:0.2 + }, + { + label: "Temperature-3", + data: [1700, 2300, 2300, 3500, 2300, 4500, 2900], + fill:true, + // fillColor: '#d20f0f', + // borderColor:"#200", + borderColor:"rgba(255,10,141,0.8)", + backgroundColor: "rgba(255, 10, 13, 0.1)", + tension:0.2 + } + ] + } + + linConfig:any={ + type:'line', + data:this.data, + options:{ + responsive:true, + radius:5, + hoverRadius:12, + hitRadius:30 + } + } + //*************************BarChart-Rain***************************** + databar:any ={ + labels:this.labels, + datasets: [ { + label: "Rain", + data: [1400, 300, 2500, 4500, 2500, 3400, 3000], + fill:true, + fillColor:'#111', + backgroundColor: "rgba(10,145,255,0.5)", + // borderColor:"#111", + + }] + } + barConfig:any={ + type:'bar', + data:this.databar, + options:{ + responsive:true, + radius:5, + hoverRadius:12, + hitRadius:30 + } + } +//*************************lineChart-Solo***************************** + data_lineSolo:any ={ + labels:this.labels, + datasets: [ { + label: "Rain", + data: [1400, 300, 2500, 4500, 2500, 3400, 3000], + fill:true, + fillColor:'#111', + borderColor:"rgba(75,154,3,0.9)", + backgroundColor: "rgba(10,255,43,0.1)", + // borderColor:"#111", + + }] + } + config_lineSolo:any={ + type:'line', + data:this.data_lineSolo, + options:{ + responsive:true, + radius:3, + hoverRadius:12, + hitRadius:30, + tension:0.05, + + } + } + //*************************Pint-Dendrometer-Solo***************************** + data_pointSolo:any ={ + labels:this.labels, + datasets: [ { + label: "Dendrometer", + data: [1400, 300, 2500, 4500, 2500, 3400, 3000], + fill:true, + + // borderColor:"rgb(39,45,33)", + borderColor:"rgb(100,176,27)", + backgroundColor: "rgba(10,255,43,0.00)", + showLine:false + // borderColor:"#111", + + }] + } + blacK_config_pointSolo:any={ + type:'line', + data:this.data_pointSolo, + options:{ + plugins: { + legend: { + display: true, + labels: { + // color: 'white' + } + } + }, + labelColors:'white', + responsive:true, + radius:5, + hoverRadius:12, + hitRadius:30, + tension:0.05, + pointBorderWidth:4, + scales: { + x: { + grid: { + color:"rgba(255,255,255,0.3)", + }, + ticks: { + color: "white" + } + }, + y: { + grid: { + color:"rgba(255,255,255,0.3)", + }, + ticks: { + color: "white" + } + } + } + + } + } + white_data_pointSolo:any ={ + labels:this.labels, + datasets: [ { + label: "Rain", + data: [1400, 300, 2500, 4500, 2500, 3400, 3000], + fill:true, + fillColor:'#111', + borderColor:"rgba(75,154,3,0.9)", + backgroundColor: "rgba(10,255,43,0.1)", + // borderColor:"#111", + + }] + } + + + white_config_pointSolo:any={ + type:'line', + data:this.white_data_pointSolo, + options:{ + responsive:true, + radius:3, + hoverRadius:12, + hitRadius:30, + tension:0.05, + + } + } + + linechart: any; + barchart:any + soloLineChart:any + pointChart:any + + ngOnInit(): void { + this.linechart=new Chart('chart2',this.linConfig) + this.barchart=new Chart('barchart',this.barConfig) + this.soloLineChart=new Chart('soloLineChart',this.config_lineSolo) + this.pointChart= new Chart('pointChart',this.white_config_pointSolo) + console.log("helllllo") + console.log("hello"+this.router.url) + } + + +} diff --git a/src/app/module/pages/admin-dashboard/user.model.ts b/src/app/module/pages/admin/userManagment/user.model.ts similarity index 100% rename from src/app/module/pages/admin-dashboard/user.model.ts rename to src/app/module/pages/admin/userManagment/user.model.ts diff --git a/src/app/module/components/cooming-soon-header/cooming-soon-header.component.css b/src/app/module/pages/admin/userManagment/userManagement.component.css similarity index 100% rename from src/app/module/components/cooming-soon-header/cooming-soon-header.component.css rename to src/app/module/pages/admin/userManagment/userManagement.component.css diff --git a/src/app/module/pages/admin-dashboard/admin-dashboard.component.html b/src/app/module/pages/admin/userManagment/userManagement.component.html similarity index 100% rename from src/app/module/pages/admin-dashboard/admin-dashboard.component.html rename to src/app/module/pages/admin/userManagment/userManagement.component.html diff --git a/src/app/module/pages/admin-dashboard/admin-dashboard.component.spec.ts b/src/app/module/pages/admin/userManagment/userManagement.component.spec.ts similarity index 56% rename from src/app/module/pages/admin-dashboard/admin-dashboard.component.spec.ts rename to src/app/module/pages/admin/userManagment/userManagement.component.spec.ts index 2ab4da9..00b7ab9 100644 --- a/src/app/module/pages/admin-dashboard/admin-dashboard.component.spec.ts +++ b/src/app/module/pages/admin/userManagment/userManagement.component.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AdminDashboardComponent } from './admin-dashboard.component'; +import { UserManagementComponent } from './userManagement.component'; describe('AdminDashboardComponent', () => { - let component: AdminDashboardComponent; - let fixture: ComponentFixture<AdminDashboardComponent>; + let component: UserManagementComponent; + let fixture: ComponentFixture<UserManagementComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ AdminDashboardComponent ] + declarations: [ UserManagementComponent ] }) .compileComponents(); - fixture = TestBed.createComponent(AdminDashboardComponent); + fixture = TestBed.createComponent(UserManagementComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/module/pages/admin-dashboard/admin-dashboard.component.ts b/src/app/module/pages/admin/userManagment/userManagement.component.ts similarity index 92% rename from src/app/module/pages/admin-dashboard/admin-dashboard.component.ts rename to src/app/module/pages/admin/userManagment/userManagement.component.ts index 43ef96c..93bc7fb 100644 --- a/src/app/module/pages/admin-dashboard/admin-dashboard.component.ts +++ b/src/app/module/pages/admin/userManagment/userManagement.component.ts @@ -1,15 +1,15 @@ import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormGroup} from "@angular/forms"; import {UserModel} from "./user.model"; -import {ApiService} from "../../../shared/api.service"; +import {ApiService} from "../../../../shared/api.service"; import {Router} from "@angular/router"; @Component({ - selector: 'app-admin-dashboard', - templateUrl: './admin-dashboard.component.html', - styleUrls: ['./admin-dashboard.component.css'] + selector: 'app-userManagment', + templateUrl: './userManagement.component.html', + styleUrls: ['./userManagement.component.css'] }) -export class AdminDashboardComponent implements OnInit { +export class UserManagementComponent implements OnInit { form!: FormGroup; user: UserModel = new UserModel(); diff --git a/src/app/module/pages/dashboard/dashboard.component.css b/src/app/module/pages/dashboard/dashboard.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/module/pages/dashboard/dashboard.component.html b/src/app/module/pages/dashboard/dashboard.component.html deleted file mode 100644 index 22c6207..0000000 --- a/src/app/module/pages/dashboard/dashboard.component.html +++ /dev/null @@ -1,25 +0,0 @@ -<div class="container"> - <form [formGroup]="formDashboard"> - <div class="row mb-5"> - <div class="col-md-3"> - <label for="stations">Choose Station</label> - <select (change)="onStationChange($event.target)" class="form-control" id="stations" formControlName="stations"> - <option *ngFor="let station of stationsData" value="{{station.id}}">{{station.name}}</option> - </select> - </div> - <div class="col-md-3"> - <label for="clients">Choose Client</label> - <select (change)="onClientChange($event.target)" class="form-control" id="clients" formControlName="clients"> - <option *ngFor="let client of activeClientsData" value="{{client.id}}">{{client.name}}</option> - </select> - </div> - <div class="col-md-3"> - <label for="sensors">Choose Sensor</label> - <select (change)="onSensorChange($event.target)" class="form-control" id="sensors" formControlName="sensors"> - <option *ngFor="let sensor of activeSensorsData" value="{{sensor.name}}">{{sensor.name}}</option> - </select> - </div> - </div> - </form> - <canvas id="myChart"></canvas> -</div> diff --git a/src/app/module/pages/dashboard/dashboard.component.spec.ts b/src/app/module/pages/dashboard/dashboard.component.spec.ts deleted file mode 100644 index 6e4dcd8..0000000 --- a/src/app/module/pages/dashboard/dashboard.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DashboardComponent } from './dashboard.component'; - -describe('DashboardComponent', () => { - let component: DashboardComponent; - let fixture: ComponentFixture<DashboardComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ DashboardComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(DashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/pages/dashboard/dashboard.component.ts b/src/app/module/pages/dashboard/dashboard.component.ts deleted file mode 100644 index f08c2ee..0000000 --- a/src/app/module/pages/dashboard/dashboard.component.ts +++ /dev/null @@ -1,112 +0,0 @@ -import {Component, OnInit} from '@angular/core'; -import {Chart, registerables} from 'chart.js/auto'; -import {ApiService} from "../../../shared/api.service"; -import {FormBuilder, FormGroup} from "@angular/forms"; - -@Component({ - selector: 'app-dashboard', - templateUrl: './dashboard.component.html', - styleUrls: ['./dashboard.component.css'] -}) - -export class DashboardComponent implements OnInit { - - formDashboard! : FormGroup; - stationsData: any = []; - sensorsData: any = []; - activeSensorsData: any = []; - clientsData: any = []; - activeClientsData: any = []; - readings: any = { - labels: [], - title: '', - data: [] - }; - - chart: any; - constructor(private api: ApiService, private fb: FormBuilder) { - this.getAllStations(); - this.getAllSensors(); - this.getAllClients(); - - this.formDashboard = fb.group({ - stations: [''], - clients: [''], - sensors: [''], - }); - } - - ngOnInit() { - this.drawChart(); - } - - private drawChart() { - this.chart = new Chart('myChart', { - type: 'line', - data: { - labels: this.readings.labels, - datasets: [{ - label: this.readings.title, - data: this.readings.data, - backgroundColor: 'blue' - }, - // For two readings at once - ] - }, - options: { - aspectRatio: 2.5 - } - }); - } - - getAllStations() { - this.api.get('http://localhost:8080/api/v1/station/all') - .subscribe(res => { - this.stationsData = res; - }); - } - - getAllSensors() { - this.api.get('http://localhost:8080/api/v1/sensor/all') - .subscribe(res => { - this.sensorsData = res; - }); - } - - getAllClients() { - this.api.get('http://localhost:8080/api/v1/client/all') - .subscribe(res => { - this.clientsData = res; - }); - } - - onStationChange(target: any) { - const stationId = (target as HTMLInputElement).value; - const clientId: string[] = this.stationsData?.find((station: any) => station.id === stationId)?.clients; - this.activeClientsData = this.clientsData?.filter((client: any) => clientId.includes(client.id)); - } - - onClientChange(target: any) { - const clientId = (target as HTMLInputElement).value; - const sensorId: string[] = this.clientsData?.find((client: any) => client.id === clientId)?.sensors; - this.activeSensorsData = this.sensorsData?.filter((sensor: any) => sensorId.includes(sensor.id)); - } - - onSensorChange(target: any) { - const sensorId = (target as HTMLInputElement).value; - this.api.getReadingsBySensorId("http://localhost:8080/api/v1/server/get/sensor", sensorId) - .subscribe(res => { - this.chart.destroy(); - this.readings = { - labels: res.map((reading: any) => this.getReadableDate(reading.timestamp)), - title: res[0].readings[0].name, - data: res.map((reading: any) => reading.readings[0].value) - }; - this.drawChart(); - }); - } - - getReadableDate(date: string) { - return new Date(date).toLocaleString(); - } -} diff --git a/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.css b/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.html b/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.html deleted file mode 100644 index f5bcb57..0000000 --- a/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.html +++ /dev/null @@ -1,101 +0,0 @@ -<!-- -<div class="h-screen w-full grid grid-cols-1 md:grid-cols-12 grid-rows-6 md:grid-rows-1"> - - <header class="col-span-12 md:col-span-11 row-span-1 md:row-span-1 bg-cyan-100">header</header> - <section class="col-span-12 md:col-span-1 row-span-1 md:row-span-1 bg-gray-700"></section> - <main class="col-span-12 md:col-span-11 row-span-5 md:row-span-1 bg-dark">main</main> - <aside class="col-span-12 md:col-span-1 row-span-5 md:row-span-1 flex flex-col items-end bg-gray-700 transition duration-250 ease-in-out"> - <div class="mt-5 w-full flex flex-col items-center text-white">.container-logo</div> - </aside> -</div> ---> -<!-- -<div class="min-h-screen flex items-center bg-purple-100"> - <div class="flex-1 max-w-4xl mx-auto p-10 gap-8"> - <ul class="grid gap-8 grid-cols-1 gap-4 sm:grid-cols-2 sm:gap-6 md:grid-cols-3 md:gap-8"> - <li class="bg-white rounded-l shadow-xl h-24"></li> - <li class="bg-white rounded-l shadow-xl h-24"></li> - <li class="bg-white rounded-l shadow-xl h-24"></li> - <li class="bg-white rounded-l shadow-xl h-24"></li> - </ul> - - </div> - -</div> ---> - - -<div class="grid gap-8 pl-3 min-h-screen max-h-screen w-full grid-cols-[50px_1fr] grid-rows-[50px_1fr;] relative"> -<!-- - <div class="absolute top-4 left-1/2"> - <button type="button" class="py-2 px-4 inline-flex justify-center items-center gap-2 rounded-md border-2 border-blue-200 font-semibold text-blue-500 hover:text-white hover:bg-blue-500 hover:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 focus:ring-offset-2 transition-all text-sm dark:focus:ring-offset-gray-800"> - Button - </button> -</div> ---> - <div class="col-start-1 col-end-2 row-start-1 row-end-3 bg-white rounded-l shadow-xl my-3"> - <nav class="h-full w-full flex flex-col items-center [&>*]:m-4"> - <a routerLink="/data" class="w-5 h-5 rounded-full"> - <mat-icon class="bg-green-300 rounded-full">forest</mat-icon> - </a> - <!-- - <a class=" w-5 h-5 rounded-full"> - <button> - <mat-icon>home</mat-icon> - </button> - </a> - <a class=" w-5 h-5 rounded-full"> - <button> - <mat-icon>monitor</mat-icon> - </button> - </a> - <a class="w-5 h-5 rounded-full"> - <button> - <mat-icon>tune</mat-icon> - </button> - </a> - --> - <a class="w-5 h-5 "> - <button #buttonRef [routerLink]='[{ outlets: { homeDash: ["dayData"] } }]'> - <mat-icon >insert_chart</mat-icon> - </button> - </a> - - <a class="w-5 h-5 "> - <button [routerLink]='[{ outlets: { homeDash: ["chart"] } }]'> - <mat-icon >query_stats</mat-icon> - </button> - </a> - - <a class="hidden"> - <button #buttonRef2 [routerLink]='[{ outlets: { homeDash: ["dayDataList"] } }]'> - <mat-icon >insert_chart</mat-icon> - </button> - </a> - </nav> - </div> - -<!-- - <div class="col-start-2 col-end-3 row-start-1 row-end-2 bg-blue-800 bg-transparent- rounded-l shadow-xl"> - <nav class="w-full h-full flex items-center justify-center [&>*]:m-4"> - <a class="w-5 h-5 "> - <button [routerLink]='[{ outlets: { homeDash: ["dayData"] } }]'> - <mat-icon class="text-white">insert_chart</mat-icon> - </button> - </a> - <a class="w-5 h-5 "> - <button [routerLink]='[{ outlets: { homeDash: ["chart"] } }]'> - <mat-icon class="text-white">query_stats</mat-icon> - </button> - </a> - </nav> - </div> ---> - <div class="sm:col-start-2 sm:col-end-3 sm:row-start-1 sm:row-end-3 - col-start-1 col-end-3 row-start-1 row-end-2 overflow-y-auto h-full scrollbar-hide rounded-l "> - <router-outlet name="homeDash" ></router-outlet> - </div> - -</div> - - diff --git a/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.spec.ts b/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.spec.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.ts b/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.ts deleted file mode 100644 index a03e7c8..0000000 --- a/src/app/module/pages/home-tailwindcss/home-tailwindcss.component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import {Component, ElementRef, ViewChild} from '@angular/core'; -import {SharedService} from "../../../shared/shared-service.service"; -import {Router} from "@angular/router"; - -@Component({ - selector: 'app-home-tailwindcss', - templateUrl: './home-tailwindcss.component.html', - styleUrls: ['./home-tailwindcss.component.css'] -}) -export class HomeTailwindcssComponent { - - // @ts-ignore - @ViewChild('buttonRef') buttonRef: ElementRef; - // @ts-ignore - @ViewChild('buttonRef2') buttonRef2: ElementRef; - - number = 0; - - constructor(private sharedService: SharedService, - private router: Router) {} - - ngOnInit() { - this.sharedService.number$.subscribe(number => { - this.number = number; - this.onNumberChange(); - }); - } - - onNumberChange() { - // Do something with the updated number - console.log(`Number changed to ${this.number}`); - if (this.number == 1) - this.buttonRef.nativeElement.click(); - if (this.number == 2) - this.buttonRef2.nativeElement.click(); - } -} diff --git a/src/app/module/pages/admin-dashboard/admin-dashboard.component.css b/src/app/module/pages/home/home.component.css similarity index 100% rename from src/app/module/pages/admin-dashboard/admin-dashboard.component.css rename to src/app/module/pages/home/home.component.css diff --git a/src/app/module/pages/home/home.component.html b/src/app/module/pages/home/home.component.html index 0ed3626..e21b108 100644 --- a/src/app/module/pages/home/home.component.html +++ b/src/app/module/pages/home/home.component.html @@ -1,45 +1,35 @@ - -<div class="body-container"> - - <section class="sidebar"> - - <div class="container-logo"> - <!-- - <img src="../../assets/images/logo_tree.png"> --> - <mat-icon>forest</mat-icon> - <!-- <div class="logo-font"> #FFF</div> --> - <div class="logo-light">FORTE</div> - </div> - <nav> - <a routerLink="/homeConfigStation" class="item"> <mat-icon class="white-icon">settings</mat-icon> Config </a> - <a routerLink="/data" class="item"> <mat-icon class="white-icon">multiline_chart</mat-icon> Data </a> - <!-- <a routerLink="/ComingSoon" class="item"> <mat-icon class="white-icon">insights</mat-icon> Insights </a> - <a routerLink="/ComingSoon" class="item"> <mat-icon class="white-icon">tasks</mat-icon> Report </a> ---> - </nav> - </section> - - <header class="header"> - - <nav> - <!-- - <a class="item" [routerLink]='[{ outlets: { home: ["summary"],header: ["data"] } }]' > <mat-icon class="white-icon">table_chart</mat-icon> Summary </a> - <a class="item" [routerLink]='[{ outlets: { home: ["zoom"],header: ["data"] } }]'> <mat-icon class="white-icon">zoom_in</mat-icon> Zen Mode </a> - <a class="item" [routerLink]='[{ outlets: { home: ["compare"],header: ["data"] } }]'> <mat-icon class="white-icon">compare</mat-icon> Compare </a> ---> - - <router-outlet name="child1"></router-outlet> - <!-- - <app-data-header></app-data-header> --> +<div class="grid gap-8 pl-3 min-h-screen max-h-screen w-full grid-cols-[50px_1fr] grid-rows-[50px_1fr;] relative"> + <!--Nav bar--> + <div class="col-start-1 col-end-2 row-start-1 row-end-3 bg-white rounded-l shadow-xl my-3"> + <nav class="h-full w-full flex flex-col items-center [&>*]:m-4"> + <a routerLink="/data" class="w-5 h-5 rounded-full"> + <mat-icon class="bg-green-300 rounded-full">forest</mat-icon> + </a> + <a class="w-5 h-5 "> + <button #buttonRef [routerLink]='[{ outlets: { homeDash: ["dayData"] } }]'> + <mat-icon>insert_chart</mat-icon> + </button> + </a> + + <a class="w-5 h-5 "> + <button [routerLink]='[{ outlets: { homeDash: ["chart"] } }]'> + <mat-icon>query_stats</mat-icon> + </button> + </a> + + <a class="hidden"> + <button #buttonRef2 [routerLink]='[{ outlets: { homeDash: ["dayDataList"] } }]'> + <mat-icon>insert_chart</mat-icon> + </button> + </a> </nav> + </div> + <!--Content of the Website --> + <div class="sm:col-start-2 sm:col-end-3 sm:row-start-1 sm:row-end-3 + col-start-1 col-end-3 row-start-1 row-end-2 overflow-y-auto h-full scrollbar-hide rounded-l "> + <router-outlet name="homeDash"></router-outlet> + </div> - </header> - - - - <main class="main"> +</div> - <router-outlet name="child2"></router-outlet>` - </main> -</div> diff --git a/src/app/module/pages/home/home.component.spec.ts b/src/app/module/pages/home/home.component.spec.ts index 5075be7..e69de29 100644 --- a/src/app/module/pages/home/home.component.spec.ts +++ b/src/app/module/pages/home/home.component.spec.ts @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { HomeComponent } from './home.component'; - -describe('HomeComponent', () => { - let component: HomeComponent; - let fixture: ComponentFixture<HomeComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ HomeComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(HomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/pages/home/home.component.ts b/src/app/module/pages/home/home.component.ts index 463b813..4e1e813 100644 --- a/src/app/module/pages/home/home.component.ts +++ b/src/app/module/pages/home/home.component.ts @@ -1,222 +1,36 @@ -import {Component, ElementRef, HostBinding, Input, OnInit, ViewChild} from '@angular/core'; -import { MatIcon } from '@angular/material/icon'; -import {Chart} from "chart.js/auto"; -import {config, filter} from "rxjs"; -import {ActivatedRoute, NavigationEnd, Router} from "@angular/router"; +import {Component, ElementRef, ViewChild} from '@angular/core'; +import {SharedService} from "../../../shared/shared-service.service"; +import {Router} from "@angular/router"; + @Component({ selector: 'app-home', templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'] + styleUrls: ['./home.component.css'] }) -export class HomeComponent implements OnInit { +export class HomeComponent { - private i:boolean=true -/* - constructor(private router: Router) { - router.events.pipe( - filter(event => event instanceof NavigationEnd) - ) - .subscribe(event => { - console.log(event.toString()); - }); - } - */ - constructor(private router: Router) { + // @ts-ignore + @ViewChild('buttonRef') buttonRef: ElementRef; + // @ts-ignore + @ViewChild('buttonRef2') buttonRef2: ElementRef; - } - labels:any=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] + number = 0; -//*************************lineChart-Trio***************************** - data:any ={ - labels:this.labels, - datasets: [ { - label: "Temperature-1", - data: [1400, 3000, 2500, 4500, 2500, 3400, 3000], - fill:true, - // fillColor: '#d20f0f', - borderColor:"rgba(255, 10, 13, 0.8)", - backgroundColor: "rgba(255, 10, 13, 0.1)", - tension:0.2 - }, - { - label: "Temperature-2", - data: [1500, 2500, 2500, 4000, 2600, 3500, 2900], - fill:true, - // fillColor: '#d20f0f', - // borderColor:"#200", - borderColor:"rgba(136,26,28,0.8)", - backgroundColor: "rgba(255, 10, 13, 0.1)", - tension:0.2 - }, - { - label: "Temperature-3", - data: [1700, 2300, 2300, 3500, 2300, 4500, 2900], - fill:true, - // fillColor: '#d20f0f', - // borderColor:"#200", - borderColor:"rgba(255,10,141,0.8)", - backgroundColor: "rgba(255, 10, 13, 0.1)", - tension:0.2 - } - ] - } + constructor(private sharedService: SharedService) {} - linConfig:any={ - type:'line', - data:this.data, - options:{ - responsive:true, - radius:5, - hoverRadius:12, - hitRadius:30 - } - } - //*************************BarChart-Rain***************************** - databar:any ={ - labels:this.labels, - datasets: [ { - label: "Rain", - data: [1400, 300, 2500, 4500, 2500, 3400, 3000], - fill:true, - fillColor:'#111', - backgroundColor: "rgba(10,145,255,0.5)", - // borderColor:"#111", - - }] - } - barConfig:any={ - type:'bar', - data:this.databar, - options:{ - responsive:true, - radius:5, - hoverRadius:12, - hitRadius:30 - } + ngOnInit() { + this.sharedService.number$.subscribe(number => { + this.number = number; + this.onNumberChange(); + }); } -//*************************lineChart-Solo***************************** - data_lineSolo:any ={ - labels:this.labels, - datasets: [ { - label: "Rain", - data: [1400, 300, 2500, 4500, 2500, 3400, 3000], - fill:true, - fillColor:'#111', - borderColor:"rgba(75,154,3,0.9)", - backgroundColor: "rgba(10,255,43,0.1)", - // borderColor:"#111", - }] + onNumberChange() { + // Do something with the updated number + console.log(`Number changed to ${this.number}`); + if (this.number == 1) + this.buttonRef.nativeElement.click(); + if (this.number == 2) + this.buttonRef2.nativeElement.click(); } - config_lineSolo:any={ - type:'line', - data:this.data_lineSolo, - options:{ - responsive:true, - radius:3, - hoverRadius:12, - hitRadius:30, - tension:0.05, - - } - } - //*************************Pint-Dendrometer-Solo***************************** - data_pointSolo:any ={ - labels:this.labels, - datasets: [ { - label: "Dendrometer", - data: [1400, 300, 2500, 4500, 2500, 3400, 3000], - fill:true, - - // borderColor:"rgb(39,45,33)", - borderColor:"rgb(100,176,27)", - backgroundColor: "rgba(10,255,43,0.00)", - showLine:false - // borderColor:"#111", - - }] - } - blacK_config_pointSolo:any={ - type:'line', - data:this.data_pointSolo, - options:{ - plugins: { - legend: { - display: true, - labels: { - // color: 'white' - } - } - }, - labelColors:'white', - responsive:true, - radius:5, - hoverRadius:12, - hitRadius:30, - tension:0.05, - pointBorderWidth:4, - scales: { - x: { - grid: { - color:"rgba(255,255,255,0.3)", - }, - ticks: { - color: "white" - } - }, - y: { - grid: { - color:"rgba(255,255,255,0.3)", - }, - ticks: { - color: "white" - } - } - } - - } - } - white_data_pointSolo:any ={ - labels:this.labels, - datasets: [ { - label: "Rain", - data: [1400, 300, 2500, 4500, 2500, 3400, 3000], - fill:true, - fillColor:'#111', - borderColor:"rgba(75,154,3,0.9)", - backgroundColor: "rgba(10,255,43,0.1)", - // borderColor:"#111", - - }] - } - - - white_config_pointSolo:any={ - type:'line', - data:this.white_data_pointSolo, - options:{ - responsive:true, - radius:3, - hoverRadius:12, - hitRadius:30, - tension:0.05, - - } - } - - linechart: any; - barchart:any - soloLineChart:any - pointChart:any - - ngOnInit(): void { - this.linechart=new Chart('chart2',this.linConfig) - this.barchart=new Chart('barchart',this.barConfig) - this.soloLineChart=new Chart('soloLineChart',this.config_lineSolo) - this.pointChart= new Chart('pointChart',this.white_config_pointSolo) - console.log("helllllo") - console.log("hello"+this.router.url) - } - - } diff --git a/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.spec.ts b/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.spec.ts deleted file mode 100644 index 234fa3c..0000000 --- a/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { LoginTailwindcssComponent } from './login-tailwindcss.component'; - -describe('LoginTailwindcssComponent', () => { - let component: LoginTailwindcssComponent; - let fixture: ComponentFixture<LoginTailwindcssComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ LoginTailwindcssComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(LoginTailwindcssComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.ts b/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.ts deleted file mode 100644 index 3b2debb..0000000 --- a/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Component } from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from "@angular/forms"; -import {Router} from "@angular/router"; -import {ApiService} from "../../../shared/api.service"; - -@Component({ - selector: 'app-login-tailwindcss', - templateUrl: './login-tailwindcss.component.html', - styleUrls: ['./login-tailwindcss.component.css'] -}) -export class LoginTailwindcssComponent { - loginForm: FormGroup; - - constructor(private fb: FormBuilder,private api: ApiService, - private router:Router) { - this.loginForm = this.fb.group({ - username: ['', Validators.required], - password: ['', Validators.required] - }); - } - - onSubmit() { - if (this.loginForm.valid) { - console.log('Username:', this.loginForm.value.username); - console.log('Password:', this.loginForm.value.password); - } - this.login() - } - - login() { - console.log(this.loginForm.value) - this.api.post("http://localhost:8080/api/v1/auth/login", this.loginForm.value).subscribe( - (res: any) => { - console.log(res) - if (res && res.token) { - const role = res.roles[0]; - localStorage.setItem('token', res.token); - localStorage.setItem('role', role); - this.router.navigate([{ outlets: { main: ["homeDash"] } }]); - }}, - err => { - alert("Wrong username or password. Try again!") - // @ts-ignore - this.router.navigate(['/homeDash'], { outlets: { main: null } }); - }); - } -} diff --git a/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.css b/src/app/module/pages/login/login-tailwindcss.component.css similarity index 100% rename from src/app/module/pages/login-tailwindcss/login-tailwindcss.component.css rename to src/app/module/pages/login/login-tailwindcss.component.css diff --git a/src/app/module/pages/login-tailwindcss/login-tailwindcss.component.html b/src/app/module/pages/login/login-tailwindcss.component.html similarity index 100% rename from src/app/module/pages/login-tailwindcss/login-tailwindcss.component.html rename to src/app/module/pages/login/login-tailwindcss.component.html diff --git a/src/app/module/pages/login/login.component.css b/src/app/module/pages/login/login.component.css deleted file mode 100644 index 1de54bc..0000000 --- a/src/app/module/pages/login/login.component.css +++ /dev/null @@ -1,26 +0,0 @@ -.card { - margin-top: 10px; - border: none; - width: 500px; - padding: 40px; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background: hsla(205, 46%, 30%, 0.8); - background: linear-gradient(45deg, hsla(205, 46%, 30%, 0.8), hsla(24, 46%, 30%, 0.8)); -} - -.card h1 { - color: #fff; -} - -.form-text, h6 { - color: darkgray; -} - -label { - color: #fff; -} - - diff --git a/src/app/module/pages/login/login.component.html b/src/app/module/pages/login/login.component.html deleted file mode 100644 index eb944b5..0000000 --- a/src/app/module/pages/login/login.component.html +++ /dev/null @@ -1,27 +0,0 @@ -<div class="container"> - <div class="row"> - <div class="col-md-6"> - <div class="card"> - <div class="text-center"> - <img src="https://www.w3schools.com/bootstrap4/img_avatar1.png" alt="John" style="width:20%"> - <h1>Login</h1> - <h6>Enter your username and password</h6> - <form [formGroup]="formLogin" (ngSubmit)="login()"> - <div class="mb-3"> - <label for="username" class="form-label">Username</label> - <input type="text" class="form-control" id="username" aria-describedby="emailHelp" - formControlName="username"> - <div id="emailHelp" class="form-text">We'll never share your username with anyone else.</div> - </div> - <div class="mb-3"> - <label for="password" class="form-label">Password</label> - <input type="password" class="form-control" id="password" formControlName="password"> - </div> - <button type="submit" class="btn btn-primary">Login</button> - </form> - <a class="form-text" routerLink="/signup">New user? Click to sign up!</a> - </div> - </div> - </div> - </div> -</div> diff --git a/src/app/module/pages/login/login.component.spec.ts b/src/app/module/pages/login/login.component.spec.ts index 10eca24..4dd26ce 100644 --- a/src/app/module/pages/login/login.component.spec.ts +++ b/src/app/module/pages/login/login.component.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { LoginComponent } from './login.component'; +import { LoginTailwindcssComponent } from './login.component'; -describe('LoginComponent', () => { - let component: LoginComponent; - let fixture: ComponentFixture<LoginComponent>; +describe('LoginTailwindcssComponent', () => { + let component: LoginTailwindcssComponent; + let fixture: ComponentFixture<LoginTailwindcssComponent>; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ LoginComponent ] + declarations: [ LoginTailwindcssComponent ] }) .compileComponents(); - fixture = TestBed.createComponent(LoginComponent); + fixture = TestBed.createComponent(LoginTailwindcssComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/module/pages/login/login.component.ts b/src/app/module/pages/login/login.component.ts index fe2876d..7b358fe 100644 --- a/src/app/module/pages/login/login.component.ts +++ b/src/app/module/pages/login/login.component.ts @@ -1,56 +1,47 @@ -import {Component} from '@angular/core'; +import { Component } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from "@angular/forms"; import {Router} from "@angular/router"; -import {FormBuilder, FormGroup} from "@angular/forms"; import {ApiService} from "../../../shared/api.service"; -import {EventEmitterService} from "../../../shared/event.emitter.service"; -import {Lv1} from "../../../core/service/level1/Lv1"; @Component({ selector: 'app-login', - templateUrl: './login.component.html', - styleUrls: ['./login.component.css'] + templateUrl: './login-tailwindcss.component.html', + styleUrls: ['./login-tailwindcss.component.css'] }) -export class LoginComponent { +export class LoginTailwindcssComponent { + loginForm: FormGroup; - formLogin!: FormGroup; - lv1:Lv1| undefined; - - constructor(private fb: FormBuilder, private router: Router, private api: ApiService - , private eventEmitterService: EventEmitterService) { - this.formLogin = fb.group({ - username: [''], - password: [''] + constructor(private fb: FormBuilder,private api: ApiService, + private router:Router) { + this.loginForm = this.fb.group({ + username: ['', Validators.required], + password: ['', Validators.required] }); } - login() { - console.log(this.formLogin.value) - this.api.post("http://localhost:8080/api/v1/auth/login", this.formLogin.value).subscribe((res: any) => { + onSubmit() { + if (this.loginForm.valid) { + console.log('Username:', this.loginForm.value.username); + console.log('Password:', this.loginForm.value.password); + } + this.login() + } - console.log(res) - if (res && res.token) { - const role = res.roles[0]; - localStorage.setItem('token', res.token); - localStorage.setItem('role', role); - this.eventEmitterService.onLoginButtonClick(); - if (role === 'ROLE_ADMIN') { - this.router.navigate(['/admin']); - } else { - this.router.navigate(['/']); - } - this.formLogin.reset(); - } - this.api.get("http://localhost:8080/api/v1/server/get/lvl1/IBK?from=15.04.2022 00:00:00&to=15.04.2022 23:30:00").subscribe( - res=>{ - this.lv1=res - console.log(res) - console.log("avgMinMax",this.lv1?.avgMinMax[0].min.value) - console.log("sumOrAvg",this.lv1?.sumOrAvg[0].type) - } - ) - }, err => { - alert("Wrong username or password. Try again!") - this.formLogin.controls['password'].setValue(''); - }); + login() { + console.log(this.loginForm.value) + this.api.post("http://localhost:8080/api/v1/auth/login", this.loginForm.value).subscribe( + (res: any) => { + console.log(res) + if (res && res.token) { + const role = res.roles[0]; + localStorage.setItem('token', res.token); + localStorage.setItem('role', role); + this.router.navigate([{ outlets: { main: ["homeDash"] } }]); + }}, + err => { + alert("Wrong username or password. Try again!") + // @ts-ignore + this.router.navigate(['/homeDash'], { outlets: { main: null } }); + }); } } diff --git a/src/app/module/pages/mobile-home/mobile-home.component.css b/src/app/module/pages/mobile-home/mobile-home.component.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/module/pages/mobile-home/mobile-home.component.html b/src/app/module/pages/mobile-home/mobile-home.component.html deleted file mode 100644 index a659d5d..0000000 --- a/src/app/module/pages/mobile-home/mobile-home.component.html +++ /dev/null @@ -1,44 +0,0 @@ -<div class="grid gap-8 p-8 min-h-screen max-h-screen mb-5 w-full grid-cols-[50px_1fr] grid-rows-[1fr_50px;]"> - - - <div class="sm:col-start-1 sm:col-end-2 sm:row-start-1 sm:row-end-3 - col-start-1 col-end-3 row-start-2 row-end-3 bg-white rounded-l shadow-xl "> - <nav class="h-full w-full flex sm:flex-col items-center [&>*]:m-4 justify-center sm:justify-start"> - - <a *ngIf="mobile" class="w-5 h-5 rounded-full"> - <mat-icon class="bg-green-300 rounded-full">forest</mat-icon> - </a> - <a class=" w-5 h-5 rounded-full"> - <button> - <mat-icon>home</mat-icon> - </button> - </a> - <a class="w-5 h-5 rounded-full"> - <button> - <mat-icon>tune</mat-icon> - </button> - - </a> - <a class="w-5 h-5 "> - <button [routerLink]='[{ outlets: { homeDash: ["dayData"] } }]'> - <mat-icon >insert_chart</mat-icon> - </button> - </a> - <a class="w-5 h-5 "> - <button [routerLink]='[{ outlets: { homeDash: ["chart"] } }]'> - <mat-icon >query_stats</mat-icon> - </button> - </a> - </nav> - </div> - - - - <div class="sm:col-start-2 sm:col-end-3 sm:row-start-1 sm:row-end-3 - col-start-1 col-end-3 row-start-1 row-end-2 overflow-y-auto h-full scrollbar-hide rounded-l shadow-xl"> - <router-outlet name="homeDash2"></router-outlet> - <div class="bg-gradient-to-t from-cyan-500 to-blue-500 h-screen"> - </div> - </div> - -</div> diff --git a/src/app/module/pages/mobile-home/mobile-home.component.spec.ts b/src/app/module/pages/mobile-home/mobile-home.component.spec.ts deleted file mode 100644 index 72fd569..0000000 --- a/src/app/module/pages/mobile-home/mobile-home.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { MobileHomeComponent } from './mobile-home.component'; - -describe('MobileHomeComponent', () => { - let component: MobileHomeComponent; - let fixture: ComponentFixture<MobileHomeComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ MobileHomeComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(MobileHomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/module/pages/mobile-home/mobile-home.component.ts b/src/app/module/pages/mobile-home/mobile-home.component.ts deleted file mode 100644 index 3aff50c..0000000 --- a/src/app/module/pages/mobile-home/mobile-home.component.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-mobile-home', - templateUrl: './mobile-home.component.html', - styleUrls: ['./mobile-home.component.css'] -}) -export class MobileHomeComponent { - mobile = false; - ngOnInit() { - console.log(window.screen.width) - if (window.screen.width <= 360) { // 768px portrait - this.mobile = true; - } - } -} -- GitLab