refs #1645. Cancel deploy image button
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
parent
c568d5a8e7
commit
b23d1727e8
|
@ -92,3 +92,27 @@ table {
|
||||||
background-color: #f5a623 !important;
|
background-color: #f5a623 !important;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-progress-flex {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.cancel-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-button {
|
||||||
|
color: red;
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-button mat-icon {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<mat-option [value]="'pending'">Pendiente de ejecutar</mat-option>
|
<mat-option [value]="'pending'">Pendiente de ejecutar</mat-option>
|
||||||
<mat-option [value]="'in-progress'">Ejecutando</mat-option>
|
<mat-option [value]="'in-progress'">Ejecutando</mat-option>
|
||||||
<mat-option [value]="'success'">Completado con éxito</mat-option>
|
<mat-option [value]="'success'">Completado con éxito</mat-option>
|
||||||
|
<mat-option [value]="'cancelled'">Cancelado</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,7 +64,6 @@
|
||||||
<td mat-cell *matCellDef="let trace">
|
<td mat-cell *matCellDef="let trace">
|
||||||
|
|
||||||
<ng-container [ngSwitch]="column.columnDef">
|
<ng-container [ngSwitch]="column.columnDef">
|
||||||
<!-- Caso para "status" -->
|
|
||||||
<ng-container *ngSwitchCase="'status'">
|
<ng-container *ngSwitchCase="'status'">
|
||||||
<ng-container *ngIf="trace.status === 'in-progress' && trace.progress; else statusChip">
|
<ng-container *ngIf="trace.status === 'in-progress' && trace.progress; else statusChip">
|
||||||
<div class="progress-container">
|
<div class="progress-container">
|
||||||
|
@ -73,31 +73,40 @@
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-template #statusChip>
|
<ng-template #statusChip>
|
||||||
|
<div class="status-progress-flex">
|
||||||
<mat-chip [ngClass]="{
|
<mat-chip [ngClass]="{
|
||||||
'chip-failed': trace.status === 'failed',
|
'chip-failed': trace.status === 'failed',
|
||||||
'chip-success': trace.status === 'success',
|
'chip-success': trace.status === 'success',
|
||||||
'chip-pending': trace.status === 'pending',
|
'chip-pending': trace.status === 'pending',
|
||||||
'chip-in-progress': trace.status === 'in-progress'
|
'chip-in-progress': trace.status === 'in-progress',
|
||||||
|
'chip-cancelled': trace.status === 'cancelled'
|
||||||
}">
|
}">
|
||||||
{{
|
{{
|
||||||
trace.status === 'failed' ? 'Fallido' :
|
trace.status === 'failed' ? 'Fallido' :
|
||||||
trace.status === 'in-progress' ? 'En ejecución' :
|
trace.status === 'in-progress' ? 'En ejecución' :
|
||||||
trace.status === 'success' ? 'Finalizado con éxito' :
|
trace.status === 'success' ? 'Finalizado con éxito' :
|
||||||
trace.status === 'pending' ? 'Pendiente de ejecutar' :
|
trace.status === 'pending' ? 'Pendiente de ejecutar' :
|
||||||
|
trace.status === 'cancelled' ? 'Cancelado' :
|
||||||
trace.status
|
trace.status
|
||||||
}}
|
}}
|
||||||
</mat-chip>
|
</mat-chip>
|
||||||
|
<button *ngIf="trace.status === 'in-progress' && trace.command === 'deploy-image'"
|
||||||
|
mat-icon-button
|
||||||
|
(click)="cancelTrace(trace)"
|
||||||
|
class="cancel-button"
|
||||||
|
matTooltip="Cancelar transmisión de imagen">
|
||||||
|
<mat-icon>cancel</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Caso para "input" con modal -->
|
|
||||||
<ng-container *ngSwitchCase="'input'">
|
<ng-container *ngSwitchCase="'input'">
|
||||||
<button mat-icon-button (click)="openInputModal(trace.input)">
|
<button mat-icon-button (click)="openInputModal(trace.input)">
|
||||||
<mat-icon>info</mat-icon>
|
<mat-icon>info</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Para cualquier otro caso (default) -->
|
|
||||||
<ng-container *ngSwitchDefault>
|
<ng-container *ngSwitchDefault>
|
||||||
{{ column.cell(trace) }}
|
{{ column.cell(trace) }}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -8,6 +8,8 @@ import { JoyrideService } from 'ngx-joyride';
|
||||||
import { MatDialog } from "@angular/material/dialog";
|
import { MatDialog } from "@angular/material/dialog";
|
||||||
import { InputDialogComponent } from "./input-dialog/input-dialog.component";
|
import { InputDialogComponent } from "./input-dialog/input-dialog.component";
|
||||||
import { ProgressBarMode, MatProgressBarModule } from '@angular/material/progress-bar';
|
import { ProgressBarMode, MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
|
import {DeleteModalComponent} from "../../../../shared/delete_modal/delete-modal/delete-modal.component";
|
||||||
|
import {ToastrService} from "ngx-toastr";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-task-logs',
|
selector: 'app-task-logs',
|
||||||
|
@ -88,7 +90,8 @@ export class TaskLogsComponent implements OnInit {
|
||||||
constructor(private http: HttpClient,
|
constructor(private http: HttpClient,
|
||||||
private joyrideService: JoyrideService,
|
private joyrideService: JoyrideService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private cdr: ChangeDetectorRef
|
private cdr: ChangeDetectorRef,
|
||||||
|
private toastService: ToastrService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -173,6 +176,26 @@ export class TaskLogsComponent implements OnInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancelTrace(trace: any): void {
|
||||||
|
this.dialog.open(DeleteModalComponent, {
|
||||||
|
width: '300px',
|
||||||
|
data: { name: trace.jobId },
|
||||||
|
}).afterClosed().subscribe((result) => {
|
||||||
|
if (result) {
|
||||||
|
this.http.post(`${this.baseUrl}/traces/server/${trace.uuid}/cancel`, {}).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.toastService.success('Transmision de imagen cancelada');
|
||||||
|
this.loadTraces();
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
this.toastService.error(error.error['hydra:description']);
|
||||||
|
console.error(error.error['hydra:description']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loadTraces(): void {
|
loadTraces(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const url = `${this.baseUrl}/traces?page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`;
|
const url = `${this.baseUrl}/traces?page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`;
|
||||||
|
|
Loading…
Reference in New Issue