feat: update firmware version after update (#649)
* feat: add clipboard copy icon to the x-term-component * feat: start device poll after firmware upgrade * feat: remove the OK button from the firmware upgrade page * feat: read the firmware after firmware upgrade * fix: scrolling of the x-term-component * feat: refresh the firmware version after recovery device * fix: remove the scrollbar styling * fix: stay on device firmware upgrade screen
This commit is contained in:
committed by
László Monda
parent
6c4f580fc2
commit
a6678bd537
@@ -39,15 +39,10 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex-grow" #scrollMe>
|
||||
<div class="flex-grow">
|
||||
<xterm [logs]="xtermLog$ | async"></xterm>
|
||||
</div>
|
||||
<div class="flex-footer">
|
||||
<button type="button"
|
||||
class="btn btn-primary ok-button"
|
||||
[disabled]="firmwareOkButtonDisabled$ | async"
|
||||
(click)="onOkButtonClick()">OK
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
@@ -6,13 +6,12 @@ import { HardwareModules, VersionInformation } from 'uhk-common';
|
||||
|
||||
import {
|
||||
AppState,
|
||||
firmwareOkButtonDisabled,
|
||||
flashFirmwareButtonDisbabled,
|
||||
getAgentVersionInfo,
|
||||
getHardwareModules,
|
||||
xtermLog
|
||||
} from '../../../store';
|
||||
import { UpdateFirmwareAction, UpdateFirmwareOkButtonAction, UpdateFirmwareWithAction } from '../../../store/actions/device';
|
||||
import { UpdateFirmwareAction, UpdateFirmwareWithAction } from '../../../store/actions/device';
|
||||
import { XtermLog } from '../../../models/xterm-log';
|
||||
|
||||
@Component({
|
||||
@@ -26,33 +25,20 @@ import { XtermLog } from '../../../models/xterm-log';
|
||||
export class DeviceFirmwareComponent implements OnDestroy {
|
||||
flashFirmwareButtonDisbabled$: Observable<boolean>;
|
||||
xtermLog$: Observable<Array<XtermLog>>;
|
||||
xtermLogSubscription: Subscription;
|
||||
getAgentVersionInfo$: Observable<VersionInformation>;
|
||||
firmwareOkButtonDisabled$: Observable<boolean>;
|
||||
hardwareModulesSubscription: Subscription;
|
||||
hardwareModules: HardwareModules;
|
||||
|
||||
@ViewChild('scrollMe') divElement: ElementRef;
|
||||
|
||||
constructor(private store: Store<AppState>) {
|
||||
this.flashFirmwareButtonDisbabled$ = store.select(flashFirmwareButtonDisbabled);
|
||||
this.xtermLog$ = store.select(xtermLog);
|
||||
this.xtermLogSubscription = this.xtermLog$.subscribe(() => {
|
||||
if (this.divElement && this.divElement.nativeElement) {
|
||||
setTimeout(() => {
|
||||
this.divElement.nativeElement.scrollTop = this.divElement.nativeElement.scrollHeight;
|
||||
});
|
||||
}
|
||||
});
|
||||
this.getAgentVersionInfo$ = store.select(getAgentVersionInfo);
|
||||
this.firmwareOkButtonDisabled$ = store.select(firmwareOkButtonDisabled);
|
||||
this.hardwareModulesSubscription = store.select(getHardwareModules).subscribe(data => {
|
||||
this.hardwareModules = data;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.xtermLogSubscription.unsubscribe();
|
||||
this.hardwareModulesSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
@@ -60,10 +46,6 @@ export class DeviceFirmwareComponent implements OnDestroy {
|
||||
this.store.dispatch(new UpdateFirmwareAction());
|
||||
}
|
||||
|
||||
onOkButtonClick(): void {
|
||||
this.store.dispatch(new UpdateFirmwareOkButtonAction());
|
||||
}
|
||||
|
||||
changeFile(event): void {
|
||||
const files = event.srcElement.files;
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex-grow" #scrollMe>
|
||||
<xterm [logs]="xtermLog"></xterm>
|
||||
<div class="flex-grow">
|
||||
<xterm [logs]="xtermLog$ | async"></xterm>
|
||||
</div>
|
||||
<div class="flex-footer">
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { XtermLog } from '../../../models/xterm-log';
|
||||
@@ -16,38 +15,17 @@ import { RecoveryDeviceAction } from '../../../store/actions/device';
|
||||
'class': 'container-fluid'
|
||||
}
|
||||
})
|
||||
export class RecoveryModeComponent implements OnInit, OnDestroy {
|
||||
xtermLogSubscription: Subscription;
|
||||
export class RecoveryModeComponent implements OnInit {
|
||||
flashFirmwareButtonDisbabled$: Observable<boolean>;
|
||||
|
||||
xtermLog: Array<XtermLog>;
|
||||
xtermLog$: Observable<Array<XtermLog>>;
|
||||
|
||||
@ViewChild('scrollMe') divElement: ElementRef;
|
||||
|
||||
constructor(private store: Store<AppState>,
|
||||
private cdRef: ChangeDetectorRef) {
|
||||
constructor(private store: Store<AppState>) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.flashFirmwareButtonDisbabled$ = this.store.select(flashFirmwareButtonDisbabled);
|
||||
this.xtermLogSubscription = this.store.select(xtermLog)
|
||||
.subscribe(data => {
|
||||
this.xtermLog = data;
|
||||
|
||||
this.cdRef.markForCheck();
|
||||
|
||||
if (this.divElement && this.divElement.nativeElement) {
|
||||
setTimeout(() => {
|
||||
this.divElement.nativeElement.scrollTop = this.divElement.nativeElement.scrollHeight;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.xtermLogSubscription) {
|
||||
this.xtermLogSubscription.unsubscribe();
|
||||
}
|
||||
this.xtermLog$ = this.store.select(xtermLog);
|
||||
}
|
||||
|
||||
onRecoveryDevice(): void {
|
||||
|
||||
Reference in New Issue
Block a user