Remove executeCommand function and console logs
parent
16a07f5139
commit
e5d1b30386
|
@ -32,10 +32,6 @@
|
|||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<button mat-menu-item (click)="executeCommand(command)">
|
||||
<mat-icon>play_arrow</mat-icon>
|
||||
<span>Ejecutar</span>
|
||||
</button>
|
||||
<button mat-menu-item (click)="viewDetails(command)">
|
||||
<mat-icon>info</mat-icon>
|
||||
<span>Detalles</span>
|
||||
|
|
|
@ -44,10 +44,6 @@ export class CommandsComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
executeCommand(command: any): void {
|
||||
console.log('Ejecutar comando:', command);
|
||||
}
|
||||
|
||||
editCommand(command: any): void {
|
||||
const dialogRef = this.dialog.open(CreateCommandComponent, {
|
||||
width: '600px',
|
||||
|
@ -74,7 +70,6 @@ export class CommandsComponent implements OnInit {
|
|||
}
|
||||
|
||||
deleteCommand(command: any): void {
|
||||
console.log('Eliminar comando:', command);
|
||||
const dialogRef = this.dialog.open(DeleteModalComponent,
|
||||
{
|
||||
width: '300px',
|
||||
|
|
|
@ -43,6 +43,7 @@ export class CommandDetailComponent implements OnInit {
|
|||
} else {
|
||||
if (this.form.get('selectedClients')?.value.length > 0) {
|
||||
console.log('Ejecutar comando con los siguientes clientes:', this.form.value.selectedClients);
|
||||
console.log('Comando ejecutado', this.data.command);
|
||||
this.dialogRef.close();
|
||||
} else {
|
||||
this.form.get('selectedClients')?.markAsTouched();
|
||||
|
|
|
@ -11,6 +11,7 @@ import { CommandDetailComponent } from '../../commands/detail-command/command-de
|
|||
styleUrls: ['./acctions-modal.component.css']
|
||||
})
|
||||
export class AcctionsModalComponent {
|
||||
baseUrl: string = import.meta.env.NG_APP_BASE_API_URL;
|
||||
selectedElements: any;
|
||||
commands: any[] = [];
|
||||
displayedColumns: string[] = ['name', 'createdBy', 'createdAt'];
|
||||
|
@ -52,19 +53,22 @@ export class AcctionsModalComponent {
|
|||
}
|
||||
|
||||
onCommandClick(command: any): void {
|
||||
const dialogRef = this.dialog.open(CommandDetailComponent, {
|
||||
width: '600px',
|
||||
data: {
|
||||
command: command,
|
||||
importedClients: this.selectedElements
|
||||
}
|
||||
});
|
||||
const payload = {
|
||||
clients: this.selectedElements.map((uuid: any) => `/clients/${uuid}`)
|
||||
};
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
console.log('Modal cerrado. Resultado:', result);
|
||||
}
|
||||
});
|
||||
const apiUrl = `${this.baseUrl}/commands/${command.uuid}/execute`;
|
||||
|
||||
this.http.post(apiUrl, payload).subscribe({
|
||||
next: () => {
|
||||
console.log('Command executed successfully');
|
||||
this.loadCommands();
|
||||
this.toastService.success('Command executed successfully');
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error executing command:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
chunkArray(arr: any[], chunkSize: number): any[] {
|
||||
|
|
|
@ -378,7 +378,7 @@ export class GroupsComponent implements OnInit {
|
|||
|
||||
onCheckboxChange(event: any, name: string, uuid: string) {
|
||||
if (event.checked) {
|
||||
this.selectedElements.push({ name, uuid });
|
||||
this.selectedElements.push(uuid);
|
||||
} else {
|
||||
const index = this.selectedElements.indexOf(name);
|
||||
if (index > -1) {
|
||||
|
@ -387,14 +387,13 @@ export class GroupsComponent implements OnInit {
|
|||
}
|
||||
|
||||
this.isAllSelected = this.selectedElements.length === this.filteredResults.length;
|
||||
console.log(this.selectedElements);
|
||||
}
|
||||
|
||||
toggleSelectAll() {
|
||||
this.isAllSelected = !this.isAllSelected;
|
||||
|
||||
if (this.isAllSelected) {
|
||||
this.selectedElements = this.filteredResults.map(result => result.name);
|
||||
this.selectedElements = this.filteredResults.map(result => result.uuid);
|
||||
} else {
|
||||
this.selectedElements = [];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue