-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2431 from freenas/memory-widget
Memory widget
- Loading branch information
Showing
6 changed files
with
464 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
src/app/core/components/widgets/widgetmemory/widgetmemory.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
.widget{ | ||
width:600px; | ||
height:400px; | ||
} | ||
|
||
.widget mat-card-content{ | ||
width: 100%; | ||
} | ||
|
||
#cpu-cores-chart{ | ||
/*position: absolute; | ||
left: 0; | ||
bottom: 0;*/ | ||
width: 536px; | ||
margin:0 16px; | ||
} | ||
|
||
#cpu-cores-wrapper{ | ||
/*border-top:solid 1px var(--bg1);*/ | ||
} | ||
|
||
#cpu-load-wrapper{ | ||
position:relative; | ||
height:170px; | ||
} | ||
|
||
#cpu-load-cores{ | ||
/*opacity:0.5;*/ | ||
} | ||
|
||
#cpu-load-cores-legend{ | ||
/*margin-top:36px;*/ | ||
} | ||
|
||
#cpu-load-cores-legend .legend-item.chart-label{ | ||
text-align:center; | ||
} | ||
|
||
#cpu-load-cores-legend .legend-item{ | ||
text-align:left; | ||
} | ||
|
||
#cpu-load-cores-legend .legend-item .label{ | ||
font-weight:500; | ||
} | ||
|
||
#cpu-load-cores-legend .legend-item .legend-swatch{ | ||
margin: 4px 8px 0; | ||
} | ||
|
||
#cpu-load-cores-values { | ||
width:100%; | ||
} | ||
|
||
#cpu-load-cores-values .temperature{ | ||
text-align:right; | ||
} | ||
|
||
#cpu-load-label{ | ||
margin-bottom:0; | ||
font-weight:400; | ||
} | ||
|
||
#cpu-load-value{ | ||
position:absolute; | ||
top:41%; | ||
width:100%; | ||
font-size:175%; | ||
} | ||
|
||
.title-wrapper{ | ||
/*background-color:var(--blue); | ||
color:#fff;*/ | ||
height:45%; | ||
text-align: left; | ||
padding: 16px; | ||
width:100%; | ||
} | ||
|
||
.title-wrapper .widget-loader{ | ||
position:absolute; | ||
top:0; | ||
left:0; | ||
width:100%; | ||
} | ||
|
||
.title-wrapper .title{ | ||
font-size:150%; | ||
} | ||
|
||
.title-wrapper .subtitle{ | ||
font-size:80%; | ||
} | ||
|
||
.bar-chart{ | ||
margin-bottom:32px; | ||
} | ||
|
||
h1.memory-used{ | ||
margin: 32px 0 0; | ||
font-weight: 400; | ||
font-size: 350%; | ||
} | ||
|
||
h1.memory-used span.memory-used-units{ | ||
font-size:50%; | ||
} | ||
|
||
/*.reports-btn{ | ||
position:absolute; | ||
right:16px; | ||
bottom:16px; | ||
font-weight:500; | ||
text-transform:capitalize; | ||
}*/ | ||
|
||
.chart-wrapper{ | ||
position:relative; | ||
width:100%; | ||
} | ||
|
||
.x-axis .start-time, | ||
.x-axis .end-time{ | ||
font-size: 75%; | ||
position: absolute; | ||
bottom: 0; | ||
font-weight:500; | ||
font-family:Roboto; | ||
opacity:0.5; | ||
} | ||
|
||
.x-axis .start-time{ | ||
left:8px; | ||
} | ||
.x-axis .end-time{ | ||
right:8px; | ||
} | ||
|
||
/*:host ::ng-deep .c3-axis-y g:nth-child(2n){ | ||
visibility:hidden; | ||
}*/ | ||
|
||
/* MARKER */ | ||
:host ::ng-deep .c3-chart-line .c3-circles circle._expanded_{ | ||
stroke:var(--primary) !important; | ||
} | ||
:host ::ng-deep .c3-chart-line circle.c3-circle{ | ||
fill:var(--bg2) !important; | ||
} | ||
|
||
/* NARROW SCREENS */ | ||
.xs.widget{ | ||
width:100%; | ||
max-height:320px; | ||
} | ||
|
||
/* Overrides */ | ||
.widget .c3 .c3-axis g.tick tspan{ | ||
fill-opacity:1; | ||
font-weight:500; | ||
} |
74 changes: 74 additions & 0 deletions
74
src/app/core/components/widgets/widgetmemory/widgetmemory.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<div class="widget stats-widget" ngClass.xs="double-height xs"> | ||
<div class="card-container front"> | ||
<mat-card class="front" fxLayout="row" fxLayoutWrap fxLayoutAlign="space-between stretch"> | ||
<mat-card-content> | ||
<mat-toolbar-row > | ||
<h3 class="mat-card-title-text"><div class="card-title-text">{{title | translate}}</div></h3> | ||
<!--<ng-template *ngIf="configurable === true"> | ||
<button mat-icon-button (click)="toggleConfig()"> | ||
<mat-icon>settings</mat-icon> | ||
</button> | ||
</ng-template>--> | ||
<!--<button mat-button color="primary" class="" (click)="router.navigate(['reportsdashboard/cpu'])">CPU REPORTS</button>--> | ||
</mat-toolbar-row> | ||
<!--<viewchartline fxFlex="100" fxFlexAlign="end" #chartCpu width="600" height="160" [style.display]="isFlipped ? 'none': 'block'"></viewchartline>--> | ||
<!-- Chart --> | ||
<!--<div id="cpu-load-wrapper" fxLayout="row wrap" fxLayoutAlign="space-around center"> | ||
<h3 fxFlex="33" id="cpu-load-label">USAGE</h3> | ||
<div *ngIf="cpuAvg && cpuAvg.data" id="cpu-load-value">{{cpuAvg.data[1]}}%</div> | ||
<viewchartgauge fxFlex="34" *ngIf="usage && usage.data" [config]="usage" #memorygauge class=""></viewchartgauge> | ||
<h4 fxFlex="33" id="cpu-load-cores"> <span *ngIf="usage && usage.data && usage.data.total">{{usage.data.total}}</span>GiB Installed Memory</h4> | ||
</div>--> | ||
|
||
|
||
<div id="cpu-cores-wrapper" class="bar-chart-wrapper" fxLayout="column"> | ||
<h1 fxFlex="100" class="memory-used">{{memData ? memData.data[0][1] : 'Loading...'}}<span class="memory-used-units">GiB</span></h1> | ||
<div fxFlex="100" class="memory-used-caption">free of {{memData ? memData.max : 'unknown'}}GiB total</div> | ||
<div fxFlex="100" id="memory-usage-chart" class="bar-chart"></div> | ||
<div fxFlex="100" id="cpu-load-cores-legend" fxLayout="row wrap"> | ||
<div *ngIf="memData; else noLegend" id="cpu-load-cores-legend-values" fxFlex fxLayout="row wrap" fxLayoutAlign="space-around center"> | ||
<div fxFlex="26" *ngFor="let legendItem of memData.data; let i=index" class="legend-item"> | ||
<div class="legend-swatch" [style.background-color]="trustedSecurity(colorPattern[i])"></div><span class="label">{{legendItem[0]}}:</span> {{legendItem[1]}} GiB | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<ng-template #noLegend> | ||
<div id="cpu-load-cores-legend-values" fxFlex fxLayout="row" fxLayoutAlign="space-around center"> | ||
<div fxFlex="100" class="legend-item chart-label"> | ||
<span class="label">CPU Usage/Temperature per Core</span> | ||
</div> | ||
</div> | ||
</ng-template> | ||
|
||
</div> <!-- Cores Wrapper --> | ||
|
||
<!-- DETAILS --> | ||
<!--<div class="title-wrapper fn-theme-primary" fxFlex="100"> | ||
<mat-progress-bar class="widget-loader" *ngIf="loader" mode="indeterminate"></mat-progress-bar> | ||
<ng-container *ngIf="showLegendValues"> | ||
<p class="title">{{altTitle}}</p> | ||
<p class="subtitle">{{altSubtitle}}</p> | ||
</ng-container> | ||
<ng-container *ngIf="!showLegendValues"> | ||
<p class="title">{{title}}</p> | ||
<p class="subtitle">{{subtitle}}</p> | ||
</ng-container> | ||
<button mat-button class="reports-btn" (click)="router.navigate(['reportsdashboard/cpu'])">REPORTS</button> | ||
</div>--> | ||
</mat-card-content> | ||
</mat-card> | ||
|
||
<!--<ng-template *ngIf="configurable"> | ||
<mat-card class="back"> | ||
<mat-card-content fxLayout="column" fxLayoutAlign="start stretch" fxFlex="100"> | ||
</mat-card-content> | ||
<div class="widget-footer"> | ||
<button mat-button color="accent" (click)="toggleConfig()">{{"Cancel" | translate}}</button> | ||
<button mat-button color="primary" type="submit" form="preferences" (click)="toggleConfig()">{{"Save" | translate}}</button> | ||
</div> | ||
</mat-card> | ||
</ng-template>--> | ||
|
||
</div> | ||
</div> |
Oops, something went wrong.