Skip to content

Commit

Permalink
NAS-133213: Handle null latest_version (#11305)
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanY147 authored Jan 9, 2025
1 parent 3be0a51 commit d102a73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="icon"
matTooltipPosition="above"
name="mdi-alert-circle"
[matTooltip]="'{version} is available!' | translate: { version: app().latest_version | appVersion }"
[matTooltip]="getVersionMsg(app().latest_version)"
></ix-icon>
} @else {
<ix-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
input,
} from '@angular/core';
import { MatTooltipModule } from '@angular/material/tooltip';
import { TranslateModule } from '@ngx-translate/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { App } from 'app/interfaces/app.interface';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
import { AppVersionPipe } from 'app/pages/dashboard/widgets/apps/common/utils/app-version.pipe';
Expand All @@ -16,7 +16,8 @@ import { AppVersionPipe } from 'app/pages/dashboard/widgets/apps/common/utils/ap
styleUrls: ['./app-update-cell.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [TranslateModule, MatTooltipModule, IxIconComponent, AppVersionPipe],
providers: [AppVersionPipe],
imports: [TranslateModule, MatTooltipModule, IxIconComponent],
})
export class AppUpdateCellComponent {
app = input.required<App>();
Expand All @@ -26,4 +27,16 @@ export class AppUpdateCellComponent {
@HostBinding('class') get hostClasses(): string[] {
return ['update', this.showIcon() ? 'has-icon' : 'has-cell'];
}

constructor(
private translate: TranslateService,
private appVersionPipe: AppVersionPipe,
) {}

protected getVersionMsg(version: string): string {
return this.translate.instant(
'{version} is available!',
{ version: this.appVersionPipe.transform(version) || 'Upgrade' },
);
}
}

0 comments on commit d102a73

Please sign in to comment.