- - -
- - - - - - - - - - - - {{ title }} app is running! - - - - - -
- - -

Resources

-

Here are some links to help you get started:

- -
- - - - Learn Angular - - - - - - - CLI Documentation - - - - - - - - Angular Blog - - - - -
- - -

Next Steps

-

What do you want to do next with your app?

- - - -
-
- - - New Component -
- -
- - - Angular Material -
- -
- - - Add PWA Support -
- -
- - - Add Dependency -
- -
- - - Run and Watch Tests -
- -
- - - Build for Production -
-
- - -
-
ng generate component xyz
-
ng add @angular/material
-
ng add @angular/pwa
-
ng add _____
-
ng test
-
ng build --prod
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - +
+
diff --git a/ui/pi-web-agent-app/src/app/app.module.ts b/ui/pi-web-agent-app/src/app/app.module.ts index b1c6c96a..35873f8d 100644 --- a/ui/pi-web-agent-app/src/app/app.module.ts +++ b/ui/pi-web-agent-app/src/app/app.module.ts @@ -3,14 +3,25 @@ import { BrowserModule } from '@angular/platform-browser'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; +import { LiveInfoComponent } from './live-info/live-info.component'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import {MatDividerModule} from '@angular/material/divider'; +import {MatListModule} from '@angular/material/list'; +import { HttpClientModule } from '@angular/common/http'; + @NgModule({ declarations: [ - AppComponent + AppComponent, + LiveInfoComponent ], imports: [ BrowserModule, - AppRoutingModule + AppRoutingModule, + BrowserAnimationsModule, + MatDividerModule, + MatListModule, + HttpClientModule ], providers: [], bootstrap: [AppComponent] diff --git a/ui/pi-web-agent-app/src/app/live-info/live-info.component.html b/ui/pi-web-agent-app/src/app/live-info/live-info.component.html new file mode 100644 index 00000000..129b065a --- /dev/null +++ b/ui/pi-web-agent-app/src/app/live-info/live-info.component.html @@ -0,0 +1,9 @@ + + + + OS: {{system_info.OS_Info.Id}} {{system_info.OS_Info.Version_Codename}} + + Kernel: {{system_info.Kernel}} + + Temperature: {{system_info.Temperature}} + \ No newline at end of file diff --git a/ui/pi-web-agent-app/src/app/live-info/live-info.component.scss b/ui/pi-web-agent-app/src/app/live-info/live-info.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/ui/pi-web-agent-app/src/app/live-info/live-info.component.spec.ts b/ui/pi-web-agent-app/src/app/live-info/live-info.component.spec.ts new file mode 100644 index 00000000..81795635 --- /dev/null +++ b/ui/pi-web-agent-app/src/app/live-info/live-info.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LiveInfoComponent } from './live-info.component'; + +describe('LiveInfoComponent', () => { + let component: LiveInfoComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ LiveInfoComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(LiveInfoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/pi-web-agent-app/src/app/live-info/live-info.component.ts b/ui/pi-web-agent-app/src/app/live-info/live-info.component.ts new file mode 100644 index 00000000..56fe4d9c --- /dev/null +++ b/ui/pi-web-agent-app/src/app/live-info/live-info.component.ts @@ -0,0 +1,27 @@ +import { Component, OnInit } from '@angular/core'; +import { SystemInfo, SystemInfoService } from '../system-info.service'; + +@Component({ + selector: 'app-live-info', + templateUrl: './live-info.component.html', + styleUrls: ['./live-info.component.scss'] +}) +export class LiveInfoComponent implements OnInit { + + constructor(private system_info_service: SystemInfoService) { } + + system_info: SystemInfo = { + Temperature: "", + Kernel: "", + OS_Info: { + Id: "", + Version_Codename: "" + } + } + ngOnInit(): void { + this.system_info_service.fetch_system_info().subscribe( + (info: SystemInfo) => this.system_info = info + ); + } + +} \ No newline at end of file diff --git a/ui/pi-web-agent-app/src/app/system-info.service.spec.ts b/ui/pi-web-agent-app/src/app/system-info.service.spec.ts new file mode 100644 index 00000000..4175368d --- /dev/null +++ b/ui/pi-web-agent-app/src/app/system-info.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { SystemInfoService } from './system-info.service'; + +describe('SystemInfoService', () => { + let service: SystemInfoService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(SystemInfoService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/ui/pi-web-agent-app/src/app/system-info.service.ts b/ui/pi-web-agent-app/src/app/system-info.service.ts new file mode 100644 index 00000000..4406965a --- /dev/null +++ b/ui/pi-web-agent-app/src/app/system-info.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class SystemInfoService { + + private api_endpoint = "/api/info" + + constructor(private http: HttpClient) { } + + + fetch_system_info() { + return this.http.get(`${this.api_endpoint}/os_info`) + } +} + +export interface SystemInfo { + Temperature: string, + Kernel: string, + OS_Info: { + Id: string, + Version_Codename: string + } +} diff --git a/ui/pi-web-agent-app/src/index.html b/ui/pi-web-agent-app/src/index.html index a8efa205..c0b8ea9d 100644 --- a/ui/pi-web-agent-app/src/index.html +++ b/ui/pi-web-agent-app/src/index.html @@ -6,8 +6,11 @@ + + + - + diff --git a/ui/pi-web-agent-app/src/styles.scss b/ui/pi-web-agent-app/src/styles.scss index 90d4ee00..7e7239a2 100644 --- a/ui/pi-web-agent-app/src/styles.scss +++ b/ui/pi-web-agent-app/src/styles.scss @@ -1 +1,4 @@ /* You can add global styles to this file, and also import other style files */ + +html, body { height: 100%; } +body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }