Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
ui: make <ResourceTable> resilient to resources without IDs
Browse files Browse the repository at this point in the history
Addresses #3928
  • Loading branch information
jgwhite committed Sep 23, 2022
1 parent db9b15c commit d1399b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ui/app/components/resources-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
{{#each @resources key="id" as |resource|}}
<tr>
<th scope="row">
<LinkTo
title={{resource.name}}
@route={{@route}}
@models={{append (or @models (array)) resource.id}}
>
{{resource.name}}
</LinkTo>
{{#if resource.id}}
<LinkTo
title={{resource.name}}
@route={{@route}}
@models={{append (or @models (array)) resource.id}}
>
{{resource.name}}
</LinkTo>
{{else}}
<FlightIcon @name="alert-triangle-fill" />
<span class="sr-only">{{resource.name}}</span>
{{/if}}
</th>
<td class="resource-icon"><FlightIcon @name={{icon-for-component resource.platform}} /> {{resource.type}}</td>
<td>{{date-format-distance-to-now resource.createdTime.seconds}}</td>
Expand Down
1 change: 1 addition & 0 deletions ui/app/styles/utilities/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import 'animations';
@import 'focus-ring';
@import 'sr-only';
11 changes: 11 additions & 0 deletions ui/app/styles/utilities/sr-only.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}

0 comments on commit d1399b7

Please sign in to comment.