web/elements: add new API to store attributes in URL, use for table and tabs

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-11-18 21:01:58 +01:00
parent c363b1cfde
commit 465898c7d0
6 changed files with 83 additions and 13 deletions

View File

@ -16,6 +16,7 @@ import "../../elements/forms/DeleteBulkForm";
import "../../elements/forms/ModalForm";
import { MessageLevel } from "../../elements/messages/Message";
import { showMessage } from "../../elements/messages/MessageContainer";
import { getURLParam, updateURLParams } from "../../elements/router/RouteMatch";
import { TableColumn } from "../../elements/table/Table";
import { TablePage } from "../../elements/table/TablePage";
import { first } from "../../utils";
@ -46,7 +47,7 @@ export class UserListPage extends TablePage<User> {
order = "last_login";
@property({ type: Boolean })
hideServiceAccounts = true;
hideServiceAccounts = getURLParam<boolean>("hideServiceAccounts", true);
static get styles(): CSSResult[] {
return super.styles.concat(PFDescriptionList);
@ -284,6 +285,9 @@ export class UserListPage extends TablePage<User> {
this.hideServiceAccounts = !this.hideServiceAccounts;
this.page = 1;
this.fetch();
updateURLParams({
hideServiceAccounts: this.hideServiceAccounts,
});
}}
/>
<label class="pf-c-check__label" for="hide-service-accounts">