-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Feature - Simple component that provides a poweroff and reboot interface - Simple backend implementation - no scheduling - Connecting the component calls to the websocket e2e ## Fixes - Try to reconnect if websocket closes Resolves #172
- Loading branch information
Showing
11 changed files
with
134 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<mat-action-list> | ||
<button mat-list-item mat-icon-button color="warn" aria-label="Poweroff system" (click)="poweroff()"> | ||
<mat-icon>power_settings_new</mat-icon> Poweroff | ||
</button> | ||
<button mat-list-item mat-icon-button color="warn" aria-label="Reboot system" (click)="reboot()"> | ||
<mat-icon>cached</mat-icon> Reboot | ||
</button> | ||
</mat-action-list> |
Empty file.
25 changes: 25 additions & 0 deletions
25
ui/pi-web-agent-app/src/app/poweroff/poweroff.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { PoweroffComponent } from './poweroff.component'; | ||
|
||
describe('PoweroffComponent', () => { | ||
let component: PoweroffComponent; | ||
let fixture: ComponentFixture<PoweroffComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ PoweroffComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(PoweroffComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
ui/pi-web-agent-app/src/app/poweroff/poweroff.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { PiControlService } from '../pi-control.service'; | ||
|
||
@Component({ | ||
selector: 'app-poweroff', | ||
templateUrl: './poweroff.component.html', | ||
styleUrls: ['./poweroff.component.scss'] | ||
}) | ||
export class PoweroffComponent implements OnInit { | ||
|
||
constructor(private piControlService: PiControlService) { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
poweroff(): void { | ||
this.piControlService.sendCommand({Action_Type: 'POWER_OFF'}); | ||
} | ||
|
||
reboot(): void { | ||
this.piControlService.sendCommand({Action_Type: 'REBOOT'}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters