web/user: make search configurable
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
88de94f014
commit
84a800583c
|
@ -20,6 +20,8 @@ import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-sta
|
||||||
import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css";
|
import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css";
|
||||||
import PFPage from "@patternfly/patternfly/components/Page/page.css";
|
import PFPage from "@patternfly/patternfly/components/Page/page.css";
|
||||||
import "./LibraryApplication";
|
import "./LibraryApplication";
|
||||||
|
import { until } from "lit-html/directives/until";
|
||||||
|
import { uiConfig } from "./config";
|
||||||
|
|
||||||
@customElement("ak-library")
|
@customElement("ak-library")
|
||||||
export class LibraryPage extends LitElement {
|
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">
|
return html`<main role="main" class="pf-c-page__main" tabindex="-1" id="main-content">
|
||||||
<div class="pf-c-content header">
|
<div class="pf-c-content header">
|
||||||
<h1>${t`My applications`}</h1>
|
<h1>${t`My applications`}</h1>
|
||||||
<input
|
${until(
|
||||||
|
uiConfig().then((config) => {
|
||||||
|
if (!config.enabledFeatures.search) {
|
||||||
|
return html``;
|
||||||
|
}
|
||||||
|
return html` <input
|
||||||
@input=${(ev: InputEvent) => {
|
@input=${(ev: InputEvent) => {
|
||||||
const query = (ev.target as HTMLInputElement).value;
|
const query = (ev.target as HTMLInputElement).value;
|
||||||
if (!this.fuse) return;
|
if (!this.fuse) return;
|
||||||
|
@ -121,7 +128,9 @@ export class LibraryPage extends LitElement {
|
||||||
type="text"
|
type="text"
|
||||||
autofocus
|
autofocus
|
||||||
placeholder=${t`Search...`}
|
placeholder=${t`Search...`}
|
||||||
/>
|
/>`;
|
||||||
|
}),
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<section class="pf-c-page__main-section">
|
<section class="pf-c-page__main-section">
|
||||||
${loading(
|
${loading(
|
||||||
|
|
|
@ -8,6 +8,8 @@ export interface UIConfig {
|
||||||
settings: boolean;
|
settings: boolean;
|
||||||
// Application edit in library (only shown when user is superuser)
|
// Application edit in library (only shown when user is superuser)
|
||||||
applicationEdit: boolean;
|
applicationEdit: boolean;
|
||||||
|
// Search bar
|
||||||
|
search: boolean;
|
||||||
};
|
};
|
||||||
navbar: {
|
navbar: {
|
||||||
userDisplay: "username" | "name" | "email";
|
userDisplay: "username" | "name" | "email";
|
||||||
|
@ -20,6 +22,7 @@ export const DefaultUIConfig: UIConfig = {
|
||||||
notificationDrawer: true,
|
notificationDrawer: true,
|
||||||
settings: true,
|
settings: true,
|
||||||
applicationEdit: true,
|
applicationEdit: true,
|
||||||
|
search: true,
|
||||||
},
|
},
|
||||||
navbar: {
|
navbar: {
|
||||||
userDisplay: "name",
|
userDisplay: "name",
|
||||||
|
|
Reference in New Issue