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 }} {{ 'remotePcLabel' | translate }}
</mat-checkbox> </mat-checkbox>
<mat-checkbox
formControlName="isGlobal"
class="example-margin"
>
{{ 'globalImageLabel' | translate }}
</mat-checkbox>
<mat-divider *ngIf="imageId && partitionInfo"></mat-divider> <mat-divider *ngIf="imageId && partitionInfo"></mat-divider>
<div *ngIf="imageId && partitionInfo" class="partition-info-container"> <div *ngIf="imageId && partitionInfo" class="partition-info-container">

View File

@ -30,6 +30,7 @@ export class CreateImageComponent implements OnInit {
description: [''], description: [''],
comments: [''], comments: [''],
remotePc: [false], remotePc: [false],
isGlobal: [false],
softwareProfile: [''], softwareProfile: [''],
imageRepository: ['', Validators.required], imageRepository: ['', Validators.required],
}); });
@ -51,6 +52,7 @@ export class CreateImageComponent implements OnInit {
description: [response.description], description: [response.description],
comments: [response.comments], comments: [response.comments],
remotePc: [response.remotePc], remotePc: [response.remotePc],
isGlobal: [response.isGlobal],
softwareProfile: [response.softwareProfile ? response.softwareProfile['@id'] : null, Validators.required], softwareProfile: [response.softwareProfile ? response.softwareProfile['@id'] : null, Validators.required],
imageRepository: [response.imageRepository ? response.imageRepository['@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, description: this.imageForm.value.description,
comments: this.imageForm.value.comments, comments: this.imageForm.value.comments,
remotePc: this.imageForm.value.remotePc, remotePc: this.imageForm.value.remotePc,
isGlobal: this.imageForm.value.isGlobal,
imageRepository: this.imageForm.value.imageRepository, imageRepository: this.imageForm.value.imageRepository,
...(this.imageForm.value.softwareProfile ? { softwareProfile: this.imageForm.value.softwareProfile } : {}), ...(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 {HttpClient} from "@angular/common/http";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {ToastrService} from "ngx-toastr"; import {ToastrService} from "ngx-toastr";
import {Router} from "@angular/router";
@Component({ @Component({
selector: 'app-export-image', selector: 'app-export-image',
@ -18,6 +19,7 @@ export class ExportImageComponent implements OnInit {
private http: HttpClient, private http: HttpClient,
public dialogRef: MatDialogRef<ExportImageComponent>, public dialogRef: MatDialogRef<ExportImageComponent>,
private toastService: ToastrService, private toastService: ToastrService,
private router: Router,
@Inject(MAT_DIALOG_DATA) public data: { image: any } @Inject(MAT_DIALOG_DATA) public data: { image: any }
) { ) {
@ -29,7 +31,7 @@ export class ExportImageComponent implements OnInit {
} }
loadRepositories() { 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 => { response => {
this.repositories = response['hydra:member']; this.repositories = response['hydra:member'];
this.loading = false; this.loading = false;
@ -45,6 +47,7 @@ export class ExportImageComponent implements OnInit {
next: (response) => { next: (response) => {
this.toastService.success('Imagen exportada correctamente'); this.toastService.success('Imagen exportada correctamente');
this.dialogRef.close(); this.dialogRef.close();
this.router.navigate(['/commands-logs']);
}, },
error: error => { error: error => {
console.error('Error al exportar imagen:', error); console.error('Error al exportar imagen:', error);

View File

@ -35,6 +35,11 @@
{{ image[column.columnDef] ? 'check_circle' : 'cancel' }} {{ image[column.columnDef] ? 'check_circle' : 'cancel' }}
</mat-icon> </mat-icon>
</ng-container> </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'"> <ng-container *ngIf="column.columnDef === 'status'">
<mat-chip [ngClass]="{ <mat-chip [ngClass]="{
'chip-failed': image.status === 'failed', 'chip-failed': image.status === 'failed',
@ -46,7 +51,7 @@
{{ getStatusLabel(image[column.columnDef]) }} {{ getStatusLabel(image[column.columnDef]) }}
</mat-chip> </mat-chip>
</ng-container> </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) }} {{ column.cell(image) }}
</ng-container> </ng-container>
</td> </td>

View File

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

View File

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

View File

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

View File

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