diff --git a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html new file mode 100644 index 00000000..878f4890 --- /dev/null +++ b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.html @@ -0,0 +1,10 @@ +
+ + {{ item.value }} + +
diff --git a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.scss b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts new file mode 100644 index 00000000..235b7045 --- /dev/null +++ b/src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component.ts @@ -0,0 +1,38 @@ +import { + ChangeDetectionStrategy, + Component, + Input +} from '@angular/core'; +import { LabelValueShowcaseModule } from "src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module"; +import { + NgForOf, + NgIf +} from "@angular/common"; +import { MatIcon } from "@angular/material/icon"; + + +interface LabelValueData { + label: string; + value: string; + icon?: string; +} + +@Component({ + selector: 'app-lib-showcase-grid', + standalone: true, + imports: [ + LabelValueShowcaseModule, + NgForOf, + MatIcon, + NgIf + ], + templateUrl: './lib-showcase-grid.component.html', + styleUrl: './lib-showcase-grid.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class LibShowcaseGridComponent { + + @Input() data: LabelValueData[] = []; + @Input() minSize: string = '6rem'; // Default size is 12rem + +} diff --git a/src/app/components/rack-parts/rack-editor/rack-editor.component.html b/src/app/components/rack-parts/rack-editor/rack-editor.component.html index d0a61087..a5041dbc 100644 --- a/src/app/components/rack-parts/rack-editor/rack-editor.component.html +++ b/src/app/components/rack-parts/rack-editor/rack-editor.component.html @@ -15,10 +15,8 @@ - + + + + + + +
diff --git a/src/app/components/rack-parts/rack-editor/rack-editor.component.ts b/src/app/components/rack-parts/rack-editor/rack-editor.component.ts index 17f37ed4..f1447c42 100644 --- a/src/app/components/rack-parts/rack-editor/rack-editor.component.ts +++ b/src/app/components/rack-parts/rack-editor/rack-editor.component.ts @@ -208,4 +208,11 @@ export class RackEditorComponent extends SubManager implements OnInit { } + calculateRackUtilization(totalHp: number, rows: number, usedHp: number): string { + const totalCapacity = Number(totalHp) * Number(rows); + if (totalCapacity === 0 || isNaN(totalCapacity)) return '0%'; + return ((Number(usedHp) / totalCapacity) * 100).toFixed(2) + '%'; + } + + } \ No newline at end of file diff --git a/src/app/components/rack-parts/rack.module.ts b/src/app/components/rack-parts/rack.module.ts index e82050cd..5879def5 100644 --- a/src/app/components/rack-parts/rack.module.ts +++ b/src/app/components/rack-parts/rack.module.ts @@ -45,6 +45,8 @@ import { AdviceTooltipModule } from "src/app/shared-interproject/components/@vis import { MatBadge } from "@angular/material/badge"; import { CalculateRowInformationPipe } from "src/app/components/rack-parts/rack-editor/calculate-row-information.pipe"; import { RackImageComponent } from "src/app/components/rack-parts/rack-image/rack-image.component"; +import { LabelValueShowcaseModule } from "src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module"; +import { LibShowcaseGridComponent } from "src/app/components/rack-parts/rack-editor/lib-showcase-grid/lib-showcase-grid.component"; @NgModule({ @@ -105,7 +107,9 @@ import { RackImageComponent } from "src/app/components/rack-parts/rack-image/rac AdviceTooltipModule, MatBadge, CalculateRowInformationPipe, - RackImageComponent + RackImageComponent, + LabelValueShowcaseModule, + LibShowcaseGridComponent ] }) export class RackModule { diff --git a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.html b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.html index 6b16f32b..bed5ebac 100644 --- a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.html +++ b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.html @@ -1,22 +1,21 @@ -
+ + +
+ {{ icon }} +
+
+
-
{{ label }}
-
-
-
+
+ {{ label }} +
+
+
+
+
\ No newline at end of file diff --git a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.scss b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.scss index 0bda13b8..79912657 100644 --- a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.scss +++ b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.scss @@ -35,3 +35,10 @@ .monospace { font-family: monospace, monospace; } + +.icon { + // center + margin: auto; + + align-items: center; +} \ No newline at end of file diff --git a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.ts b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.ts index 886d2ee3..b29a31a0 100644 --- a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.ts +++ b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.component.ts @@ -1,4 +1,9 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + Input +} from '@angular/core'; + /** * UI ONLY COMPONENT @@ -12,6 +17,9 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; export class LabelValueShowcaseComponent { @Input() label: string; + + @Input() + icon?: string; @Input() bigText = true; diff --git a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module.ts b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module.ts index e8a5020f..dffa745f 100644 --- a/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module.ts +++ b/src/app/shared-interproject/components/@visual/label-value-showcase/label-value-showcase.module.ts @@ -2,13 +2,16 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@angular/flex-layout'; import { LabelValueShowcaseComponent } from './label-value-showcase.component'; +import { MatIcon } from "@angular/material/icon"; + @NgModule({ declarations: [LabelValueShowcaseComponent], exports: [LabelValueShowcaseComponent], - imports: [ + imports: [ CommonModule, - FlexLayoutModule + FlexLayoutModule, + MatIcon ] }) export class LabelValueShowcaseModule {} diff --git a/src/app/style/tools.scss b/src/app/style/tools.scss index 6980a935..00fb5d75 100644 --- a/src/app/style/tools.scss +++ b/src/app/style/tools.scss @@ -31,6 +31,14 @@ -webkit-box-orient: horizontal; } +.fixed-width12 { + flex: 0 0 12rem; +} + +.fixed-width16 { + flex: 0 0 16rem; +} + //breakpoint mediaQuery //xs 'screen and (max-width: 599px)' //sm 'screen and (min-width: 600px) and (max-width: 959px)'