Added isGlobal property in Image
testing/ogGui-multibranch/pipeline/head This commit looks good Details

pull/12/head
Manuel Aranda Rosales 2025-02-03 13:10:39 +01:00
parent fe89e6dc37
commit fe72fcb5fb
8 changed files with 30 additions and 2 deletions

View File

@ -42,6 +42,13 @@
{{ 'remotePcLabel' | translate }}
</mat-checkbox>
<mat-checkbox
formControlName="isGlobal"
class="example-margin"
>
{{ 'globalImageLabel' | translate }}
</mat-checkbox>
<mat-divider *ngIf="imageId && partitionInfo"></mat-divider>
<div *ngIf="imageId && partitionInfo" class="partition-info-container">

View File

@ -30,6 +30,7 @@ export class CreateImageComponent implements OnInit {
description: [''],
comments: [''],
remotePc: [false],
isGlobal: [false],
softwareProfile: [''],
imageRepository: ['', Validators.required],
});
@ -51,6 +52,7 @@ export class CreateImageComponent implements OnInit {
description: [response.description],
comments: [response.comments],
remotePc: [response.remotePc],
isGlobal: [response.isGlobal],
softwareProfile: [response.softwareProfile ? response.softwareProfile['@id'] : null, Validators.required],
imageRepository: [response.imageRepository ? response.imageRepository['@id'] : null, Validators.required],
});
@ -95,6 +97,7 @@ export class CreateImageComponent implements OnInit {
description: this.imageForm.value.description,
comments: this.imageForm.value.comments,
remotePc: this.imageForm.value.remotePc,
isGlobal: this.imageForm.value.isGlobal,
imageRepository: this.imageForm.value.imageRepository,
...(this.imageForm.value.softwareProfile ? { softwareProfile: this.imageForm.value.softwareProfile } : {}),
};

View File

@ -2,6 +2,7 @@ import {Component, Inject, OnInit} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {ToastrService} from "ngx-toastr";
import {Router} from "@angular/router";
@Component({
selector: 'app-export-image',
@ -18,6 +19,7 @@ export class ExportImageComponent implements OnInit {
private http: HttpClient,
public dialogRef: MatDialogRef<ExportImageComponent>,
private toastService: ToastrService,
private router: Router,
@Inject(MAT_DIALOG_DATA) public data: { image: any }
) {
@ -29,7 +31,7 @@ export class ExportImageComponent implements OnInit {
}
loadRepositories() {
this.http.get<any>(`${this.baseUrl}/image-repositories?page=1&itemsPerPage=50`).subscribe(
this.http.get<any>(`${this.baseUrl}/image-repositories?id[ne]=1&page=1&itemsPerPage=50`).subscribe(
response => {
this.repositories = response['hydra:member'];
this.loading = false;
@ -45,6 +47,7 @@ export class ExportImageComponent implements OnInit {
next: (response) => {
this.toastService.success('Imagen exportada correctamente');
this.dialogRef.close();
this.router.navigate(['/commands-logs']);
},
error: error => {
console.error('Error al exportar imagen:', error);

View File

@ -35,6 +35,11 @@
{{ image[column.columnDef] ? 'check_circle' : 'cancel' }}
</mat-icon>
</ng-container>
<ng-container *ngIf="column.columnDef === 'isGlobal'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">
{{ image[column.columnDef] ? 'check_circle' : 'cancel' }}
</mat-icon>
</ng-container>
<ng-container *ngIf="column.columnDef === 'status'">
<mat-chip [ngClass]="{
'chip-failed': image.status === 'failed',
@ -46,7 +51,7 @@
{{ getStatusLabel(image[column.columnDef]) }}
</mat-chip>
</ng-container>
<ng-container *ngIf="column.columnDef !== 'remotePc' && column.columnDef !== 'status'">
<ng-container *ngIf="column.columnDef !== 'remotePc' && column.columnDef !== 'status' && column.columnDef !== 'isGlobal'">
{{ column.cell(image) }}
</ng-container>
</td>

View File

@ -47,6 +47,11 @@ export class ImagesComponent implements OnInit {
header: 'Remote Pc',
cell: (image: any) => `${image.remotePc}`
},
{
columnDef: 'isGlobal',
header: 'Imagen Global',
cell: (image: any) => `${image.isGlobal}`
},
{
columnDef: 'status',
header: 'Estado',

View File

@ -2,6 +2,7 @@ import {Component, Inject, OnInit} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {ToastrService} from "ngx-toastr";
import {Router} from "@angular/router";
@Component({
selector: 'app-import-image',
@ -18,6 +19,7 @@ export class ImportImageComponent implements OnInit{
private http: HttpClient,
public dialogRef: MatDialogRef<ImportImageComponent>,
private toastService: ToastrService,
private router: Router,
@Inject(MAT_DIALOG_DATA) public data: { repository: any }
) {
@ -54,6 +56,7 @@ export class ImportImageComponent implements OnInit{
next: (response) => {
this.toastService.success('Peticion de importacion de imagen enviada correctamente');
this.dialogRef.close();
this.router.navigate(['/commands-logs']);
},
error: error => {
this.toastService.error('Error al importar imagenes');

View File

@ -284,6 +284,7 @@
"usageColumn": "Usage (%)",
"formatColumn": "Format",
"remotePcLabel": "Remote PC",
"globalImageLabel": "Global image",
"ntfsOption": "NTFS",
"linuxOption": "LINUX",
"cacheOption": "CACHE",

View File

@ -302,6 +302,7 @@
"imagesTitle": "Administrar imágenes",
"repositoryTitle": "Administrar repositorios",
"remotePcLabel": "Remote PC",
"globalImageLabel": "Imagen Global",
"addImageButton": "Añadir imagen",
"searchNameDescription": "Busca imágenes por nombre para encontrar rápidamente una imagen específica.",
"searchDefaultDescription": "Filtra las imágenes para mostrar solo las imágenes por defecto o no por defecto.",