OgLives select url iso
parent
9bd09a7c76
commit
15c2720910
|
@ -5,8 +5,12 @@
|
|||
<input matInput [(ngModel)]="name">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="full-width">
|
||||
<mat-label>URL</mat-label>
|
||||
<input matInput [(ngModel)]="downloadUrl">
|
||||
<mat-label>Seleccionar URL</mat-label>
|
||||
<mat-select [(value)]="selectedDownload">
|
||||
<mat-option *ngFor="let download of downloads" [value]="download">
|
||||
{{ download.filename }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
|
||||
@Component({
|
||||
selector: 'app-create-image',
|
||||
templateUrl: './create-image.component.html',
|
||||
styleUrl: './create-image.component.css'
|
||||
styleUrls: ['./create-image.component.css']
|
||||
})
|
||||
export class CreateImageComponent {
|
||||
export class CreateImageComponent implements OnInit {
|
||||
name: string = '';
|
||||
downloadUrl: string = '';
|
||||
downloads: any[] = [];
|
||||
selectedDownload: any;
|
||||
|
||||
constructor(
|
||||
private toastService: ToastrService,
|
||||
|
@ -19,6 +20,26 @@ export class CreateImageComponent {
|
|||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.fetchDownloads();
|
||||
}
|
||||
|
||||
fetchDownloads(): void {
|
||||
this.http.get('http://127.0.0.1:8080/og-lives/server/get-isos?page=1&itemsPerPage=30')
|
||||
.subscribe({
|
||||
next: (response: any) => {
|
||||
this.downloads = response.data.downloads;
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Error fetching downloads:', error);
|
||||
this.toastService.error('Error fetching downloads');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
onNoClick(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
@ -26,7 +47,7 @@ export class CreateImageComponent {
|
|||
addOgLive(): void {
|
||||
const payload = {
|
||||
name: this.name,
|
||||
downloadUrl: this.downloadUrl
|
||||
downloadUrl: this.selectedDownload.URL
|
||||
};
|
||||
|
||||
this.http.post('http://127.0.0.1:8080/og-lives', payload)
|
||||
|
@ -38,7 +59,7 @@ export class CreateImageComponent {
|
|||
},
|
||||
error: (error) => {
|
||||
console.error('Error:', error);
|
||||
this.toastService.error(' Error creating image');
|
||||
this.toastService.error('Error creating image');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
.disk-usage {
|
||||
flex: 2;
|
||||
margin-right: 20px;
|
||||
|
||||
border: 1px solid #ff0000;
|
||||
}
|
||||
|
||||
.services-status {
|
||||
|
|
Loading…
Reference in New Issue