diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts index 4e685f7..9f6bdc9 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts @@ -50,7 +50,6 @@ export class ExecuteCommandComponent implements OnInit { ngOnChanges(changes: SimpleChanges): void { if (changes['clientData']) { console.log(this.clientData.length) - console.log('clientData ha cambiado:', changes['clientData'].currentValue); } } @@ -94,13 +93,11 @@ export class ExecuteCommandComponent implements OnInit { } powerOnClient(): void { - const payload = { - client: '' - } - - this.http.post('', payload).subscribe( + this.http.post(`${this.baseUrl}/image-repositories/wol`, { + clients: this.clientData.map((client: any) => client['@id']) + }).subscribe( response => { - this.toastService.success('Cliente actualizado correctamente'); + this.toastService.success('Petición de encendido enviada correctamente'); }, error => { this.toastService.error('Error de conexión con el cliente'); @@ -113,7 +110,7 @@ export class ExecuteCommandComponent implements OnInit { clients: this.clientData.map((client: any) => client['@id']) }).subscribe( response => { - this.toastService.success('Cliente actualizado correctamente'); + this.toastService.success('Petición de apagado enviada correctamente'); }, error => { this.toastService.error('Error de conexión con el cliente'); diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.css b/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.css index f8e9c6c..ffd86db 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.css +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.css @@ -39,4 +39,4 @@ button { mat-slide-toggle{ margin-left: 10px; -} \ No newline at end of file +} diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts index ec2a96f..f3aae66 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/create-organizational-unit/create-organizational-unit.component.ts @@ -130,7 +130,9 @@ export class CreateOrganizationalUnitComponent implements OnInit { loadOgLives() { this.dataService.getOgLives().subscribe( - (data: any[]) => this.ogLives = data, + (data: any[]) => { + this.ogLives = data + }, error => console.error('Error fetching ogLives', error) ); } diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.css b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.css index 40124bd..76f9983 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.css +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.css @@ -5,35 +5,34 @@ h1 { color: #3f51b5; margin-bottom: 20px; } - + .network-form { display: flex; flex-direction: column; gap: 15px; } - + .form-field { width: 100%; margin-top: 10px; } - + .mat-dialog-content { padding: 20px; } - + .mat-dialog-actions { display: flex; justify-content: flex-end; padding: 10px 20px; } - + button { text-transform: none; font-size: 16px; font-weight: 500; } - + .mat-slide-toggle { margin-top: 20px; } - \ No newline at end of file diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html index 4e7c86c..c4bdb8a 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/edit-organizational-unit/edit-organizational-unit.component.html @@ -33,7 +33,7 @@ -
+ {{ 'locationLabel' | translate }} diff --git a/ogWebconsole/src/app/components/images/create-image/create-image.component.ts b/ogWebconsole/src/app/components/images/create-image/create-image.component.ts index ae6b57c..52fd24b 100644 --- a/ogWebconsole/src/app/components/images/create-image/create-image.component.ts +++ b/ogWebconsole/src/app/components/images/create-image/create-image.component.ts @@ -90,11 +90,6 @@ export class CreateImageComponent implements OnInit { } saveImage(): void { - if (this.imageForm.invalid) { - this.toastService.error('Por favor, rellena los campos obligatorios'); - return; - } - const payload: any = { name: this.imageForm.value.name, description: this.imageForm.value.description, diff --git a/ogWebconsole/src/app/components/images/images.component.css b/ogWebconsole/src/app/components/images/images.component.css index f1a253c..af5ea91 100644 --- a/ogWebconsole/src/app/components/images/images.component.css +++ b/ogWebconsole/src/app/components/images/images.component.css @@ -91,6 +91,11 @@ table { color: white; } +.chip-transferring { + background-color: #f5a623 !important; + color: white; +} + .header-container-title { flex-grow: 1; text-align: left; diff --git a/ogWebconsole/src/app/components/images/images.component.html b/ogWebconsole/src/app/components/images/images.component.html index 836f976..9a4aa01 100644 --- a/ogWebconsole/src/app/components/images/images.component.html +++ b/ogWebconsole/src/app/components/images/images.component.html @@ -40,7 +40,8 @@ 'chip-failed': image.status === 'failed', 'chip-success': image.status === 'success', 'chip-pending': image.status === 'pending', - 'chip-in-progress': image.status === 'in-progress' + 'chip-in-progress': image.status === 'in-progress', + 'chip-transferring': image.status === 'transferring', }"> {{ getStatusLabel(image[column.columnDef]) }} @@ -65,8 +66,9 @@ + - + diff --git a/ogWebconsole/src/app/components/images/images.component.ts b/ogWebconsole/src/app/components/images/images.component.ts index 4d9e6c7..f74d530 100644 --- a/ogWebconsole/src/app/components/images/images.component.ts +++ b/ogWebconsole/src/app/components/images/images.component.ts @@ -1,15 +1,13 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { HttpClient } from '@angular/common/http'; import { MatTableDataSource } from '@angular/material/table'; import { ToastrService } from 'ngx-toastr'; import { DatePipe } from '@angular/common'; import { CreateImageComponent } from './create-image/create-image.component'; -import {CreateCommandComponent} from "../commands/main-commands/create-command/create-command.component"; import {DeleteModalComponent} from "../../shared/delete_modal/delete-modal/delete-modal.component"; import {ServerInfoDialogComponent} from "../ogdhcp/og-dhcp-subnets/server-info-dialog/server-info-dialog.component"; import {Observable} from "rxjs"; -import {InfoImageComponent} from "../ogboot/pxe-images/info-image/info-image/info-image.component"; import { JoyrideService } from 'ngx-joyride'; import {ExportImageComponent} from "./export-image/export-image.component"; @@ -68,16 +66,34 @@ export class ImagesComponent implements OnInit { displayedColumns = [...this.columns.map(column => column.columnDef), 'actions']; private apiUrl = `${this.baseUrl}/images`; + @Input() repositoryUuid: any + private repositoryId: any; constructor( public dialog: MatDialog, private http: HttpClient, private toastService: ToastrService, - private joyrideService: JoyrideService + private joyrideService: JoyrideService, ) {} ngOnInit(): void { - this.search(); + if (this.repositoryUuid) { + this.loadRepository() + } else { + this.search(); + } + } + + loadRepository(): void { + this.http.get(`${this.baseUrl}/image-repositories/${this.repositoryUuid}`, {}).subscribe( + data => { + this.repositoryId = data.id; + this.search(); + }, + error => { + console.error('Error fetching image repositories', error); + } + ) } getStatusLabel(status: string): string { @@ -111,7 +127,7 @@ export class ImagesComponent implements OnInit { search(): void { this.loading = true; - this.http.get(`${this.apiUrl}?page=${this.page +1 }&itemsPerPage=${this.itemsPerPage}`, { params: this.filters }).subscribe( + this.http.get(`${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']; @@ -206,6 +222,17 @@ export class ImagesComponent implements OnInit { } }); break; + case 'delete-permanent': + this.http.post(`${this.baseUrl}/images/server/${image.uuid}/delete-permanent`, {}).subscribe({ + next: () => { + this.toastService.success('Petición de eliminación de la papelera temporal enviada'); + this.search() + }, + error: (error) => { + this.toastService.error(error.error['hydra:description']); + } + }); + break; case 'recover': this.http.post(`${this.baseUrl}/images/server/${image.uuid}/recover`, {}).subscribe({ next: () => { diff --git a/ogWebconsole/src/app/components/repositories/import-image/import-image.component.css b/ogWebconsole/src/app/components/repositories/import-image/import-image.component.css index 2239479..6e0686f 100644 --- a/ogWebconsole/src/app/components/repositories/import-image/import-image.component.css +++ b/ogWebconsole/src/app/components/repositories/import-image/import-image.component.css @@ -20,3 +20,20 @@ mat-dialog-actions { flex-direction: column; gap: 10px; } + +.selected-list ul { + list-style: none; + padding: 0; +} + +.selected-item { + display: flex; + justify-content: space-between; /* Alinea texto a la izquierda y botón a la derecha */ + align-items: center; /* Centra verticalmente */ + padding: 8px; + border-bottom: 1px solid #ccc; +} + +.selected-item button { + margin-left: 10px; +} diff --git a/ogWebconsole/src/app/components/repositories/import-image/import-image.component.html b/ogWebconsole/src/app/components/repositories/import-image/import-image.component.html index 4d834d0..943cc38 100644 --- a/ogWebconsole/src/app/components/repositories/import-image/import-image.component.html +++ b/ogWebconsole/src/app/components/repositories/import-image/import-image.component.html @@ -7,6 +7,19 @@ {{ image.name }} + +
+

Imágenes seleccionadas:

+ +
+ diff --git a/ogWebconsole/src/app/components/repositories/import-image/import-image.component.ts b/ogWebconsole/src/app/components/repositories/import-image/import-image.component.ts index 3ffd0df..1faa242 100644 --- a/ogWebconsole/src/app/components/repositories/import-image/import-image.component.ts +++ b/ogWebconsole/src/app/components/repositories/import-image/import-image.component.ts @@ -38,6 +38,15 @@ export class ImportImageComponent implements OnInit{ ); } + getImageName(imageId: string): string { + const image = this.images.find(img => img['@id'] === imageId); + return image ? image.name : 'Desconocido'; + } + + removeImage(imageId: string) { + this.selectedClients = this.selectedClients.filter(id => id !== imageId); + } + save() { this.http.post(`${this.baseUrl}${this.data.repository['@id']}/import-image`, { images: this.selectedClients diff --git a/ogWebconsole/src/app/components/repositories/main-repository-view/main-repository-view.component.html b/ogWebconsole/src/app/components/repositories/main-repository-view/main-repository-view.component.html index d6baad7..ae23d9d 100644 --- a/ogWebconsole/src/app/components/repositories/main-repository-view/main-repository-view.component.html +++ b/ogWebconsole/src/app/components/repositories/main-repository-view/main-repository-view.component.html @@ -123,6 +123,6 @@ - + diff --git a/ogWebconsole/src/app/components/repositories/repositories.component.html b/ogWebconsole/src/app/components/repositories/repositories.component.html index a8dbde6..204a119 100644 --- a/ogWebconsole/src/app/components/repositories/repositories.component.html +++ b/ogWebconsole/src/app/components/repositories/repositories.component.html @@ -41,7 +41,7 @@ Acciones - +