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