Fix paging for too large page numbers (#2097)

On some pages with pagination, the user is led to believe that no data is available if a page with page number which it too high is accessed. However, since we show the page number to the outside and the user can access it through the URL, we must also provide appropriate handling. The underlying data can change and so can the number of pages. Now, if a bookmark was saved from an older version, the link should still lead to a destination.
This commit is contained in:
Florian Scholdei
2022-08-02 10:30:07 +02:00
committed by GitHub
parent 27dbcbf28d
commit 6c82142643
12 changed files with 189 additions and 154 deletions

View File

@@ -21,35 +21,34 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import React, { FC } from "react";
import { useTranslation } from "react-i18next";
import { User } from "@scm-manager/ui-types";
import UserRow from "./UserRow";
type Props = WithTranslation & {
type Props = {
users: User[];
};
class UserTable extends React.Component<Props> {
render() {
const { users, t } = this.props;
return (
<table className="card-table table is-hoverable is-fullwidth">
<thead>
<tr>
<th>{t("user.name")}</th>
<th className="is-hidden-mobile">{t("user.displayName")}</th>
<th className="is-hidden-mobile">{t("user.mail")}</th>
</tr>
</thead>
<tbody>
{users.map((user, index) => {
return <UserRow key={index} user={user} />;
})}
</tbody>
</table>
);
}
}
const UserTable: FC<Props> = ({ users }) => {
const [t] = useTranslation("users");
export default withTranslation("users")(UserTable);
return (
<table className="card-table table is-hoverable is-fullwidth">
<thead>
<tr>
<th>{t("user.name")}</th>
<th className="is-hidden-mobile">{t("user.displayName")}</th>
<th className="is-hidden-mobile">{t("user.mail")}</th>
</tr>
</thead>
<tbody>
{users.map((user, index) => {
return <UserRow key={index} user={user} />;
})}
</tbody>
</table>
);
};
export default UserTable;