From e2c34e574df74c603c72fbc9774b3363ab12995c Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sun, 21 Dec 2025 19:07:03 +0000 Subject: [PATCH] jf_activity: ui changes just committing so I can pull on another device. --- html/admin.html | 5 ++- lang/admin/en-us.json | 2 + ts/modules/accounts.ts | 86 ++++++++++++++++++++++++++++++------------ ts/modules/list.ts | 7 ++++ 4 files changed, 73 insertions(+), 27 deletions(-) diff --git a/html/admin.html b/html/admin.html index d14a053..93f23d3 100644 --- a/html/admin.html +++ b/html/admin.html @@ -771,6 +771,7 @@
{{ .strings.actions }}
+ {{ .quantityStrings.addUser.Singular }}
-
+
-
+
diff --git a/lang/admin/en-us.json b/lang/admin/en-us.json index 1b7d027..ada5b45 100644 --- a/lang/admin/en-us.json +++ b/lang/admin/en-us.json @@ -63,6 +63,8 @@ "disabled": "Disabled", "run": "Run", "sendPWR": "Send Password Reset", + "noActivityFound": "No activity found", + "noActivityFoundLocally": "If this account hasn't been used in a while, you might find older entries on Jellyfin directly.", "noResultsFound": "No Results Found", "noResultsFoundLocally": "Only loaded records were searched. You can load more, or perform the search over all records on the server.", "keepSearching": "Keep Searching", diff --git a/ts/modules/accounts.ts b/ts/modules/accounts.ts index ce607c4..b5200ca 100644 --- a/ts/modules/accounts.ts +++ b/ts/modules/accounts.ts @@ -731,7 +731,7 @@ class User extends TableRow implements UserDTO, SearchableItem { } if (window.referralsEnabled) { innerHTML += ` - + `; } innerHTML += ` @@ -1047,6 +1047,7 @@ export class accountsList extends PaginatedList { } }; + private _inDetails: boolean = false; details(username: string, jfId: string) { this.unbindPageEvents(); console.debug("Loading details for ", username, jfId); @@ -1055,14 +1056,17 @@ export class accountsList extends PaginatedList { jfId, () => { this.unbindPageEvents(); + this._inDetails = true; + // To make things look better, run processSelectedAccounts before -actually- unhiding. + this.processSelectedAccounts(); this._table.classList.add("unfocused"); this._details.hidden = false; - this.processSelectedAccounts(); }, () => { + this._inDetails = false; + this.processSelectedAccounts(); this._details.hidden = true; this._table.classList.remove("unfocused"); - this.processSelectedAccounts(); this.bindPageEvents(); }, ); @@ -1667,11 +1671,24 @@ export class accountsList extends PaginatedList { this._enableReferrals.textContent = window.lang.strings("disableReferrals"); } } + if (this._details.hidden) { + this._c.loadAllButtons.forEach((el) => { + // FIXME: Using hidden here instead of unfocused so that it doesn't interfere with any PaginatedList behaviour. Don't do this. + el.classList.add("hidden"); + }); + this._addUserButton.classList.remove("unfocused"); + } else { + this._c.loadAllButtons.forEach((el) => { + // FIXME: Using hidden here instead of unfocused so that it doesn't interfere with any PaginatedList behaviour. Don't do this. + el.classList.add("hidden"); + }); + this._addUserButton.classList.add("unfocused"); + } } }; private _collectUsers = (): string[] => { - if (!this._details.hidden && this._details.jfId != "") return [this._details.jfId]; + if (this._inDetails && this._details.jfId != "") return [this._details.jfId]; let list: string[] = []; for (let id of this._visible) { if (this.users.get(id).selected) { @@ -2836,7 +2853,10 @@ interface ShowDetailsEvent extends Event { } class UserInfo extends PaginatedList { + private _hidden: boolean = true; + private _table: HTMLElement; private _card: HTMLElement; + private _noResults: HTMLElement; get entries(): Map { return this._search.items as Map; } @@ -2848,27 +2868,35 @@ class UserInfo extends PaginatedList { card.innerHTML = `
-
-
-
- - - - - - - - - - -
${window.lang.strings("severity")}${window.lang.strings("details")}${window.lang.strings("type")}${window.lang.strings("other")}${window.lang.strings("date")}
-
-
- - +
+

