Skip to content

Commit

Permalink
Add "No data available" display when list is empty (#33517)
Browse files Browse the repository at this point in the history
Add a "No data available" message to be displayed when the list has no
data. This improves the user experience by providing clear feedback in
an empty state.

---------

Co-authored-by: wxiaoguang <[email protected]>
  • Loading branch information
kerwin612 and wxiaoguang authored Feb 8, 2025
1 parent 063c23e commit a52720b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions templates/admin/auth/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td><a href="{{AppSubUrl}}/-/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/emails/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
>{{svg "octicon-trash"}}</a>
</td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="6">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/notice.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<td nowrap>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="6">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
{{if .Notices}}
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/org/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/packages/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
<td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
<td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.Version.ID}}" data-name="{{.Package.Name}}" data-data-version="{{.Version.Version}}">{{svg "octicon-trash"}}</a></td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="10">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/repo/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td><a class="delete-button" href="" data-url="{{$.Link}}/delete?page={{$.Page.Paginater.Current}}&sort={{$.SortType}}" data-id="{{.ID}}" data-name="{{.Name}}">{{svg "octicon-trash"}}</a></td>
</tr>
{{else}}
<tr><td class="tw-text-center" colspan="12">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
Expand Down
2 changes: 2 additions & 0 deletions templates/admin/user/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
</div>
</td>
</tr>
{{else}}
<tr class="no-results-row"><td class="tw-text-center" colspan="9">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
{{end}}
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/auth_ldap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func TestLDAPUserSyncWithEmptyUsernameAttribute(t *testing.T) {

htmlDoc := NewHTMLParser(t, resp.Body)

tr := htmlDoc.doc.Find("table.table tbody tr")
tr := htmlDoc.doc.Find("table.table tbody tr:not(.no-results-row)")
assert.Equal(t, 0, tr.Length())
}

Expand Down

0 comments on commit a52720b

Please sign in to comment.