feat(oggui): ask to queue reboot/poweroff if client is busy
Show a confirmation modal before sending reboot and poweroff requests, allowing the user to choose whether to queue the command when the client is busy (HTTP 409). Passes the 'queue' flag to the API accordingly.encolar_poweroff_reboot
parent
dcfb7c7d07
commit
df3ff55fb8
|
|
@ -10,6 +10,7 @@ import { MatDialog } from "@angular/material/dialog";
|
|||
import { RemoveCacheImageComponent } from "./remove-cache-image/remove-cache-image.component";
|
||||
import { AuthService } from '@services/auth.service';
|
||||
import {SoftwareProfilePartitionComponent} from "./software-profile-partition/software-profile-partition.component";
|
||||
import { QueueConfirmationModalComponent } from '../../../../shared/queue-confirmation-modal/queue-confirmation-modal.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-execute-command',
|
||||
|
|
@ -196,16 +197,19 @@ export class ExecuteCommandComponent implements OnInit {
|
|||
}
|
||||
|
||||
rebootClient(): void {
|
||||
this.http.post(`${this.baseUrl}/clients/server/reboot`, {
|
||||
clients: this.clientData.map((client: any) => client['@id'])
|
||||
}).subscribe(
|
||||
response => {
|
||||
this.toastService.success(this.translate.instant('clientUpdatedSuccessfully'));
|
||||
},
|
||||
error => {
|
||||
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
|
||||
}
|
||||
);
|
||||
const dialogRef = this.dialog.open(QueueConfirmationModalComponent, { width: '400px' });
|
||||
|
||||
dialogRef.afterClosed().subscribe((queue: boolean | undefined) => {
|
||||
if (queue === undefined) return;
|
||||
|
||||
this.http.post(`${this.baseUrl}/clients/server/reboot`, {
|
||||
clients: this.clientData.map((client: any) => client['@id']),
|
||||
queue
|
||||
}).subscribe(
|
||||
() => { this.toastService.success(this.translate.instant('clientUpdatedSuccessfully')); },
|
||||
(error: any) => { this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
refreshClient(): void {
|
||||
|
|
@ -332,16 +336,19 @@ export class ExecuteCommandComponent implements OnInit {
|
|||
}
|
||||
|
||||
powerOffClient(): void {
|
||||
this.http.post(`${this.baseUrl}/clients/server/power-off`, {
|
||||
clients: this.clientData.map((client: any) => client['@id'])
|
||||
}).subscribe(
|
||||
response => {
|
||||
this.toastService.success(this.translate.instant('shutdownRequestSentCorrectly'));
|
||||
},
|
||||
error => {
|
||||
this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente');
|
||||
}
|
||||
);
|
||||
const dialogRef = this.dialog.open(QueueConfirmationModalComponent, { width: '400px' });
|
||||
|
||||
dialogRef.afterClosed().subscribe((queue: boolean | undefined) => {
|
||||
if (queue === undefined) return;
|
||||
|
||||
this.http.post(`${this.baseUrl}/clients/server/power-off`, {
|
||||
clients: this.clientData.map((client: any) => client['@id']),
|
||||
queue
|
||||
}).subscribe(
|
||||
() => { this.toastService.success(this.translate.instant('shutdownRequestSentCorrectly')); },
|
||||
(error: any) => { this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
openPartitionAssistant(): void {
|
||||
|
|
|
|||
Loading…
Reference in New Issue