-
Notifications
You must be signed in to change notification settings - Fork 404
NAS-141479 / 27.0.0-BETA.1 / Migrate Sharing/Shared components slide-ins & modal-header to tn-* #13927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NAS-141479 / 27.0.0-BETA.1 / Migrate Sharing/Shared components slide-ins & modal-header to tn-* #13927
Changes from all commits
af871c9
df5d633
2103f46
9d921c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,26 @@ | ||
| <button | ||
| mat-stroked-button | ||
| <!-- A read-only status readout, not a control: it carries no action, so it is a labelled | ||
| `role="img"` region rather than the button Material rendered (no tn-* outlined pill carries the | ||
| green / grey / orange service colours). The role is deliberately not live: `service` resolves | ||
| asynchronously on page load and `service.query` events push state changed elsewhere into the | ||
| store, so a `role="status"` region would announce unprompted rather than only confirm an action | ||
| taken from this card. The label carries the same copy as the tooltip, which is pointer-only now | ||
| that the readout is not focusable. `tnTestIdType="button"` pins the legacy | ||
| `button-service-status-*` id that `[ixTest]` on the old `<button>` resolved to. --> | ||
| @let statusLabel = 'The {name} service is {status}' | translate: { | ||
| name: service()?.service | mapValue: serviceNames, | ||
| status: service()?.state | lowercase | ||
| }; | ||
|
|
||
| <span | ||
| class="service-status" | ||
| role="img" | ||
| tnTestIdType="button" | ||
| [ngClass]="statusClass()" | ||
| [attr.aria-roledescription]="'Service status' | translate" | ||
| [ixTest]="['service-status', service()?.service]" | ||
| [tnTooltip]="'The {name} service is {status}' | translate: { | ||
| name: service()?.service | mapValue: serviceNames, | ||
| status: service()?.state | lowercase | ||
| }" | ||
| [attr.aria-label]="service() ? statusLabel : null" | ||
| [tnTestId]="['service-status', service()?.service]" | ||
| [tnTooltip]="statusLabel" | ||
| [tnTooltipDisabled]="!service()" | ||
| [ngClass]="statusClass()" | ||
| > | ||
| {{ service()?.state | titlecase }} | ||
| </button> | ||
| </span> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,24 @@ | |
| margin-left: 8px; | ||
| margin-right: 8px; | ||
| } | ||
|
|
||
| // Reproduces the outlined-pill look the Material stroked button + `.fn-theme-*` used to give | ||
| // this readout. `background: transparent` is required: the global `.fn-theme-*` helpers paint a | ||
| // filled background, and these badges want the theme colour on the text only. | ||
| .service-status { | ||
|
Check notice on line 9 in src/app/pages/sharing/components/shares-dashboard/service-state-button/service-state-button.component.scss
|
||
| align-items: center; | ||
| background: transparent; | ||
| border: 1px solid currentColor; | ||
| border-radius: 25px; | ||
| display: inline-flex; | ||
| font-size: 14px; | ||
| font-weight: 700; | ||
| height: 30px; | ||
| line-height: 1; | ||
| padding: 0 16px; | ||
| white-space: nowrap; | ||
|
Comment on lines
+9
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOW — The shape half of this block is a verbatim copy of the shared Reusing it keeps only the part that genuinely differs — the @import 'scss-imports/status-pill';
.service-status {
@include status-pill;
font-size: 14px;
line-height: 1;
padding: 0 16px;
&.fn-theme-green { color: var(--green); }
&.fn-theme-grey { color: var(--grey); }
&.fn-theme-orange { color: var(--orange); }
}Worth noting the existing |
||
|
|
||
| &.fn-theme-green { color: var(--green); } | ||
| &.fn-theme-grey { color: var(--grey); } | ||
| &.fn-theme-orange { color: var(--orange); } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,23 +2,20 @@ | |
| import { | ||
| ChangeDetectionStrategy, Component, computed, input, | ||
| } from '@angular/core'; | ||
| import { MatButton } from '@angular/material/button'; | ||
| import { TranslateModule } from '@ngx-translate/core'; | ||
| import { TnTooltipDirective } from '@truenas/ui-components'; | ||
| import { TnTestIdDirective, TnTooltipDirective } from '@truenas/ui-components'; | ||
| import { serviceNames } from 'app/enums/service-name.enum'; | ||
| import { ServiceStatus } from 'app/enums/service-status.enum'; | ||
| import { Service } from 'app/interfaces/service.interface'; | ||
| import { MapValuePipe } from 'app/modules/pipes/map-value/map-value.pipe'; | ||
| import { TestDirective } from 'app/modules/test-id/test.directive'; | ||
|
|
||
| @Component({ | ||
| selector: 'ix-service-state-button', | ||
| templateUrl: './service-state-button.component.html', | ||
| styleUrls: ['./service-state-button.component.scss'], | ||
| changeDetection: ChangeDetectionStrategy.OnPush, | ||
| imports: [ | ||
| MatButton, | ||
| TestDirective, | ||
| TnTestIdDirective, | ||
| TnTooltipDirective, | ||
| NgClass, | ||
| TranslateModule, | ||
|
|
@@ -27,11 +24,9 @@ | |
| TitleCasePipe, | ||
| ], | ||
| }) | ||
| export class ServiceStateButtonComponent { | ||
|
Check notice on line 27 in src/app/pages/sharing/components/shares-dashboard/service-state-button/service-state-button.component.ts
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOW — After this change nothing in here is a button: the template renders an inert
Non-blocking, and a rename touches a handful of files, so it's reasonable to defer — but the current names actively mislead. |
||
| readonly service = input<Service>(); | ||
| readonly count = input<number>(); | ||
|
|
||
| protected readonly serviceStatus = ServiceStatus; | ||
| protected readonly serviceNames = serviceNames; | ||
|
|
||
| readonly statusClass = computed(() => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.