refs #1907. Updated global status sync endpoints
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
testing/ogGui-multibranch/pipeline/head There was a failure building this commit
Details
parent
b6e8134810
commit
cbe15bba4d
|
@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
import { MatTabChangeEvent } from '@angular/material/tabs';
|
||||
import {ToastrService} from "ngx-toastr";
|
||||
|
||||
@Component({
|
||||
selector: 'app-global-status',
|
||||
|
@ -40,6 +41,7 @@ export class GlobalStatusComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
private configService: ConfigService,
|
||||
private toastService: ToastrService,
|
||||
private http: HttpClient
|
||||
) {
|
||||
this.baseUrl = this.configService.apiUrl;
|
||||
|
@ -50,6 +52,56 @@ export class GlobalStatusComponent implements OnInit {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.loadOgBootStatus();
|
||||
this.syncSubnets()
|
||||
this.syncTemplates()
|
||||
this.syncOgLives()
|
||||
}
|
||||
|
||||
syncSubnets() {
|
||||
const timeoutId = setTimeout(() => {
|
||||
this.toastService.error('Error al sincronizar las subredes: tiempo de espera agotado');
|
||||
}, 3500);
|
||||
|
||||
this.http.post(`${this.baseUrl}/subnets/sync`, {}).subscribe({
|
||||
next: (response) => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.success('Sincronización con componente DHCP exitosa');
|
||||
},
|
||||
error: (error) => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.error('Error al sincronizar las subredes DHCP');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
syncTemplates() {
|
||||
const timeoutId = setTimeout(() => {
|
||||
this.toastService.error('Error al sincronizar las plantillas Pxe: tiempo de espera agotado');
|
||||
}, 3500);
|
||||
|
||||
this.http.post(`${this.baseUrl}/pxe-templates/sync`, {})
|
||||
.subscribe(response => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.success('Sincronización de las plantillas Pxe completada');
|
||||
}, error => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.error('Error al sincronizar las plantillas Pxe');
|
||||
});
|
||||
}
|
||||
|
||||
syncOgLives(): void {
|
||||
const timeoutId = setTimeout(() => {
|
||||
this.toastService.error('Error al sincronizar las imagenes ogLive : tiempo de espera agotado');
|
||||
}, 3500);
|
||||
|
||||
this.http.post(`${this.baseUrl}/og-lives/sync`, {})
|
||||
.subscribe(response => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.success('Sincronización con los ogLives completada');
|
||||
}, error => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.error('Error al sincronizar imágenes ogLive');
|
||||
});
|
||||
}
|
||||
|
||||
[key: string]: any;
|
||||
|
|
|
@ -421,7 +421,7 @@ export class GroupsComponent implements OnInit, OnDestroy {
|
|||
width: '900px',
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((newUnit) => {
|
||||
if (newUnit?.uuid) {
|
||||
if (newUnit) {
|
||||
this.refreshData(newUnit.uuid);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
<app-loading [isLoading]="loading"></app-loading>
|
||||
|
||||
<div class="header-container">
|
||||
<button mat-icon-button color="primary" (click)="iniciarTour()">
|
||||
<mat-icon>help</mat-icon>
|
||||
|
|
|
@ -79,7 +79,6 @@ export class PXEimagesComponent implements OnInit {
|
|||
this.loading = true;
|
||||
this.search();
|
||||
this.loadAlert();
|
||||
this.syncOgBoot()
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
|
@ -245,17 +244,6 @@ export class PXEimagesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
syncOgBoot(): void {
|
||||
this.http.post(`${this.apiUrl}/sync`, {})
|
||||
.subscribe(response => {
|
||||
this.toastService.success('Sincronización con oGBoot exitosa');
|
||||
this.search()
|
||||
}, error => {
|
||||
console.error('Error al sincronizar', error);
|
||||
this.toastService.error('Error al sincronizar');
|
||||
});
|
||||
}
|
||||
|
||||
iniciarTour(): void {
|
||||
this.joyrideService.startTour({
|
||||
steps: [
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
</div>
|
||||
|
||||
<app-loading [isLoading]="loading"></app-loading>
|
||||
<table *ngIf="!loading" mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableStep"
|
||||
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8" joyrideStep="tableStep"
|
||||
text="{{ 'tableDescription' | translate }}">
|
||||
<ng-container *ngFor="let column of columns" [matColumnDef]="column.columnDef">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ column.header }}</th>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import { CreatePxeTemplateComponent } from './create-pxeTemplate/create-pxe-template.component';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
|
@ -19,7 +19,7 @@ import { ConfigService } from '@services/config.service';
|
|||
templateUrl: './pxe.component.html',
|
||||
styleUrls: ['./pxe.component.css']
|
||||
})
|
||||
export class PxeComponent {
|
||||
export class PxeComponent implements OnInit{
|
||||
baseUrl: string;
|
||||
private apiUrl: string;
|
||||
pxeTemplates: any[] = [];
|
||||
|
@ -76,7 +76,6 @@ export class PxeComponent {
|
|||
this.loading = true;
|
||||
this.search();
|
||||
this.loadAlert()
|
||||
this.syncTemplates()
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
|
@ -147,17 +146,6 @@ export class PxeComponent {
|
|||
const dialogRef = this.dialog.open(ShowTemplateContentComponent, { data: { data }, width: '700px' });
|
||||
}
|
||||
|
||||
syncTemplates() {
|
||||
this.http.post(`${this.apiUrl}/sync`, {})
|
||||
.subscribe(response => {
|
||||
this.toastService.success('Sincronización completada');
|
||||
this.search()
|
||||
}, error => {
|
||||
console.error('Error al sincronizar', error);
|
||||
this.toastService.error('Error al sincronizar');
|
||||
});
|
||||
}
|
||||
|
||||
applyFilter() {
|
||||
this.http.get<any>(`${this.apiUrl}?page=${this.page}&itemsPerPage=${this.itemsPerPage}`).subscribe({
|
||||
next: (response) => {
|
||||
|
|
|
@ -69,19 +69,21 @@ export class OgDhcpSubnetsComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loading = true;
|
||||
this.loadAlert()
|
||||
this.syncSubnets()
|
||||
this.loadSubnets()
|
||||
}
|
||||
|
||||
loadSubnets() {
|
||||
this.loading = true;
|
||||
this.http.get<any>(`${this.baseUrl}/subnets?page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`).subscribe({
|
||||
next: (response) => {
|
||||
this.dataSource.data = response['hydra:member'];
|
||||
this.length = response['hydra:totalItems'];
|
||||
this.loading = false;
|
||||
},
|
||||
error: error => {
|
||||
this.toastService.error(error.error['hydra:description']);
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -90,28 +92,6 @@ export class OgDhcpSubnetsComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
syncSubnets() {
|
||||
this.loading = true;
|
||||
const timeoutId = setTimeout(() => {
|
||||
this.loading = false;
|
||||
this.toastService.error('Error al sincronizar: tiempo de espera agotado');
|
||||
}, 3500);
|
||||
|
||||
this.http.post(`${this.apiUrl}/sync`, {}).subscribe({
|
||||
next: (response) => {
|
||||
clearTimeout(timeoutId);
|
||||
this.toastService.success('Sincronización con componente DHCP exitosa');
|
||||
this.loadSubnets();
|
||||
this.loading = false;
|
||||
},
|
||||
error: (error) => {
|
||||
clearTimeout(timeoutId);
|
||||
this.loading = false;
|
||||
this.toastService.error('Error al sincronizar');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toggleAction(subnet: any, action: string): void {
|
||||
switch (action) {
|
||||
case 'get':
|
||||
|
|
Loading…
Reference in New Issue