${window.lang.strings("activity")}

+
+ + + + + + + + + + + +
${window.lang.strings("severity")}${window.lang.strings("details")}${window.lang.strings("type")}${window.lang.strings("other")}${window.lang.strings("date")}
+
+
+ ${window.lang.strings("noActivityFound")} + ${window.lang.strings("noActivityFoundLocally")} +
+
+
+
+ + +
`; @@ -2885,6 +2913,7 @@ class UserInfo extends PaginatedList { itemsPerPage: 20, maxItemsLoadedForSearch: 200, disableSearch: true, + hideButtonsOnLastPage: true, appendNewItems: (resp: paginatedDTO) => { for (let entry of (resp as PaginatedActivityLogEntriesDTO).entries || []) { if (this.entries.has("" + entry.Id)) { @@ -2921,9 +2950,12 @@ class UserInfo extends PaginatedList { this._search.setOrdering(Array.from(this.entries.keys()), "Date", true); }, }); + this._hidden = true; this._card = card; - this._container = this._card.getElementsByClassName("jf-activity-table-content")[0] as HTMLElement; - this._back = this._card.getElementsByClassName("user-details-back")[0] as HTMLButtonElement; + this._table = this._card.getElementsByClassName("jf-activity-table")[0] as HTMLElement; + this._container = this._table.getElementsByClassName("jf-activity-table-content")[0] as HTMLElement; + this._back = document.getElementById("user-details-back") as HTMLButtonElement; + this._noResults = this._card.getElementsByClassName("jf-activity-no-activity")[0] as HTMLElement; let searchConfig: SearchConfiguration = { queries: {}, @@ -2931,6 +2963,7 @@ class UserInfo extends PaginatedList { searchServer: null, clearServerSearch: null, onSearchCallback: (_0: boolean, _1: boolean) => {}, + notFoundPanel: this._noResults, }; this.initSearch(searchConfig); @@ -2981,17 +3014,20 @@ class UserInfo extends PaginatedList { }; get hidden(): boolean { - return this._card.classList.contains("unfocused"); + return this._hidden; } set hidden(v: boolean) { + this._hidden = v; if (v) { this.unbindPageEvents(); this._card.classList.add("unfocused"); + this._back.classList.add("unfocused"); this.username = ""; this.jfId = ""; } else { this.bindPageEvents(); this._card.classList.remove("unfocused"); + this._back.classList.remove("unfocused"); } } } diff --git a/ts/modules/list.ts b/ts/modules/list.ts index b975869..3e95055 100644 --- a/ts/modules/list.ts +++ b/ts/modules/list.ts @@ -107,6 +107,7 @@ export interface PaginatedListConfig { defaultSortAscending?: boolean; pageLoadCallback?: (req: XMLHttpRequest) => void; disableSearch?: boolean; + hideButtonsOnLastPage?: boolean; } export abstract class PaginatedList { @@ -148,11 +149,17 @@ export abstract class PaginatedList { this._c.loadAllButtons.forEach((v) => v.classList.add("unfocused")); this._c.loadMoreButtons.forEach((v) => { v.textContent = window.lang.strings("noMoreResults"); + if (this._c.hideButtonsOnLastPage) { + v.classList.add("unfocused"); + } v.disabled = true; }); } else { this._c.loadMoreButtons.forEach((v) => { v.textContent = window.lang.strings("loadMore"); + if (this._c.hideButtonsOnLastPage) { + v.classList.remove("unfocused"); + } v.disabled = false; }); this._c.loadAllButtons.forEach((v) => v.classList.remove("unfocused"));