fix restart button

This commit is contained in:
Ben 2024-03-11 23:08:54 -04:00
parent e23e23db5f
commit 90da2cdece
4 changed files with 19 additions and 15 deletions

View File

@ -40,7 +40,8 @@ import { AppTopBarComponent } from './app.topbar.component';
InputSwitchModule,
RippleModule,
RouterModule,
PrimeNGModule
PrimeNGModule,
],
exports: [AppLayoutComponent]
})

View File

@ -5,6 +5,6 @@
</ng-container>
<p-button id="restart" label="Restart" severity="danger"></p-button>
<p-button (click)="restart()" id="restart" label="Restart" severity="danger"></p-button>
</ul>

View File

@ -1,5 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { SystemService } from '../services/system.service';
import { LayoutService } from './service/app.layout.service';
@Component({
@ -10,7 +12,10 @@ export class AppMenuComponent implements OnInit {
model: any[] = [];
constructor(public layoutService: LayoutService) { }
constructor(public layoutService: LayoutService,
private systemService: SystemService,
private toastr: ToastrService
) { }
ngOnInit() {
this.model = [
@ -27,4 +32,14 @@ export class AppMenuComponent implements OnInit {
];
}
public restart() {
this.systemService.restart().subscribe(res => {
});
this.toastr.success('Success!', 'Bitaxe restarted');
}
}

View File

@ -1,8 +1,6 @@
import { Component, ElementRef, ViewChild } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MenuItem } from 'primeng/api';
import { SystemService } from '../services/system.service';
import { LayoutService } from './service/app.layout.service';
@Component({
@ -20,17 +18,7 @@ export class AppTopBarComponent {
@ViewChild('topbarmenu') menu!: ElementRef;
constructor(public layoutService: LayoutService,
private systemService: SystemService,
private toastr: ToastrService
) { }
public restart() {
this.systemService.restart().subscribe(res => {
});
this.toastr.success('Success!', 'Bitaxe restarted');
}
}