refs #1702. Updated ogLive sync. Deleted wrong or uninstalled oglives

pull/18/head
Manuel Aranda Rosales 2025-03-13 14:44:11 +01:00
parent e230b3b41d
commit 083b46a94d
7 changed files with 62 additions and 27 deletions

View File

@ -48,4 +48,24 @@ table {
display: flex;
justify-content: end;
margin-bottom: 30px;
}
}
.status-active {
background-color: #46c446 !important;
color: white !important;
}
.status-inactive {
background-color: #e87979 !important;
color: white !important;
}
.status-installing {
background-color: #f5a623 !important;
color: white !important;
}
.status-failed {
background-color: #9e9e9e !important;
color: white !important;
}

View File

@ -1,3 +1,5 @@
<app-loading [isLoading]="loading"></app-loading>
<div class="header-container">
<button mat-icon-button color="primary" (click)="iniciarTour()">
<mat-icon>help</mat-icon>
@ -10,8 +12,8 @@
<div class="images-button-row">
<button class="action-button" (click)="openSubnetInfoDialog()">{{ 'viewInfoButton' | translate }}</button>
<button class="action-button" (click)="addImage()" joyrideStep="addImageStep"
[text]="'addImageButtonDescription' | translate">
{{ 'addImageButton' | translate }}
[text]="'addOgLiveButtonDescription' | translate">
{{ 'addOgLiveButton' | translate }}
</button>
</div>
</div>
@ -39,12 +41,13 @@
<mat-form-field appearance="fill" class="search-boolean" joyrideStep="searchInstalledStep"
[text]="'searchInstalledDescription' | translate">
<mat-label>{{ 'searchInstalledLabel' | translate }}</mat-label>
<mat-select [(ngModel)]="filters['installed']" (selectionChange)="search()"
<mat-label>{{ 'status' | translate }}</mat-label>
<mat-select [(ngModel)]="filters['status']" (selectionChange)="search()"
[placeholder]="'selectOptionPlaceholder' | translate">
<mat-option [value]="''">{{ 'allOption' | translate }}</mat-option>
<mat-option [value]="true">{{ 'yesOption' | translate }}</mat-option>
<mat-option [value]="false">{{ 'noOption' | translate }}</mat-option>
<mat-option [value]="'inactive'">{{ 'inactiveOption' | translate }}</mat-option>
<mat-option [value]="'active'">{{ 'activeOption' | translate }}</mat-option>
<mat-option [value]="'failed'">{{ 'failedOption' | translate }}</mat-option>
<mat-option [value]="'pending'">{{ 'pendingOption' | translate }}</mat-option>
</mat-select>
</mat-form-field>
</div>
@ -55,7 +58,7 @@
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
<th mat-header-cell *matHeaderCellDef>{{ column.header }}</th>
<td mat-cell *matCellDef="let image">
<ng-container *ngIf="column.columnDef === 'isDefault' || column.columnDef === 'installed'">
<ng-container *ngIf="column.columnDef === 'isDefault'">
<mat-icon [color]="image[column.columnDef] ? 'primary' : 'warn'">
<ng-container *ngIf="image[column.columnDef]; else cancelIcon">
{{ 'checkCircle' | translate }}
@ -79,13 +82,13 @@
</ng-container>
<ng-container *ngIf="column.columnDef === 'status'">
<mat-chip>
{{ column.cell(image) }}
<mat-chip [ngClass]="getStatusLabel(image.status).class">
{{ getStatusLabel(image.status).label }}
</mat-chip>
</ng-container>
<ng-container
*ngIf="column.columnDef !== 'isDefault' && column.columnDef !== 'installed' && column.columnDef !== 'downloadUrl' && column.columnDef !== 'status' && column.columnDef !== 'name'">
*ngIf="column.columnDef !== 'isDefault' && column.columnDef !== 'downloadUrl' && column.columnDef !== 'status' && column.columnDef !== 'name'">
{{ column.cell(image) }}
</ng-container>
</td>
@ -108,12 +111,12 @@
<mat-icon>menu</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item [disabled]="image.installed" (click)="toggleAction(image, 'install')">{{ 'installOption' |
<button mat-menu-item [disabled]="image.status !== 'inactive'" (click)="toggleAction(image, 'install')">{{ 'installOption' |
translate }}</button>
<button mat-menu-item [disabled]="!image.installed" (click)="toggleAction(image, 'uninstall')">
<button mat-menu-item [disabled]="image.status !== 'active'" (click)="toggleAction(image, 'uninstall')">
{{ 'uninstallOption' | translate }}
</button>
<button mat-menu-item [disabled]="!image.installed" (click)="toggleAction(image, 'set-default')">
<button mat-menu-item [disabled]="image.status !== 'active'" (click)="toggleAction(image, 'set-default')">
{{ 'setDefaultOption' | translate }}
</button>
</mat-menu>
@ -128,4 +131,4 @@
<mat-paginator [length]="length" [pageSize]="itemsPerPage" [pageIndex]="page" [pageSizeOptions]="pageSizeOptions"
(page)="onPageChange($event)">
</mat-paginator>
</div>
</div>

View File

@ -50,11 +50,6 @@ export class PXEimagesComponent implements OnInit {
header: 'Imagen por defecto',
cell: (user: any) => `${user.isDefault}`
},
{
columnDef: 'installed',
header: 'Imagen instalada',
cell: (user: any) => `${user.installed}`
},
{
columnDef: 'status',
header: 'Estado',
@ -110,13 +105,18 @@ export class PXEimagesComponent implements OnInit {
);
}
showInfo(image: any): void {
const dialogRef = this.dialog.open(InfoImageComponent, {
width: '700px',
data: image
});
getStatusLabel(status: string): { label: string; class: string } {
const statusMap: { [key: string]: { label: string; class: string } } = {
active: { label: 'Instalada', class: 'status-active' },
inactive: { label: 'Sin instalar', class: 'status-inactive' },
installing: { label: 'Instalando...', class: 'status-installing' },
failed: { label: 'Fallido', class: 'status-failed' }
};
return statusMap[status] || { label: 'Desconocido', class: 'status-default' };
}
toggleAction(image: any, action: string): void {
switch (action) {
case 'set-default':

View File

@ -74,4 +74,4 @@
<mat-paginator [length]="length" [pageSize]="itemsPerPage" [pageIndex]="page" [pageSizeOptions]="pageSizeOptions"
(page)="onPageChange($event)">
</mat-paginator>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -374,6 +374,10 @@
"selectOptionPlaceholder": "Select an option",
"yesOption": "Yes",
"noOption": "No",
"inactiveOption": "Uninstalled",
"activeOption": "Installed",
"pendingOption": "Pending",
"failedOption": "Failed",
"actionsColumn": "Actions",
"createServerButton": "Create Server",
"labelName": "Name",
@ -381,6 +385,8 @@
"servicesStatusDescription": "Here is the status of the server services.",
"oglivesDescription": "Here are the OgLives installed on the server.",
"addImageButtonDescription": "Click to add a new image.",
"addOgLiveButtonDescription": "Click to add a new OgLive.",
"addOgLiveButton": "Add OgLive",
"adminPxeDescription": "From here you can manage the PXE templates of the server.",
"addTemplateButtonDescription": "Add PXE Template",
"addTemplateButton": "Add Template",

View File

@ -374,6 +374,12 @@
"selectOptionPlaceholder": "Selecciona una opción",
"yesOption": "Sí",
"noOption": "No",
"inactiveOption": "No instalada",
"activeOption": "Instalada",
"pendingOption": "Instalando",
"failedOption": "Fallida",
"addOgLiveButtonDescription": "Haz clic para añadir un nuevo OgLive.",
"addOgLiveButton": "Añadir OgLive",
"menuLabel": "Menu",
"actionsColumn": "Acciones",
"createServerButton": "Crear servidor",