refs #1473. Changes in ogRepo. Import

pull/16/head
Manuel Aranda Rosales 2025-02-07 12:02:40 +01:00
parent 7e174c9617
commit c7d33ff502
8 changed files with 43 additions and 22 deletions

View File

@ -9,7 +9,7 @@
<mat-form-field appearance="fill" class="form-field"> <mat-form-field appearance="fill" class="form-field">
<mat-label>{{ 'repositoryLabel' | translate }}</mat-label> <mat-label>{{ 'repositoryLabel' | translate }}</mat-label>
<mat-select formControlName="imageRepository" required> <mat-select formControlName="imageRepositories" required multiple>
<mat-option *ngFor="let imageRepository of repositories" [value]="imageRepository['@id']"> <mat-option *ngFor="let imageRepository of repositories" [value]="imageRepository['@id']">
{{ imageRepository.name }} {{ imageRepository.name }}
</mat-option> </mat-option>

View File

@ -32,7 +32,7 @@ export class CreateImageComponent implements OnInit {
remotePc: [false], remotePc: [false],
isGlobal: [false], isGlobal: [false],
softwareProfile: [''], softwareProfile: [''],
imageRepository: ['', Validators.required], imageRepositories: [[], Validators.required],
}); });
} }
@ -54,7 +54,7 @@ export class CreateImageComponent implements OnInit {
remotePc: [response.remotePc], remotePc: [response.remotePc],
isGlobal: [response.isGlobal], 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], imageRepositories: [response.imageRepositories ? response.imageRepositories.map((r: any) => r['@id']) : [], Validators.required],
}); });
this.imageId = response['@id']; this.imageId = response['@id'];
this.partitionInfo = response.partitionInfo; this.partitionInfo = response.partitionInfo;
@ -98,7 +98,7 @@ export class CreateImageComponent implements OnInit {
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, isGlobal: this.imageForm.value.isGlobal,
imageRepository: this.imageForm.value.imageRepository, imageRepositories: this.imageForm.value.imageRepositories,
...(this.imageForm.value.softwareProfile ? { softwareProfile: this.imageForm.value.softwareProfile } : {}), ...(this.imageForm.value.softwareProfile ? { softwareProfile: this.imageForm.value.softwareProfile } : {}),
}; };

View File

@ -1,8 +1,8 @@
<h2 mat-dialog-title>Exportar imagen {{data.image?.name}}</h2> <h2 mat-dialog-title>Transferir imagen {{data.image?.name}}</h2>
<mat-dialog-content> <mat-dialog-content>
<mat-form-field appearance="fill" class="full-width"> <mat-form-field appearance="fill" class="full-width">
<mat-label>Seleccione repositorio destino</mat-label> <mat-label>Seleccione nuevo repositorio destino</mat-label>
<mat-select [(value)]="selectedRepository"> <mat-select [(value)]="selectedRepository">
<mat-option *ngFor="let repository of repositories" [value]="repository['@id']">{{ repository.name }}</mat-option> <mat-option *ngFor="let repository of repositories" [value]="repository['@id']">{{ repository.name }}</mat-option>
</mat-select> </mat-select>

View File

