generated from maximegris/angular-electron
-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from webosbrew/fix/renew-devmode
fixed #72
- Loading branch information
Showing
12 changed files
with
212 additions
and
38 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,3 @@ | ||
<ul class="overflow-scroll" *ngIf="logs"> | ||
<li *ngFor="let log of logs">{{log}}</li> | ||
</ul> |
Empty file.
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 { MessagesComponent } from './messages.component'; | ||
|
||
describe('MessagesComponent', () => { | ||
let component: MessagesComponent; | ||
let fixture: ComponentFixture<MessagesComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ MessagesComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(MessagesComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
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,49 @@ | ||
import {Component, Input, OnDestroy, OnInit} from '@angular/core'; | ||
import {Device} from "../../types"; | ||
import {RemoteCommandService} from "../../core/services/remote-command.service"; | ||
import {noop, Observable, Subscription, tap} from "rxjs"; | ||
|
||
@Component({ | ||
selector: 'app-log-messages', | ||
templateUrl: './messages.component.html', | ||
styleUrls: ['./messages.component.scss'] | ||
}) | ||
export class MessagesComponent implements OnDestroy { | ||
|
||
logs: string[] = []; | ||
|
||
private deviceField: Device | null = null; | ||
private subscription?: Subscription; | ||
|
||
constructor(private cmd: RemoteCommandService) { | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.subscription?.unsubscribe(); | ||
} | ||
|
||
get device(): Device | null { | ||
return this.deviceField; | ||
} | ||
|
||
@Input() | ||
set device(device: Device | null) { | ||
this.deviceField = device; | ||
this.subscription?.unsubscribe(); | ||
this.subscription = undefined; | ||
this.logs = []; | ||
if (device) { | ||
this.reload(device).catch(noop); | ||
} | ||
} | ||
|
||
private async reload(device: Device): Promise<void> { | ||
this.subscription = (await this.logread(device)).subscribe((row) => { | ||
this.logs.push(row); | ||
}); | ||
} | ||
|
||
private async logread(device: Device) { | ||
return await this.cmd.popen(device, 'tail -f /var/log/messages', 'utf-8'); | ||
} | ||
} |
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
Oops, something went wrong.