Skip to content

Commit a52720b

Browse files
Add "No data available" display when list is empty (#33517)
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]>
1 parent 063c23e commit a52720b

File tree

8 files changed

+15
-1
lines changed

8 files changed

+15
-1
lines changed

templates/admin/auth/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
3131
<td><a href="{{AppSubUrl}}/-/admin/auths/{{.ID}}">{{svg "octicon-pencil"}}</a></td>
3232
</tr>
33+
{{else}}
34+
<tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
3335
{{end}}
3436
</tbody>
3537
</table>

templates/admin/emails/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
>{{svg "octicon-trash"}}</a>
6868
</td>
6969
</tr>
70+
{{else}}
71+
<tr><td class="tw-text-center" colspan="6">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
7072
{{end}}
7173
</tbody>
7274
</table>

templates/admin/notice.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<td nowrap>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
2525
<td class="view-detail"><a href="#">{{svg "octicon-note" 16}}</a></td>
2626
</tr>
27+
{{else}}
28+
<tr><td class="tw-text-center" colspan="6">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
2729
{{end}}
2830
</tbody>
2931
{{if .Notices}}

templates/admin/org/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
6767
<td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td>
6868
</tr>
69+
{{else}}
70+
<tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
6971
{{end}}
7072
</tbody>
7173
</table>

templates/admin/packages/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@
7474
<td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
7575
<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>
7676
</tr>
77+
{{else}}
78+
<tr><td class="tw-text-center" colspan="10">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
7779
{{end}}
7880
</tbody>
7981
</table>

templates/admin/repo/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
8787
<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>
8888
</tr>
89+
{{else}}
90+
<tr><td class="tw-text-center" colspan="12">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
8991
{{end}}
9092
</tbody>
9193
</table>

templates/admin/user/list.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@
109109
</div>
110110
</td>
111111
</tr>
112+
{{else}}
113+
<tr class="no-results-row"><td class="tw-text-center" colspan="9">{{ctx.Locale.Tr "no_results_found"}}</td></tr>
112114
{{end}}
113115
</tbody>
114116
</table>

tests/integration/auth_ldap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func TestLDAPUserSyncWithEmptyUsernameAttribute(t *testing.T) {
279279

280280
htmlDoc := NewHTMLParser(t, resp.Body)
281281

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

0 commit comments

Comments
 (0)