refs #1314. Fixed tree groups bugs.
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
testing/ogGui-multibranch/pipeline/head This commit looks good
Details
parent
5661ec68ca
commit
c13db7f36e
|
@ -22,7 +22,7 @@
|
||||||
<mat-label i18n="@@oglive-label">OgLive</mat-label>
|
<mat-label i18n="@@oglive-label">OgLive</mat-label>
|
||||||
<mat-select formControlName="ogLive">
|
<mat-select formControlName="ogLive">
|
||||||
<mat-option *ngFor="let oglive of ogLives" [value]="oglive['@id']">
|
<mat-option *ngFor="let oglive of ogLives" [value]="oglive['@id']">
|
||||||
{{ oglive.name }}
|
{{ oglive.filename }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -19,12 +19,9 @@ export class CreateClientComponent implements OnInit {
|
||||||
ogLives: any[] = [];
|
ogLives: any[] = [];
|
||||||
menus: any[] = [];
|
menus: any[] = [];
|
||||||
templates: any[] = [];
|
templates: any[] = [];
|
||||||
uploadedClients: any[] = [];
|
|
||||||
repositories: any[] = [];
|
repositories: any[] = [];
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
displayedColumns: string[] = ['name', 'ip'];
|
displayedColumns: string[] = ['name', 'ip'];
|
||||||
isSingleClientForm: boolean = false;
|
|
||||||
showTextarea: boolean = true;
|
|
||||||
protected netifaceTypes = [
|
protected netifaceTypes = [
|
||||||
{ name: 'Eth0', value: 'eth0' },
|
{ name: 'Eth0', value: 'eth0' },
|
||||||
{ name: 'Eth1', value: 'eth1' },
|
{ name: 'Eth1', value: 'eth1' },
|
||||||
|
@ -158,55 +155,18 @@ export class CreateClientComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(): void {
|
onSubmit(): void {
|
||||||
if (this.isSingleClientForm) {
|
|
||||||
if (this.clientForm.valid) {
|
if (this.clientForm.valid) {
|
||||||
const formData = this.clientForm.value;
|
const formData = this.clientForm.value;
|
||||||
console.log('Form data:', formData);
|
|
||||||
this.http.post(`${this.baseUrl}/clients`, formData).subscribe(
|
this.http.post(`${this.baseUrl}/clients`, formData).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.toastService.success('Cliente creado exitosamente', 'Éxito');
|
this.toastService.success('Cliente creado exitosamente', 'Éxito');
|
||||||
this.dialogRef.close(response);
|
this.dialogRef.close(response);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.error('Error durante POST:', error);
|
|
||||||
this.toastService.error('Error al crear el cliente', 'Error');
|
this.toastService.error('Error al crear el cliente', 'Error');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if (this.uploadedClients.length > 0) {
|
|
||||||
this.uploadedClients.forEach(client => {
|
|
||||||
const formData = {
|
|
||||||
organizationalUnit: this.clientForm.value.organizationalUnit || null,
|
|
||||||
name: client.name || null,
|
|
||||||
mac: client.mac || null,
|
|
||||||
ip: client.ip || null,
|
|
||||||
template: this.clientForm.value.template || null,
|
|
||||||
hardwareProfile: this.clientForm.value.hardwareProfile || null,
|
|
||||||
ogLive: this.clientForm.value.ogLive || null,
|
|
||||||
repository: this.clientForm.value.repository || null,
|
|
||||||
serialNumber: null,
|
|
||||||
netiface: null,
|
|
||||||
netDriver: null
|
|
||||||
};
|
|
||||||
|
|
||||||
this.http.post(`${this.baseUrl}/clients`, formData).subscribe(
|
|
||||||
response => {
|
|
||||||
this.toastService.success(`Cliente ${client.name} creado exitosamente`, 'Éxito');
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
console.error(`Error al crear el cliente ${client.name}:`, error);
|
|
||||||
this.toastService.error(`Error al crear el cliente ${client.name}`, 'Error');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.uploadedClients = [];
|
|
||||||
this.dialogRef.close();
|
|
||||||
} else {
|
|
||||||
this.toastService.error('No hay clientes cargados para añadir', 'Error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onNoClick(): void {
|
onNoClick(): void {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<mat-label>{{ 'typeLabel' | translate }}</mat-label>
|
<mat-label>{{ 'typeLabel' | translate }}</mat-label>
|
||||||
<mat-select formControlName="type" required>
|
<mat-select formControlName="type" required>
|
||||||
<mat-option *ngFor="let type of types" [value]="type">
|
<mat-option *ngFor="let type of filteredTypes" [value]="type">
|
||||||
{{ typeTranslations[type] }}
|
{{ typeTranslations[type] }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
|
@ -40,6 +40,7 @@ export class CreateOrganizationalUnitComponent implements OnInit {
|
||||||
repositories: any[] = [];
|
repositories: any[] = [];
|
||||||
selectedCalendarUuid: string | null = null;
|
selectedCalendarUuid: string | null = null;
|
||||||
|
|
||||||
|
|
||||||
@Output() unitAdded = new EventEmitter();
|
@Output() unitAdded = new EventEmitter();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -96,6 +97,10 @@ export class CreateOrganizationalUnitComponent implements OnInit {
|
||||||
this.loadRepositories();
|
this.loadRepositories();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get filteredTypes(): string[] {
|
||||||
|
return this.generalFormGroup.get('parent')?.value ? this.types.filter(type => type !== 'organizational-unit') : this.types;
|
||||||
|
}
|
||||||
|
|
||||||
loadParentUnits() {
|
loadParentUnits() {
|
||||||
const url = `${this.baseUrl}/organizational-units?page=1&itemsPerPage=1000`;
|
const url = `${this.baseUrl}/organizational-units?page=1&itemsPerPage=1000`;
|
||||||
this.http.get<any>(url).subscribe(
|
this.http.get<any>(url).subscribe(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<mat-label>{{ 'typeLabel' | translate }}</mat-label>
|
<mat-label>{{ 'typeLabel' | translate }}</mat-label>
|
||||||
<mat-select formControlName="type" required>
|
<mat-select formControlName="type" required>
|
||||||
<mat-option *ngFor="let type of types" [value]="type">{{ type }}</mat-option>
|
<mat-option *ngFor="let type of filteredTypes" [value]="type">{{ type }}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
|
|
|
@ -98,6 +98,10 @@ export class EditOrganizationalUnitComponent implements OnInit {
|
||||||
this.loadRepositories();
|
this.loadRepositories();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get filteredTypes(): string[] {
|
||||||
|
return this.generalFormGroup.get('parent')?.value ? this.types.filter(type => type !== 'organizational-unit') : this.types;
|
||||||
|
}
|
||||||
|
|
||||||
loadParentUnits() {
|
loadParentUnits() {
|
||||||
const url = `${this.baseUrl}/organizational-units?page=1&itemsPerPage=10000`;
|
const url = `${this.baseUrl}/organizational-units?page=1&itemsPerPage=10000`;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue