refs #1516. Changed form and global import

pull/16/head
Manuel Aranda Rosales 2025-02-13 15:43:47 +01:00
parent 12f7bad764
commit 8d6e4615c7
5 changed files with 34 additions and 6 deletions

View File

@ -115,7 +115,7 @@ export class CreateClientImageComponent {
next: (response) => {
this.toastService.success('Petición de creación de imagen enviada');
this.loading = false;
this.router.navigate(['/images']);
this.router.navigate(['/commands-logs']);
},
error: (error) => {
this.toastService.error(error.error['hydra:description']);

View File

@ -34,6 +34,22 @@ button {
margin-left: 8px; /* Espacio entre los botones */
}
.warning-card {
background-color: #ffebee; /* Rojo claro */
color: #d32f2f; /* Rojo oscuro */
padding: 16px;
border-left: 5px solid #d32f2f;
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 15px;
}
.warning-card mat-icon {
font-size: 24px;
}
/* Responsividad para pantallas pequeñas */
@media (max-width: 600px) {
.form-field {

View File

@ -2,6 +2,12 @@
<mat-dialog-content class="dialog-content">
<form [formGroup]="imageForm" (ngSubmit)="saveImage()" class="image-form">
<mat-card *ngIf="showWarning" class="warning-card">
<mat-card-content>
<mat-icon color="warn">warning</mat-icon>
Ha marcado la casilla <strong>"Imagen Global"</strong>. Se transferirá la imagen al resto de repositorios en el caso de que no exista previamente.
</mat-card-content>
</mat-card>
<mat-form-field appearance="fill" class="form-field">
<mat-label>{{ 'imageNameLabel' | translate }}</mat-label>
<input matInput formControlName="name" required>
@ -37,14 +43,13 @@
<mat-checkbox
formControlName="remotePc"
class="example-margin"
>
{{ 'remotePcLabel' | translate }}
</mat-checkbox>
<mat-checkbox
formControlName="isGlobal"
class="example-margin"
(click)="changeIsGlobal()"
>
{{ 'globalImageLabel' | translate }}
</mat-checkbox>

View File

@ -1,9 +1,10 @@
import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http';
import { ToastrService } from 'ngx-toastr';
import {HttpClient} from '@angular/common/http';
import {ToastrService} from 'ngx-toastr';
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {DataService} from "../data.service";
@Component({
selector: 'app-create-image',
templateUrl: './create-image.component.html',
@ -16,6 +17,7 @@ export class CreateImageComponent implements OnInit {
softwareProfiles: any[] = [];
repositories: any[] = [];
partitionInfo: { [key: string]: string } = {};
showWarning: boolean = false; // Nueva variable para mostrar la advertencia
constructor(
private fb: FormBuilder,
@ -42,6 +44,7 @@ export class CreateImageComponent implements OnInit {
}
this.fetchSoftwareProfiles();
this.fetchRepositories();
}
load(): void {
@ -65,6 +68,10 @@ export class CreateImageComponent implements OnInit {
});
}
changeIsGlobal() {
this.showWarning = this.imageForm.get('isGlobal')?.value;
}
fetchSoftwareProfiles() {
const url = `${this.baseUrl}/software-profiles`;
this.http.get(url).subscribe({

View File

@ -116,7 +116,7 @@ export class RepositoryImagesComponent implements OnInit {
search(): void {
this.loading = true;
this.http.get<any>(`${this.apiUrl}?page=${this.page +1 }&itemsPerPage=${this.itemsPerPage}&repositoryId=${this.repositoryId}`, { params: this.filters }).subscribe(
this.http.get<any>(`${this.apiUrl}?page=${this.page +1 }&itemsPerPage=${this.itemsPerPage}&repository.id=${this.repositoryId}`, { params: this.filters }).subscribe(
data => {
this.dataSource.data = data['hydra:member'];
this.length = data['hydra:totalItems'];