Skip to content

Commit

Permalink
NAS-132938: Update empty config for disk list (#11227)
Browse files Browse the repository at this point in the history
  • Loading branch information
denysbutenko authored Jan 1, 2025
1 parent 772b33a commit 493273c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ix-page-header>
<ix-page-header [loading]="dataProvider.isLoading$ | async">
<ix-search-input1 [value]="filterString" (search)="onListFiltered($event)"></ix-search-input1>
<ix-table-columns-selector [columns]="columns" (columnsChange)="columnsChange($event)"></ix-table-columns-selector>
</ix-page-header>
Expand Down Expand Up @@ -37,7 +37,7 @@
<ix-table
class="table"
[ix-table-empty]="!(dataProvider.currentPageCount$ | async)"
[emptyConfig]="emptyService.defaultEmptyConfig(dataProvider.emptyType$ | async)"
[emptyConfig]="emptyConfig"
>
<thead
ix-table-head
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import { RequiresRolesDirective } from 'app/directives/requires-roles/requires-r
import { UiSearchDirective } from 'app/directives/ui-search.directive';
import { DiskPowerLevel } from 'app/enums/disk-power-level.enum';
import { DiskStandby } from 'app/enums/disk-standby.enum';
import { EmptyType } from 'app/enums/empty-type.enum';
import { Role } from 'app/enums/role.enum';
import { SmartTestResultPageType } from 'app/enums/smart-test-results-page-type.enum';
import { buildNormalizedFileSize } from 'app/helpers/file-size.utils';
import { Choices } from 'app/interfaces/choices.interface';
import { Disk, DetailsDisk } from 'app/interfaces/disk.interface';
import { EmptyConfig } from 'app/interfaces/empty-config.interface';
import { EmptyService } from 'app/modules/empty/empty.service';
import { SearchInput1Component } from 'app/modules/forms/search-input1/search-input1.component';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
Expand Down Expand Up @@ -202,6 +204,29 @@ export class DiskListComponent implements OnInit {
private unusedDisks: DetailsDisk[] = [];
private smartDiskChoices: Choices = {};

protected get emptyConfig(): EmptyConfig {
const type = this.dataProvider.emptyType$.value;
if (type === EmptyType.NoSearchResults) {
return {
...this.emptyService.defaultEmptyConfig(type),
button: {
action: () => this.onListFiltered(''),
label: this.translate.instant('Reset'),
},
};
}
if (type === EmptyType.Errors) {
return {
...this.emptyService.defaultEmptyConfig(type),
button: {
action: () => this.dataProvider.load(),
label: this.translate.instant('Retry'),
},
};
}
return this.emptyService.defaultEmptyConfig(type);
}

constructor(
private api: ApiService,
private router: Router,
Expand Down

0 comments on commit 493273c

Please sign in to comment.