Merge branch 'develop' of ssh://ognproject.evlt.uma.es:21987/opengnsys/oggui into develop
commit
b4bf4909fa
|
@ -13,7 +13,8 @@
|
||||||
[view]="view"
|
[view]="view"
|
||||||
[colorScheme]="colorScheme"
|
[colorScheme]="colorScheme"
|
||||||
[isDoughnut]="isDoughnut"
|
[isDoughnut]="isDoughnut"
|
||||||
[showLabels]="showLabels">
|
[showLabels]="showLabels"
|
||||||
|
[isDhcp]="isDhcp">
|
||||||
</app-status-tab>
|
</app-status-tab>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|
||||||
|
@ -22,12 +23,13 @@
|
||||||
[loading]="loading"
|
[loading]="loading"
|
||||||
[diskUsage]="dhcpDiskUsage"
|
[diskUsage]="dhcpDiskUsage"
|
||||||
[servicesStatus]="dhcpServicesStatus"
|
[servicesStatus]="dhcpServicesStatus"
|
||||||
[installedOgLives]="installedOgLives"
|
[subnets]="subnets"
|
||||||
[diskUsageChartData]="dhcpDiskUsageChartData"
|
[diskUsageChartData]="dhcpDiskUsageChartData"
|
||||||
[view]="view"
|
[view]="view"
|
||||||
[colorScheme]="colorScheme"
|
[colorScheme]="colorScheme"
|
||||||
[isDoughnut]="isDoughnut"
|
[isDoughnut]="isDoughnut"
|
||||||
[showLabels]="showLabels">
|
[showLabels]="showLabels"
|
||||||
|
[isDhcp]="isDhcp">
|
||||||
</app-status-tab>
|
</app-status-tab>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
installedOgLives: any[] = [];
|
installedOgLives: any[] = [];
|
||||||
|
subnets: any[] = [];
|
||||||
showLabels: boolean = true;
|
showLabels: boolean = true;
|
||||||
isDoughnut: boolean = true;
|
isDoughnut: boolean = true;
|
||||||
colorScheme: any = {
|
colorScheme: any = {
|
||||||
|
@ -29,6 +30,7 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
dhcpDiskUsage: any = {};
|
dhcpDiskUsage: any = {};
|
||||||
dhcpServicesStatus: any = {};
|
dhcpServicesStatus: any = {};
|
||||||
dhcpDiskUsageChartData: any[] = [];
|
dhcpDiskUsageChartData: any[] = [];
|
||||||
|
isDhcp: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
|
@ -44,7 +46,7 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
this.loadOgBootStatus();
|
this.loadOgBootStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadStatus(apiUrl: string, diskUsage: any, servicesStatus: any, diskUsageChartData: any[], installedOgLives: any[]): void {
|
loadStatus(apiUrl: string, diskUsage: any, servicesStatus: any, diskUsageChartData: any[], installedOgLives: any[], isDhcp: boolean): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
const timeoutId = setTimeout(() => {
|
const timeoutId = setTimeout(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
@ -58,9 +60,17 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
diskUsage.percentage = data.message.disk_usage.percentage;
|
diskUsage.percentage = data.message.disk_usage.percentage;
|
||||||
|
|
||||||
Object.assign(servicesStatus, data.message.services_status);
|
Object.assign(servicesStatus, data.message.services_status);
|
||||||
installedOgLives.length = 0;
|
|
||||||
if (data.message.installed_oglives) {
|
if (isDhcp) {
|
||||||
installedOgLives.push(...data.message.installed_oglives);
|
this.subnets.length = 0;
|
||||||
|
if (data.message.subnets) {
|
||||||
|
this.subnets.push(...data.message.subnets);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
installedOgLives.length = 0;
|
||||||
|
if (data.message.installed_oglives) {
|
||||||
|
installedOgLives.push(...data.message.installed_oglives);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diskUsageChartData.length = 0;
|
diskUsageChartData.length = 0;
|
||||||
|
@ -82,11 +92,13 @@ export class GlobalStatusComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadOgBootStatus(): void {
|
loadOgBootStatus(): void {
|
||||||
this.loadStatus(this.ogBootApiUrl, this.ogBootDiskUsage, this.ogBootServicesStatus, this.ogBootDiskUsageChartData, this.installedOgLives);
|
this.isDhcp = false;
|
||||||
|
this.loadStatus(this.ogBootApiUrl, this.ogBootDiskUsage, this.ogBootServicesStatus, this.ogBootDiskUsageChartData, this.installedOgLives, this.isDhcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadDhcpStatus(): void {
|
loadDhcpStatus(): void {
|
||||||
this.loadStatus(this.dhcpApiUrl, this.dhcpDiskUsage, this.dhcpServicesStatus, this.dhcpDiskUsageChartData, this.installedOgLives);
|
this.isDhcp = true;
|
||||||
|
this.loadStatus(this.dhcpApiUrl, this.dhcpDiskUsage, this.dhcpServicesStatus, this.dhcpDiskUsageChartData, this.installedOgLives, this.isDhcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
onTabChange(event: MatTabChangeEvent): void {
|
onTabChange(event: MatTabChangeEvent): void {
|
||||||
|
|
|
@ -31,24 +31,32 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Installed OgLives Section -->
|
<!-- Installed OgLives / Subnets Section -->
|
||||||
<div class="installed-oglives" joyrideStep="oglivesStep" text="{{ 'oglivesDescription' | translate }}">
|
<div class="installed-oglives" joyrideStep="oglivesStep" text="{{ 'oglivesDescription' | translate }}">
|
||||||
<h3>{{ 'installedOglivesTitle' | translate }}</h3>
|
<h3>{{ isDhcp ? ('subnets' | translate) : ('InstalledOglivesTitle' | translate)}}</h3>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ 'idLabel' | translate }}</th>
|
<th>{{ 'idLabel' | translate }}</th>
|
||||||
<th>{{ 'kernelLabel' | translate }}</th>
|
<th *ngIf="!isDhcp">{{ 'kernelLabel' | translate }}</th>
|
||||||
<th>{{ 'architectureLabel' | translate }}</th>
|
<th *ngIf="!isDhcp">{{ 'architectureLabel' | translate }}</th>
|
||||||
<th>{{ 'revisionLabel' | translate }}</th>
|
<th *ngIf="!isDhcp">{{ 'revisionLabel' | translate }}</th>
|
||||||
|
<th *ngIf="isDhcp">{{ 'bootFileNameLabel' | translate }}</th>
|
||||||
|
<th *ngIf="isDhcp">{{ 'nextServerLabel' | translate }}</th>
|
||||||
|
<th *ngIf="isDhcp">{{ 'ipLabel' | translate }}</th>
|
||||||
|
<th *ngIf="isDhcp">{{ 'clientsLabel' | translate }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr *ngFor="let oglive of installedOgLives">
|
<tr *ngFor="let item of isDhcp ? subnets : installedOgLives">
|
||||||
<td>{{ oglive.id }}</td>
|
<td>{{ item.id }}</td>
|
||||||
<td>{{ oglive.kernel }}</td>
|
<td *ngIf="!isDhcp">{{ item.kernel }}</td>
|
||||||
<td>{{ oglive.architecture }}</td>
|
<td *ngIf="!isDhcp">{{ item.architecture }}</td>
|
||||||
<td>{{ oglive.revision }}</td>
|
<td *ngIf="!isDhcp">{{ item.revision }}</td>
|
||||||
|
<td *ngIf="isDhcp">{{ item['boot-file-name'] }}</td>
|
||||||
|
<td *ngIf="isDhcp">{{ item['next-server'] }}</td>
|
||||||
|
<td *ngIf="isDhcp">{{ item.subnet }}</td>
|
||||||
|
<td *ngIf="isDhcp">{{ item.reservations.length }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -10,6 +10,7 @@ export class StatusTabComponent {
|
||||||
@Input() diskUsage: any = {};
|
@Input() diskUsage: any = {};
|
||||||
@Input() servicesStatus: any = {};
|
@Input() servicesStatus: any = {};
|
||||||
@Input() installedOgLives: any[] = [];
|
@Input() installedOgLives: any[] = [];
|
||||||
|
@Input() subnets: any[] = [];
|
||||||
@Input() diskUsageChartData: any[] = [];
|
@Input() diskUsageChartData: any[] = [];
|
||||||
@Input() showLabels: boolean = true;
|
@Input() showLabels: boolean = true;
|
||||||
@Input() isDoughnut: boolean = true;
|
@Input() isDoughnut: boolean = true;
|
||||||
|
@ -17,6 +18,7 @@ export class StatusTabComponent {
|
||||||
domain: ['#df200d', '#26a700']
|
domain: ['#df200d', '#26a700']
|
||||||
};
|
};
|
||||||
@Input() view: [number, number] = [400, 220];
|
@Input() view: [number, number] = [400, 220];
|
||||||
|
@Input() isDhcp: boolean = false;
|
||||||
|
|
||||||
getServices(): { name: string, status: string }[] {
|
getServices(): { name: string, status: string }[] {
|
||||||
if (!this.servicesStatus) {
|
if (!this.servicesStatus) {
|
||||||
|
@ -26,7 +28,6 @@ export class StatusTabComponent {
|
||||||
name: key,
|
name: key,
|
||||||
status: this.servicesStatus[key]
|
status: this.servicesStatus[key]
|
||||||
}))
|
}))
|
||||||
console.log(services)
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,45 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
import { ConvertImageToVirtualComponent } from './convert-image-to-virtual.component';
|
import { ConvertImageToVirtualComponent } from './convert-image-to-virtual.component';
|
||||||
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
import { ToastrModule } from 'ngx-toastr';
|
||||||
|
import { ConfigService } from '@services/config.service';
|
||||||
|
|
||||||
describe('ConvertImageToVirtualComponent', () => {
|
describe('ConvertImageToVirtualComponent', () => {
|
||||||
let component: ConvertImageToVirtualComponent;
|
let component: ConvertImageToVirtualComponent;
|
||||||
let fixture: ComponentFixture<ConvertImageToVirtualComponent>;
|
let fixture: ComponentFixture<ConvertImageToVirtualComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
|
const mockConfigService = {
|
||||||
|
apiUrl: 'http://mock-api-url'
|
||||||
|
};
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ConvertImageToVirtualComponent]
|
declarations: [ConvertImageToVirtualComponent],
|
||||||
|
imports: [
|
||||||
|
MatDialogModule,
|
||||||
|
ToastrModule.forRoot()
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
provideHttpClient(),
|
||||||
|
provideHttpClientTesting(),
|
||||||
|
{
|
||||||
|
provide: MatDialogRef,
|
||||||
|
useValue: {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: MAT_DIALOG_DATA,
|
||||||
|
useValue: {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: ConfigService,
|
||||||
|
useValue: mockConfigService
|
||||||
|
}
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(ConvertImageToVirtualComponent);
|
fixture = TestBed.createComponent(ConvertImageToVirtualComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
|
@ -20,4 +49,4 @@ describe('ConvertImageToVirtualComponent', () => {
|
||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
expect(component).toBeTruthy();
|
expect(component).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue