diff --git a/src/app/app.component.html b/src/app/app.component.html index cda1dc1acf33b7c3dc686a50f226f3ca02f8b106..b66bc67aa26fd9c9da8e42692daa3e2ada47a102 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -24,8 +24,6 @@ </div> </nav> --> - -<app-home></app-home> - +<app-lev0></app-lev0> diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 36e9d2bddb957e834a814f2c6ab04e8eae4a0dd5..cc41dd019fbbde6c0fa1b35919aeadf474a5fe29 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -5,7 +5,7 @@ import {AppRoutingModule} from './app-routing.module'; import {AppComponent} from './app.component'; import {AdminDashboardComponent} from './module/pages/admin-dashboard/admin-dashboard.component'; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; -import {MatFormFieldModule, MatLabel} from '@angular/material/form-field'; +import {MatFormFieldModule} from '@angular/material/form-field'; import {HttpClientModule} from "@angular/common/http"; import { LoginComponent } from './module/pages/login/login.component'; import { SignupComponent } from './module/pages/signup/signup.component'; @@ -30,6 +30,8 @@ import { DataHeaderComponent } from './module/components/header/data-header/data 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 { LightChartComponent } from './module/components/charts/light-chart/light-chart.component'; @@ -52,6 +54,8 @@ import { CoomingSoonHeaderComponent } from './module/components/cooming-soon-hea ConfigHeaderComponent, ComingSoonComponent, CoomingSoonHeaderComponent, + Lev0Component, + LightChartComponent, ], imports: [ BrowserModule, diff --git a/src/app/core/service/level1/AvgMinMax.ts b/src/app/core/service/level1/AvgMinMax.ts new file mode 100644 index 0000000000000000000000000000000000000000..83817cd808e5ed84ea19648d9f6b2553d09c6fbd --- /dev/null +++ b/src/app/core/service/level1/AvgMinMax.ts @@ -0,0 +1,10 @@ +import {Limit} from "./Limit"; + +export interface AvgMinMax{ + "name": String, + "min": Limit, + "max": Limit, + "avg": 0, + "sensorType": String, + "isSensorGroup": boolean +} diff --git a/src/app/core/service/level1/Limit.ts b/src/app/core/service/level1/Limit.ts new file mode 100644 index 0000000000000000000000000000000000000000..7876887b41372b34ef7ab2852486e1415c9cccf7 --- /dev/null +++ b/src/app/core/service/level1/Limit.ts @@ -0,0 +1,4 @@ +export interface Limit{ + "value":String, + "timestamp":String +} diff --git a/src/app/core/service/level1/Lv1.ts b/src/app/core/service/level1/Lv1.ts new file mode 100644 index 0000000000000000000000000000000000000000..e5e07ec57dffeaf5782fa997ca672a42cbd679fa --- /dev/null +++ b/src/app/core/service/level1/Lv1.ts @@ -0,0 +1,7 @@ +import {SumOrAvg} from "./SumOrAvg"; +import {AvgMinMax} from "./AvgMinMax"; + +export interface Lv1{ + "sumOrAvg":SumOrAvg[], + "avgMinMax":AvgMinMax[] +} diff --git a/src/app/core/service/level1/SumOrAvg.ts b/src/app/core/service/level1/SumOrAvg.ts new file mode 100644 index 0000000000000000000000000000000000000000..01efe61ae094354a2e677fd4389bc6b198ba1f20 --- /dev/null +++ b/src/app/core/service/level1/SumOrAvg.ts @@ -0,0 +1,7 @@ +export interface SumOrAvg{ + "type": String, + "name": String, + "value": Number, + "sensorType": String, + "isSensorGroup": boolean +} diff --git a/src/app/module/components/charts/light-chart/light-chart.component.html b/src/app/module/components/charts/light-chart/light-chart.component.html new file mode 100644 index 0000000000000000000000000000000000000000..21fea0dfa8854568278fb6ca2c3c807aef1e93e6 --- /dev/null +++ b/src/app/module/components/charts/light-chart/light-chart.component.html @@ -0,0 +1,3 @@ +<div class="chart"> + <canvas id="linechart" width="100%"></canvas> +</div> diff --git a/src/app/module/components/charts/light-chart/light-chart.component.scss b/src/app/module/components/charts/light-chart/light-chart.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..5b4203f89994e20398f0bfe982a70fd8a8318eaf --- /dev/null +++ b/src/app/module/components/charts/light-chart/light-chart.component.scss @@ -0,0 +1,5 @@ +.chart{ + margin: 50px; + height: 300px; + width: 400px; +} diff --git a/src/app/module/components/charts/light-chart/light-chart.component.spec.ts b/src/app/module/components/charts/light-chart/light-chart.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..35d9d87e0231af2f0436ef115f276433b03a842a --- /dev/null +++ b/src/app/module/components/charts/light-chart/light-chart.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LightChartComponent } from './light-chart.component'; + +describe('LightChartComponent', () => { + let component: LightChartComponent; + let fixture: ComponentFixture<LightChartComponent>; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ LightChartComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(LightChartComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/module/components/charts/light-chart/light-chart.component.ts b/src/app/module/components/charts/light-chart/light-chart.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..037db684d7a391541f85c721ad5039a66d93d466 --- /dev/null +++ b/src/app/module/components/charts/light-chart/light-chart.component.ts @@ -0,0 +1,98 @@ +import {Component, OnInit} from '@angular/core'; +import {Chart} from "chart.js/auto"; + +@Component({ + selector: 'app-light-chart', + templateUrl: './light-chart.component.html', + styleUrls: ['./light-chart.component.scss'] +}) +export class LightChartComponent implements OnInit{ + labels:any=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] + labelsTime:any=["0:00", "1:00", "2:00","3:00", "4:00", "5:00","6:00", "7:00","8:00", "9:00", "10:00" ,"11:00","12:00", + "13:00", "14:00", "15:00","16:00", "17:00","18:00", "19:00", "20:00" ,"21:00","22:00","23:00"] + + dataTima:any= [14, 15, 15, 15, 14, 16, 17,17,17,18,19,19,19,22,23,23,24,23,20,19,18,18,19,18] + dataTime2:any= [24, 25, 25, 25, 24, 26, 27,27,27,28,29,29,19,22,23,23,24,23,20,19,18,18,19,18] + dataConst:any= [14, 14, 14, 14, 14, 14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14] + dataConstMax:any= [24, 24, 24, 24, 24, 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24] + dataDay:any=[1400, 3000, 2500, 4500, 2500, 3400, 3000] +//*************************lineChart-Trio***************************** + data:any ={ + labels:this.labelsTime, + datasets: [ { + label: "Temperature-1", + data: this.dataTima, + fill:true, + // fillColor: '#d20f0f', + borderColor:"rgba(255, 10, 13, 0.8)", + backgroundColor: "rgba(255, 10, 13, 0.1)", + tension:0.2, + + }, + { + label: "Min", + data: this.dataConst, + fill:true, + // fillColor: '#d20f0f', + borderColor:"rgba(130,220,16,0.8)", + backgroundColor: "rgba(255, 10, 13, 0.0)", + tension:0.2, + radius:0, + hoverRadius:0, + }, + { + label: "Max", + data: this.dataConstMax, + fill:true, + // fillColor: '#d20f0f', + borderColor:"rgba(220,16,16,0.8)", + backgroundColor: "rgba(255, 10, 13, 0.0)", + tension:0.2, + radius:0, + hoverRadius:0, + hitRadius:3 + } + ] + } + + linConfig:any={ + type:'line', + data:this.data, + options:{ + + responsive:true, + radius:5, + hoverRadius:12, + hitRadius:30, + tooltips: { + mode: 'index', + intersect: true + }, + plugins:{ + legend: { + display: false + } + }, + + /* scales: {y: { title: { display: true, text: 'mm' }}, + + xAxes: { + title: { + display: true, + text: "test", + font: { + size: 15 + } + } + } + } + */ + } + } + linechart: any; + ngOnInit(): void { + this.linechart = new Chart('linechart', this.linConfig) + } + + +} diff --git a/src/app/module/pages/login/login.component.ts b/src/app/module/pages/login/login.component.ts index 3196e5be9d0673c53065511408e9988f274209e6..eedb9f2faa0ec2069c8582884fc030a25fe3e334 100644 --- a/src/app/module/pages/login/login.component.ts +++ b/src/app/module/pages/login/login.component.ts @@ -3,6 +3,7 @@ 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', @@ -12,6 +13,7 @@ import {EventEmitterService} from "../../../shared/event.emitter.service"; export class LoginComponent { formLogin!: FormGroup; + lv1:Lv1| undefined; constructor(private fb: FormBuilder, private router: Router, private api: ApiService , private eventEmitterService: EventEmitterService) { @@ -23,6 +25,8 @@ export class LoginComponent { login() { this.api.post("http://localhost:8080/api/v1/auth/login", this.formLogin.value).subscribe((res: any) => { + + console.log(res) if (res && res.token) { const role = res.roles[0]; localStorage.setItem('token', res.token); @@ -35,6 +39,14 @@ export class LoginComponent { } 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(''); diff --git a/src/assets/Icon-awesome-cloud-rain.png b/src/assets/Icon-awesome-cloud-rain.png new file mode 100644 index 0000000000000000000000000000000000000000..9e9c84fc9e9c4ce79fedccd431c1397ccc671bc6 Binary files /dev/null and b/src/assets/Icon-awesome-cloud-rain.png differ diff --git a/src/assets/Icon-awesome-cloud-rain.svg b/src/assets/Icon-awesome-cloud-rain.svg new file mode 100644 index 0000000000000000000000000000000000000000..73468dc7b7325210a0789a04664bbb51d2a498e2 --- /dev/null +++ b/src/assets/Icon-awesome-cloud-rain.svg @@ -0,0 +1,3 @@ +<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>