Skip to content

Commit

Permalink
NAS-128451: Port WidgetSysInfoComponent to new dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
denysbutenko committed May 15, 2024
1 parent d254468 commit 4bff083
Show file tree
Hide file tree
Showing 96 changed files with 130 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/app/pages/dashboard/services/widget-resources.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { sub } from 'date-fns';
import { Observable, forkJoin, interval } from 'rxjs';
import { Observable, forkJoin, timer } from 'rxjs';
import {
combineLatestWith,
map, shareReplay, switchMap,
Expand All @@ -27,7 +27,7 @@ import { waitForSystemInfo } from 'app/store/system-info/system-info.selectors';
export class WidgetResourcesService {
// TODO: nosub is emitted for some reason
readonly realtimeUpdates$ = this.ws.subscribe('reporting.realtime');
readonly refreshInteval$ = interval(10000);
readonly refreshInteval$ = timer(0, 10000);

readonly backups$ = forkJoin([
this.ws.call('replication.query'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

.product-image-placeholder {
display: flex;
min-height: auto;
min-height: 100px;
min-width: 150px;
place-content: center;
place-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class ProductImageComponent {
isHaLicensed = input.required<boolean>();
isIxHardware = input.required<boolean>();

isUnsupportedHardware = computed(() => this.isEnterprise() && !this.isIxHardware() && !this.isHaLicensed());
isCertified = computed(() => this.systemProduct()?.includes('CERTIFIED'));
product = computed(() => getServerProduct(this.systemProduct()));
productImage = computed(() => getProductImage(this.systemProduct()));
Expand All @@ -33,8 +34,6 @@ export class ProductImageComponent {
return getProductEnclosure(this.systemProduct());
});

isUnsupportedHardware = computed(() => this.isEnterprise() && !this.isIxHardware());

constructor(private router: Router) { }

goToEnclosure(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getProductImage(systemProduct: string): string {
product = getServerProduct(systemProduct) ? `servers/${getServerProduct(systemProduct)}.png` : 'ix-original.svg';
}

return `assets/images/${product}`;
return product ? `assets/images/${product}` : '';
}

export function isRackmount(systemProduct: string): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
[ixTest]="['widget-sysinfo', 'update-running']"
[disabled]="true"
>{{ 'Update in Progress' | translate }}</button>

<button
*ngIf="updateAvailable() && !isUpdateRunning()"
mat-button
Expand Down Expand Up @@ -81,17 +82,22 @@ <h3>{{ 'System Information' | translate }}</h3>
</div>
</mat-list-item>

<mat-list-item *ngIf="systemInfo()?.license">
<mat-list-item>
<strong>{{ 'License' | translate }}:</strong>
<span>
{{
'{license} contract, expires {date}' | translate:
{
license: systemInfo().license.contract_type | titlecase,
date: systemInfo().license.contract_end.$value,
}
}}
</span>
<ng-container *ngIf="isLoaded(); else inlineLoader">
<span *ngIf="systemInfo()?.license">
{{
'{license} contract, expires {date}' | translate:
{
license: systemInfo().license.contract_type | titlecase,
date: systemInfo().license.contract_end.$value,
}
}}
</span>
<span *ngIf="!systemInfo()?.license">
{{ 'No License' | translate }}
</span>
</ng-container>
</mat-list-item>

<mat-list-item *ngIf="systemInfo()?.system_serial && isIxHardware()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export class WidgetSysInfoActiveComponent {
elapsedTenSecondsInterval = toSignal(this.resources.refreshInteval$);

version = computed(() => getSystemVersion(this.systemInfo().version, this.systemInfo().codename));
uptime = computed(() => this.systemInfo().uptime_seconds + this.elapsedTenSecondsInterval());
datetime = computed(() => this.systemInfo().datetime.$date + (this.elapsedTenSecondsInterval() * 1000));
isLoaded = computed(() => this.systemInfo() && this.uptime() && this.datetime());
uptime = computed(() => this.systemInfo().uptime_seconds + (this.elapsedTenSecondsInterval() * 10));
datetime = computed(() => this.systemInfo().datetime.$date + (this.elapsedTenSecondsInterval() * 10 * 1000));
isLoaded = computed(() => this.systemInfo());

constructor(
private resources: WidgetResourcesService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,22 @@ <h3>{{ 'System Information' | translate }} <small>{{ 'standby' | translate }}</s
</div>
</mat-list-item>

<mat-list-item *ngIf="systemInfo()?.license">
<mat-list-item>
<strong>{{ 'License' | translate }}:</strong>
<span>
{{ '{license} contract, expires {date}' | translate:
{
license: systemInfo().license.contract_type | titlecase,
date: systemInfo().license.contract_end.$value
}
}}
</span>
<ng-container *ngIf="isLoaded(); else inlineLoader">
<span *ngIf="systemInfo()?.license">
{{
'{license} contract, expires {date}' | translate:
{
license: systemInfo().license.contract_type | titlecase,
date: systemInfo().license.contract_end.$value,
}
}}
</span>
<span *ngIf="!systemInfo()?.license">
{{ 'No License' | translate }}
</span>
</ng-container>
</mat-list-item>

<mat-list-item *ngIf="systemInfo()?.system_serial && isIxHardware()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export class WidgetSysInfoPassiveComponent {
systemInfo = toSignal(this.resources.systemInfo$.pipe(map((sysInfo) => sysInfo.remote_info)));

version = computed(() => getSystemVersion(this.systemInfo().version, this.systemInfo().codename));
uptime = computed(() => this.systemInfo().uptime_seconds + this.elapsedTenSecondsInterval());
datetime = computed(() => this.systemInfo().datetime.$date + (this.elapsedTenSecondsInterval() * 1000));
isLoaded = computed(() => this.systemInfo() && this.uptime() && this.datetime());
uptime = computed(() => this.systemInfo().uptime_seconds + (this.elapsedTenSecondsInterval() * 10));
datetime = computed(() => this.systemInfo().datetime.$date + (this.elapsedTenSecondsInterval() * 10 * 1000));
isLoaded = computed(() => this.systemInfo());

constructor(
private resources: WidgetResourcesService,
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Pods Found": "",
"No Pools Found": "",
"No Propagate Inherit": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/dsb.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en-au.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es-ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Pods Found": "",
"No Pools Found": "",
"No Propagate Inherit": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es-co.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es-mx.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es-ni.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es-ve.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2530,6 +2530,7 @@
"No Inherit": "",
"No Isolated GPU Device(s) configured": "",
"No Item": "",
"No License": "",
"No Logs": "",
"No Pods Found": "",
"No Pools": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@
"New Privilege": "",
"New View Enclosure": "",
"No Enclosure Dispersal Strategy": "",
"No License": "",
"No available licensed Expansion Shelves ": "",
"No logs available": "",
"No results found in {section}": "",
Expand Down
Loading

0 comments on commit 4bff083

Please sign in to comment.