@ -31,7 +31,7 @@ export class ExportImageComponent implements OnInit {
} }
loadRepositories() { loadRepositories() {
this.http.get<any>(`${this.baseUrl}/image-repositories?id[ne]=1&page=1&itemsPerPage=50`).subscribe( this.http.get<any>(`${this.baseUrl}/image-repositories?id[neq]=1&page=1&itemsPerPage=50`).subscribe(
response => { response => {
this.repositories = response['hydra:member']; this.repositories = response['hydra:member'];
this.loading = false; this.loading = false;
@ -41,7 +41,7 @@ export class ExportImageComponent implements OnInit {
} }
save() { save() {
this.http.post<any>(`${this.baseUrl}${this.selectedRepository}/export-image`, { this.http.post<any>(`${this.baseUrl}${this.selectedRepository}/transfer-image`, {
images: [this.data.image['@id']] images: [this.data.image['@id']]
}).subscribe({ }).subscribe({
next: (response) => { next: (response) => {

View File

@ -1,3 +1,4 @@
<app-loading [isLoading]="loading"></app-loading>
<div class="header-container"> <div class="header-container">
<button mat-icon-button color="primary" (click)="iniciarTour()"> <button mat-icon-button color="primary" (click)="iniciarTour()">
@ -24,6 +25,15 @@
<mat-icon matSuffix>search</mat-icon> <mat-icon matSuffix>search</mat-icon>
<mat-hint>{{ 'searchHint' | translate }}</mat-hint> <mat-hint>{{ 'searchHint' | translate }}</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field appearance="fill" class="search-boolean">
<mat-label i18n="@@searchLabel">Estado</mat-label>
<mat-select [(ngModel)]="filters['status']" (selectionChange)="search()" placeholder="Seleccionar opción" >
<mat-option [value]="'failed'">Fallido</mat-option>
<mat-option [value]="'pending'">Pendiente de ejecutar</mat-option>
<mat-option [value]="'in-progress'">Ejecutando</mat-option>
<mat-option [value]="'success'">Completado con éxito</mat-option>
</mat-select>
</mat-form-field>
</div> </div>
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="imagesTable" text="Esta tabla muestra las imágenes disponibles."> <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="imagesTable" text="Esta tabla muestra las imágenes disponibles.">
@ -35,6 +45,14 @@
{{ 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 === 'imageRepositories'">
<button mat-button [matMenuTriggerFor]="menu">Ver repositorios</button>
<mat-menu #menu="matMenu">
<button mat-menu-item *ngFor="let repository of image.imageRepositories">
{{ repository.name }}
</button>
</mat-menu>
</ng-container>
<ng-container *ngIf="column.columnDef === 'isGlobal'"> <ng-container *ngIf="column.columnDef === 'isGlobal'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'"> <mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">
{{ image[column.columnDef] ? 'check_circle' : 'cancel' }} {{ image[column.columnDef] ? 'check_circle' : 'cancel' }}
@ -51,7 +69,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' && column.columnDef !== 'isGlobal'"> <ng-container *ngIf="column.columnDef !== 'remotePc' && column.columnDef !== 'status' && column.columnDef !== 'isGlobal' && column.columnDef !== 'imageRepositories'">
{{ column.cell(image) }} {{ column.cell(image) }}
</ng-container> </ng-container>
</td> </td>
@ -73,7 +91,7 @@
<button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'delete-trash')">Eliminar imagen temporalmente</button> <button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'delete-trash')">Eliminar imagen temporalmente</button>
<button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'delete-permanent')">Eliminar imagen</button> <button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'delete-permanent')">Eliminar imagen</button>
<button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'trash'" (click)="toggleAction(image, 'recover')">Recuperar imagen de la papelera</button> <button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'trash'" (click)="toggleAction(image, 'recover')">Recuperar imagen de la papelera</button>
<button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'export')">Exportar imagen</button> <button mat-menu-item [disabled]="!image.imageFullsum || image.status !== 'success'" (click)="toggleAction(image, 'transfer')">Transferir imagen</button>
</mat-menu> </mat-menu>
</td> </td>
</ng-container> </ng-container>

View File

@ -38,9 +38,9 @@ export class ImagesComponent implements OnInit {
cell: (image: any) => `${image.name}` cell: (image: any) => `${image.name}`
}, },
{ {
columnDef: 'imageRepository', columnDef: 'imageRepositories',
header: 'Repositorio', header: 'Repositorios',
cell: (image: any) => `${image.imageRepository?.name}` cell: (image: any) => `${image.imageRepositories}`
}, },
{ {
columnDef: 'remotePc', columnDef: 'remotePc',
@ -57,11 +57,6 @@ export class ImagesComponent implements OnInit {
header: 'Estado', header: 'Estado',
cell: (image: any) => `${image.status}` cell: (image: any) => `${image.status}`
}, },
{
columnDef: 'imageFullsum',
header: 'Fullsum',
cell: (image: any) => `${image.imageFullsum}`
},
{ {
columnDef: 'createdAt', columnDef: 'createdAt',
header: 'Fecha de creación', header: 'Fecha de creación',
@ -115,6 +110,8 @@ export class ImagesComponent implements OnInit {
return 'Papelera temporal'; return 'Papelera temporal';
case 'failed': case 'failed':
return 'Fallido'; return 'Fallido';
case 'trasnferring':
return 'Transfiriendo';
default: default:
return 'Estado desconocido'; return 'Estado desconocido';
} }
@ -186,19 +183,22 @@ export class ImagesComponent implements OnInit {
showImageInfo(event: MouseEvent, image:any) { showImageInfo(event: MouseEvent, image:any) {
event.stopPropagation(); event.stopPropagation();
this.loading = true;
this.loadImageAlert(image).subscribe( this.loadImageAlert(image).subscribe(
response => { response => {
this.alertMessage = response.output; this.alertMessage = response;
this.dialog.open(ServerInfoDialogComponent, { this.dialog.open(ServerInfoDialogComponent, {
width: '600px', width: '800px',
data: { data: {
message: this.alertMessage message: this.alertMessage
} }
}); });
this.loading = false;
}, },
error => { error => {
this.toastService.error(error.error['hydra:description']); this.toastService.error(error.error['hydra:description']);
this.loading = false;
} }
); );
} }
@ -249,7 +249,7 @@ export class ImagesComponent implements OnInit {
} }
}); });
break; break;
case 'export': case 'transfer':
this.dialog.open(ExportImageComponent, { this.dialog.open(ExportImageComponent, {
width: '600px', width: '600px',
data: { data: {

View File

@ -299,7 +299,9 @@
"saveFiltersButton": "Save Filters", "saveFiltersButton": "Save Filters",
"sendFiltersButton": "Send Action", "sendFiltersButton": "Send Action",
"addPxeButton": "Add PXE file", "addPxeButton": "Add PXE file",
"repositoryLabel": "Repositories",
"internalUnits": "Internal units", "internalUnits": "Internal units",
"imageNameLabel": "Image name",
"noResultsMessage": "No results to display.", "noResultsMessage": "No results to display.",
"imagesTitle": "Manage images", "imagesTitle": "Manage images",
"addImageButton": "Add image", "addImageButton": "Add image",

View File

@ -236,7 +236,8 @@
"editClientDialogTitle": "Editar Cliente", "editClientDialogTitle": "Editar Cliente",
"organizationalUnitLabel": "Padre", "organizationalUnitLabel": "Padre",
"ogLiveLabel": "OgLive", "ogLiveLabel": "OgLive",
"repositoryLabel": "Repositorio", "imageNameLabel": "Nombre de la imagen",
"repositoryLabel": "Repositorios",
"serialNumberLabel": "Número de Serie", "serialNumberLabel": "Número de Serie",
"netifaceLabel": "Interfaz de red", "netifaceLabel": "Interfaz de red",
"netDriverLabel": "Controlador de red", "netDriverLabel": "Controlador de red",