Skip to content

Commit

Permalink
NAS-131317 / 25.04 / Replaced Lifetime with Power On Hours (#10845)
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden3c authored Oct 14, 2024
1 parent 930a5f1 commit ac4f960
Show file tree
Hide file tree
Showing 95 changed files with 216 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/app/interfaces/smart-test.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface SmartTestResult {
status: SmartTestResultStatus;
status_verbose: string;
segment_number: number;
power_on_hours_ago: number;
}

export interface ManualSmartTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@for (column of displayedColumns; track column; let idx = $index) {
<th
[ngClass]="column.cssClass || ''"
[matTooltip]="column.title"
(click)="onSort(idx)"
>
<div class="title-container" [ngStyle]="{ cursor: !column.disableSorting ? 'pointer' : 'auto' }">
Expand All @@ -12,6 +11,13 @@
[dataProvider]="dataProvider"
[column]="column"
></ng-template>
@if (column.headerTooltip) {
<ix-tooltip
class="tooltip"
[message]="column.headerTooltip | translate"
(click)="$event.stopPropagation()">
</ix-tooltip>
}
</div>
@if (!column.disableSorting) {
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tr {
text-overflow: ellipsis;
white-space: nowrap;

@media(max-width: $breakpoint-sm) {
@media (max-width: $breakpoint-sm) {
padding: 0 8px;
}

Expand All @@ -28,3 +28,12 @@ tr {
}
}
}

.title {
align-items: center;
display: flex;
}

ix-tooltip {
margin-left: 8px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { NgClass, NgStyle } from '@angular/common';
import {
AfterViewInit, ChangeDetectorRef, ChangeDetectionStrategy, Component, Input,
} from '@angular/core';
import { MatTooltip } from '@angular/material/tooltip';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { TranslateModule } from '@ngx-translate/core';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
import { IxTableHeaderCellDirective } from 'app/modules/ix-table/directives/ix-header-cell.directive';
import { SortDirection } from 'app/modules/ix-table/enums/sort-direction.enum';
import { Column, ColumnComponent } from 'app/modules/ix-table/interfaces/column-component.class';
import { DataProvider } from 'app/modules/ix-table/interfaces/data-provider.interface';
import { TestDirective } from 'app/modules/test-id/test.directive';
import { TooltipComponent } from 'app/modules/tooltip/tooltip.component';

@UntilDestroy()
@Component({
Expand All @@ -20,11 +21,12 @@ import { TestDirective } from 'app/modules/test-id/test.directive';
standalone: true,
imports: [
NgClass,
MatTooltip,
NgStyle,
IxTableHeaderCellDirective,
IxIconComponent,
TestDirective,
TooltipComponent,
TranslateModule,
],
})
export class IxTableHeadComponent<T> implements AfterViewInit {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DataProvider } from 'app/modules/ix-table/interfaces/data-provider.inte
export abstract class ColumnComponent<T> {
propertyName?: keyof T;
title?: string;
headerTooltip?: string;
cssClass?: string;
uniqueRowTag: (row: T) => string;
ariaLabels: (row: T) => string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('SmartTestResultListComponent', () => {
lba_of_first_error: null,
status: SmartTestResultStatus.Success,
remaining: null,
power_on_hours_ago: 1,
},
{
num: 2,
Expand All @@ -42,6 +43,7 @@ describe('SmartTestResultListComponent', () => {
lba_of_first_error: null,
status: SmartTestResultStatus.Success,
remaining: 50,
power_on_hours_ago: 25,
},
{
num: 3,
Expand All @@ -52,6 +54,7 @@ describe('SmartTestResultListComponent', () => {
lba_of_first_error: null,
status: SmartTestResultStatus.Success,
remaining: null,
power_on_hours_ago: 49,
}],
}, {
disk: 'sdb',
Expand All @@ -64,6 +67,7 @@ describe('SmartTestResultListComponent', () => {
lba_of_first_error: null,
status: SmartTestResultStatus.Success,
remaining: null,
power_on_hours_ago: 1,
},
{
num: 2,
Expand All @@ -74,6 +78,7 @@ describe('SmartTestResultListComponent', () => {
lba_of_first_error: null,
status: SmartTestResultStatus.Success,
remaining: 0.5,
power_on_hours_ago: 25,
},
{
num: 3,
Expand All @@ -84,6 +89,7 @@ describe('SmartTestResultListComponent', () => {
lba_of_first_error: null,
status: SmartTestResultStatus.Success,
remaining: 0,
power_on_hours_ago: 49,
}],
}];

Expand Down Expand Up @@ -114,13 +120,13 @@ describe('SmartTestResultListComponent', () => {

it('should show table rows', async () => {
const expectedRows = [
['Disk', 'Description', 'Status', 'Remaining', 'Lifetime', 'LBA of First Error'],
['sda', 'Background long', 'SUCCESS', '0%', '15959', 'No errors'],
['sda', 'Background short', 'SUCCESS', '50%', '15929', 'No errors'],
['sda', 'Background short', 'SUCCESS', 'Completed', '16939', 'No errors'],
['sdb', 'Background long', 'SUCCESS', 'Completed', '15959', 'No errors'],
['sdb', 'Background short', 'SUCCESS', '0.5%', '15929', 'No errors'],
['sdb', 'Background short', 'SUCCESS', '0%', '16939', 'No errors'],
['Disk', 'Description', 'Status', 'Remaining', expect.stringContaining('Power On Hours Ago'), 'LBA of First Error'],
['sda', 'Background long', 'SUCCESS', '0%', '1', 'No errors'],
['sda', 'Background short', 'SUCCESS', '50%', '25', 'No errors'],
['sda', 'Background short', 'SUCCESS', 'Completed', '49', 'No errors'],
['sdb', 'Background long', 'SUCCESS', 'Completed', '1', 'No errors'],
['sdb', 'Background short', 'SUCCESS', '0.5%', '25', 'No errors'],
['sdb', 'Background short', 'SUCCESS', '0%', '49', 'No errors'],
];

const cells = await table.getCellTexts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ export class SmartTestResultListComponent implements OnInit {
},
}),
textColumn({
title: this.translate.instant('Lifetime'),
propertyName: 'lifetime',
title: this.translate.instant('Power On Hours Ago'),
propertyName: 'power_on_hours_ago',
headerTooltip: this.translate.instant('"Power On Hours" are how many hours have passed while the disk has been powered on. "Power On Hours Ago" is how many power on hours have passed since each test.'),
getValue: (row) => {
return row.lifetime || this.translate.instant('N/A');
return row.power_on_hours_ago || this.translate.instant('N/A');
},
}),
textColumn({
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"<a href=\"https://forums.truenas.com/\" target=\"_blank\"> TrueNAS Forums</a> - Find answers from other users in the forums.": "",
"<a href=\"https://tools.ietf.org/html/rfc8095\" target=\"_blank\">Transport Protocol</a> for the remote system log server connection. Choosing Transport Layer Security (TLS) also requires selecting a preconfigured system Certificate.": "",
"<a href=\"https://www.ixsystems.com/support/truenas-arrays/\" target=\"_blank\"> TrueNAS Licensing</a> - Learn more about enterprise-grade support.": "",
Expand Down Expand Up @@ -2557,6 +2558,7 @@
"Power Management": "",
"Power Menu": "",
"Power Mode": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" as of {dateTime}": "",
" bytes.": "",
" seconds.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"% of all cores": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
Expand Down Expand Up @@ -3133,6 +3134,7 @@
"Power Mode": "",
"Power Off": "",
"Power Off UPS": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
" Est. Usable Raw Capacity": "",
" as of {dateTime}": "",
" bytes.": "",
"\"Power On Hours\" are how many hours have passed while the disk has been powered on. \"Power On Hours Ago\" is how many power on hours have passed since each test.": "",
"'Hosts Allow' or 'Hosts Deny' has been set": "",
"'Hosts Allow' or 'Hosts Deny' has been updated": "",
"(No description)": "",
Expand Down Expand Up @@ -2248,6 +2249,7 @@
"Power Management": "",
"Power Menu": "",
"Power Mode": "",
"Power On Hours Ago": "",
"Power Supply": "",
"Pre Init": "",
"Pre Script": "",
Expand Down
Loading

0 comments on commit ac4f960

Please sign in to comment.