web/user: make search configurable

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-20 12:15:49 +02:00
parent 88de94f014
commit 84a800583c
2 changed files with 31 additions and 19 deletions

View File

@ -20,6 +20,8 @@ import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-sta
import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css";
import PFPage from "@patternfly/patternfly/components/Page/page.css";
import "./LibraryApplication";
import { until } from "lit-html/directives/until";
import { uiConfig } from "./config";
@customElement("ak-library")
export class LibraryPage extends LitElement {
@ -102,7 +104,12 @@ export class LibraryPage extends LitElement {
return html`<main role="main" class="pf-c-page__main" tabindex="-1" id="main-content">
<div class="pf-c-content header">
<h1>${t`My applications`}</h1>
<input
${until(
uiConfig().then((config) => {
if (!config.enabledFeatures.search) {
return html``;
}
return html` <input
@input=${(ev: InputEvent) => {
const query = (ev.target as HTMLInputElement).value;
if (!this.fuse) return;
@ -121,7 +128,9 @@ export class LibraryPage extends LitElement {
type="text"
autofocus
placeholder=${t`Search...`}
/>
/>`;
}),
)}
</div>
<section class="pf-c-page__main-section">
${loading(

View File

@ -8,6 +8,8 @@ export interface UIConfig {
settings: boolean;
// Application edit in library (only shown when user is superuser)
applicationEdit: boolean;
// Search bar
search: boolean;
};
navbar: {
userDisplay: "username" | "name" | "email";
@ -20,6 +22,7 @@ export const DefaultUIConfig: UIConfig = {
notificationDrawer: true,
settings: true,
applicationEdit: true,
search: true,
},
navbar: {
userDisplay: "name",