diff --git a/ogWebconsole/src/app/components/images/create-image/create-image.component.html b/ogWebconsole/src/app/components/images/create-image/create-image.component.html
index 243b9b9..e72c39f 100644
--- a/ogWebconsole/src/app/components/images/create-image/create-image.component.html
+++ b/ogWebconsole/src/app/components/images/create-image/create-image.component.html
@@ -7,6 +7,15 @@
+
+ Repositorio
+
+
+ {{ imageRepository.name }}
+
+
+
+
Descripción
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 8610c67..d3b5d6a 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
@@ -14,6 +14,7 @@ export class CreateImageComponent implements OnInit {
imageForm: FormGroup;
imageId: string | null = null;
softwareProfiles: any[] = [];
+ repositories: any[] = [];
constructor(
private fb: FormBuilder,
@@ -29,6 +30,7 @@ export class CreateImageComponent implements OnInit {
comments: [''],
remotePc: [false],
softwareProfile: ['', Validators.required],
+ imageRepository: ['', Validators.required],
});
}
@@ -37,6 +39,7 @@ export class CreateImageComponent implements OnInit {
this.load()
}
this.fetchSoftwareProfiles();
+ this.fetchRepositories();
}
load(): void {
@@ -47,7 +50,8 @@ export class CreateImageComponent implements OnInit {
description: [response.description],
comments: [response.comments],
remotePc: [response.remotePc],
- softwareProfile: [response.softwareProfile, Validators.required],
+ softwareProfile: [response.softwareProfile['@id'], Validators.required],
+ imageRepository: [response.repository['@id'], Validators.required],
});
this.imageId = response['@id'];
},
@@ -70,13 +74,32 @@ export class CreateImageComponent implements OnInit {
});
}
+ fetchRepositories() {
+ const url = `${this.baseUrl}/image-repositories`;
+ this.http.get(url).subscribe({
+ next: (response: any) => {
+ this.repositories = response['hydra:member'];
+ },
+ error: (error) => {
+ console.error('Error al obtener los repositorios de imágenes:', error);
+ this.toastService.error('Error al obtener los repositorios de imágenes');
+ }
+ });
+ }
+
saveImage(): void {
+ if (this.imageForm.invalid) {
+ this.toastService.error('Por favor, rellena los campos obligatorios');
+ return;
+ }
+
const payload = {
name: this.imageForm.value.name,
description: this.imageForm.value.description,
comments: this.imageForm.value.comments,
remotePc: this.imageForm.value.remotePc,
- softwareProfile: this.imageForm.value.softwareProfile
+ softwareProfile: this.imageForm.value.softwareProfile,
+ imageRepository: this.imageForm.value.imageRepository,
};
if (this.imageId) {
diff --git a/ogWebconsole/src/app/components/images/images.component.ts b/ogWebconsole/src/app/components/images/images.component.ts
index b646ea5..9bca5c5 100644
--- a/ogWebconsole/src/app/components/images/images.component.ts
+++ b/ogWebconsole/src/app/components/images/images.component.ts
@@ -38,9 +38,14 @@ export class ImagesComponent implements OnInit {
header: 'Perfil de software',
cell: (image: any) => `${image.softwareProfile?.description}`
},
+ {
+ columnDef: 'imageRepository',
+ header: 'Repositorio',
+ cell: (image: any) => `${image.imageRepository?.name}`
+ },
{
columnDef: 'remotePc',
- header: 'Acceso remoto',
+ header: 'Remote Pc',
cell: (image: any) => `${image.remotePc}`
},
{
diff --git a/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts b/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts
index cc4c8ff..5398b22 100644
--- a/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts
+++ b/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts
@@ -110,7 +110,6 @@ export class CreateSoftwareProfileComponent {
}
load(): void {
- console.log(this.data);
this.dataService.getSoftwareProfile(this.data).subscribe({
next: (response) => {
this.formGroup = this.fb.group({