refs #1079. Commands edit readOnly disabled
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
parent
151ea50c4f
commit
3172b512c2
|
@ -38,8 +38,8 @@
|
|||
<th mat-header-cell *matHeaderCellDef i18n="@@columnActions" style="text-align: center;">Acciones</th>
|
||||
<td mat-cell *matCellDef="let client" style="text-align: center;">
|
||||
<button mat-icon-button color="info" (click)="viewDetails($event, client)"><mat-icon i18n="@@deleteElementTooltip">visibility</mat-icon></button>
|
||||
<button mat-icon-button color="primary" (click)="editCommand($event, client)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" (click)="deleteCommand($event, client)"><mat-icon i18n="@@deleteElementTooltip">delete</mat-icon></button>
|
||||
<button mat-icon-button color="primary" [disabled]="client.readOnly" (click)="editCommand($event, client)" i18n="@@editImage"> <mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" [disabled]="client.readOnly" (click)="deleteCommand($event, client)"><mat-icon i18n="@@deleteElementTooltip">delete</mat-icon></button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -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, {
|
||||
|
|
|
@ -28,11 +28,4 @@
|
|||
</mat-form-field>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="button-row">
|
||||
<button mat-button color="primary" class="primary-button" [disabled]="false" (click)="execute()" >
|
||||
{{ showClientSelect ? 'Ejecutar' : 'Configurar ejecución' }}
|
||||
</button>
|
||||
<button mat-button (click)="cancel()">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -38,54 +38,12 @@ export class CommandDetailComponent implements OnInit {
|
|||
this.http.get<any>(`${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',
|
||||
|
|
Loading…
Reference in New Issue