Skip to content

Commit

Permalink
NAS-132239: Make it clearer what ports mean in app workloads (#10969)
Browse files Browse the repository at this point in the history
  • Loading branch information
undsoft authored Nov 5, 2024
1 parent 58ee8a0 commit 7741b45
Show file tree
Hide file tree
Showing 97 changed files with 2,294 additions and 2,179 deletions.
2 changes: 1 addition & 1 deletion src/app/enums/boot-environment-active.enum.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export enum BootEnvironmentActive {
Now = 'N',
Restart = 'R',
NowReboot = 'NR',
NowRestart = 'NR',
Dash = '-',
Empty = '',
}
4 changes: 4 additions & 0 deletions src/app/helptext/apps/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,8 @@ export const helptextApps = {
process may stall as images cannot be pulled. The current limit will be renewed in {seconds}. The application\
can still be staged for installation.'),
},

ports: T('Host ports are listed on the left and associated container ports are on the right.\
\
0.0.0.0 on the host side represents binding to any IP address on the host.'),
};
1 change: 1 addition & 0 deletions src/app/modules/tooltip/tooltip.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ <h5 class="tooltip-title">
[popperTrigger]="'click' | cast"
[popper]="popperTooltip"
[popperShowOnStart]="false"
[popperPlacement]="placement()"
></ix-icon>
</div>
9 changes: 8 additions & 1 deletion src/app/modules/tooltip/tooltip.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ChangeDetectionStrategy, Component, input,
} from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { NgxPopperjsModule } from 'ngx-popperjs';
import { NgxPopperjsModule, NgxPopperjsPlacements } from 'ngx-popperjs';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
import { CastPipe } from 'app/modules/pipes/cast/cast.pipe';
import { TestDirective } from 'app/modules/test-id/test.directive';
Expand All @@ -24,4 +24,11 @@ import { TestDirective } from 'app/modules/test-id/test.directive';
export class TooltipComponent {
readonly message = input<string>();
readonly header = input<string>();

// Conversion here just allows us to use enum values as string without having to import the enum
readonly placement = input<NgxPopperjsPlacements, `${NgxPopperjsPlacements}`>(NgxPopperjsPlacements.AUTO, {
transform: (value) => {
return value as NgxPopperjsPlacements;
},
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ <h3 mat-card-title>
</mat-card-header>
<mat-card-content>
<div class="details-item">
<div class="label">{{ 'Ports' | translate }}:</div>
<div class="label">
{{ 'Ports' | translate }}
<ix-tooltip
class="ports-tooltip"
placement="left"
[message]="helptext.ports"
></ix-tooltip>
</div>
<div class="value">
@for (port of hostPorts(); track port.hostPort) {
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

.details-item .label {
align-self: flex-start;
margin-right: 10px;
}

.details-item .value {
Expand All @@ -17,10 +18,11 @@

.with-tooltip {
cursor: help;
text-decoration: underline;
text-decoration-color: var(--alt-fg1);
text-decoration-style: dotted;
text-underline-offset: 2px;
}

.ports-tooltip {
margin-left: -2px;
vertical-align: -3px;
}

.separator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('AppContainersCardComponent', () => {
const details = spectator.queryAll('.details-item');
expect(details).toHaveLength(1);

expect(details[0].querySelector('.label')).toHaveText('Ports:');
expect(details[0].querySelector('.label')).toHaveText('Ports');
expect(details[0].querySelector('.value')).toHaveText('tcp://0.0.0.0:20489:20489');
expect(details[0].querySelector('.value')).toHaveText('tcp://0.0.0.0:8080:80');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { RequiresRolesDirective } from 'app/directives/requires-roles/requires-roles.directive';
import { AppState } from 'app/enums/app-state.enum';
import { Role } from 'app/enums/role.enum';
import { helptextApps } from 'app/helptext/apps/apps';
import {
App, AppContainerDetails, appContainerStateLabels,
} from 'app/interfaces/app.interface';
import { ShellDetailsDialogFormValue } from 'app/interfaces/shell-details-dialog.interface';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
import { MapValuePipe } from 'app/modules/pipes/map-value/map-value.pipe';
import { TestDirective } from 'app/modules/test-id/test.directive';
import { TooltipComponent } from 'app/modules/tooltip/tooltip.component';
import {
VolumeMountsDialogComponent,
} from 'app/pages/apps/components/installed-apps/app-workloads-card/volume-mounts-dialog/volume-mounts-dialog.component';
Expand All @@ -47,6 +49,7 @@ import { ShellDetailsType } from 'app/pages/apps/enum/shell-details-type.enum';
MatIconButton,
MatCardContent,
DecimalPipe,
TooltipComponent,
],
})
export class AppWorkloadsCardComponent {
Expand All @@ -56,6 +59,7 @@ export class AppWorkloadsCardComponent {

protected readonly requiredRoles = [Role.AppsWrite];
protected readonly appContainerStateLabels = appContainerStateLabels;
protected readonly helptext = helptextApps;

constructor(
private matDialog: MatDialog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class BootEnvironmentListComponent implements OnInit {
return this.translate.instant('Now');
case BootEnvironmentActive.Restart:
return this.translate.instant('Restart');
case BootEnvironmentActive.NowReboot:
case BootEnvironmentActive.NowRestart:
return this.translate.instant('Now/Restart');
default:
return row.active;
Expand All @@ -149,7 +149,9 @@ export class BootEnvironmentListComponent implements OnInit {
iconName: iconMarker('mdi-check-decagram'),
requiredRoles: this.requiredRoles,
tooltip: this.translate.instant('Activate'),
hidden: (row) => of(row.active.includes('R')),
hidden: (row) => {
return of([BootEnvironmentActive.NowRestart, BootEnvironmentActive.Restart].includes(row.active));
},
onClick: (row) => this.doActivate(row),
},
{
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname (TrueNAS Controller 2)": "",
"Hostname Database": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Hostname (TrueNAS Controller 2)": "",
"Hostname Database": "",
"Hostname Database:": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/dsb.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en-au.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,7 @@
"Host Sync": "",
"Host name of second TrueNAS controller.": "",
"Host name or IP address of the central key server.": "",
"Host ports are listed on the left and associated container ports are on the right. 0.0.0.0 on the host side represents binding to any IP address on the host.": "",
"Host: {host}": "",
"Hostname": "",
"Hostname (TrueNAS Controller 2)": "",
Expand Down
Loading

0 comments on commit 7741b45

Please sign in to comment.