diff --git a/ogWebconsole/src/app/components/commands/main-commands/commands.component.html b/ogWebconsole/src/app/components/commands/main-commands/commands.component.html index bec46a6..9f06e86 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/commands.component.html +++ b/ogWebconsole/src/app/components/commands/main-commands/commands.component.html @@ -38,8 +38,8 @@ Acciones - - + + diff --git a/ogWebconsole/src/app/components/commands/main-commands/commands.component.ts b/ogWebconsole/src/app/components/commands/main-commands/commands.component.ts index 2a3f283..886ef3e 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/commands.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/commands.component.ts @@ -74,7 +74,7 @@ export class CommandsComponent implements OnInit { this.dialog.open(CommandDetailComponent, { width: '800px', data: command, - }).afterClosed().subscribe(() => this.search()); + }); } openCreateCommandModal(): void { @@ -91,6 +91,7 @@ export class CommandsComponent implements OnInit { }).afterClosed().subscribe(() => this.search()); } + deleteCommand(event: MouseEvent, command: any): void { event.stopPropagation(); this.dialog.open(DeleteModalComponent, { diff --git a/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.html b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.html index e57b564..d5eb110 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.html +++ b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.html @@ -28,11 +28,4 @@ - -
- - -
diff --git a/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts index 0e9690e..7df79bf 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/detail-command/command-detail.component.ts @@ -38,54 +38,12 @@ export class CommandDetailComponent implements OnInit { this.http.get(`${this.baseUrl}/clients?page=1&itemsPerPage=30`).subscribe(response => { this.clients = response['hydra:member']; }); - - } - - execute(): void { - if (!this.showClientSelect) { - this.showClientSelect = true; - } else { - if (this.form.get('selectedClients')?.value.length > 0) { - - const payload = { - clients: this.form.value.selectedClients.map((uuid: any) => `/clients/${uuid}`) - }; - - const apiUrl = `${this.baseUrl}/commands/${this.data.uuid}/execute`; - this.http.post(apiUrl, payload).subscribe({ - next: () => { - this.dialogRef.close(); - this.toastService.success('Command executed successfully'); - }, - error: (error) => { - console.error('Error executing command:', error); - } - }); - - this.dialogRef.close(); - } else { - this.form.get('selectedClients')?.markAsTouched(); - } - } } onClientSelectionChange(event: any): void { this.canExecute = this.form.get('selectedClients')?.value.length > 0; } - onScheduleChange(event: any): void { - this.showDatePicker = event.checked; - if (event.checked) { - this.form.get('scheduleDate')?.setValidators(Validators.required); - this.form.get('scheduleTime')?.setValidators(Validators.required); - } else { - this.form.get('scheduleDate')?.clearValidators(); - this.form.get('scheduleTime')?.clearValidators(); - } - this.form.get('scheduleDate')?.updateValueAndValidity(); - this.form.get('scheduleTime')?.updateValueAndValidity(); - } - edit(): void { const dialogRef = this.dialog.open(CreateCommandComponent, { width: '600px',