Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: provide better feedback on Application Library page about search results #9386

Merged
merged 42 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3146e5a
web: fix esbuild issue with style sheets
kensternberg-authentik Mar 8, 2024
fe52f44
Merge branch 'main' into dev
kensternberg-authentik Mar 11, 2024
e505f27
Merge branch 'main' into dev
kensternberg-authentik Mar 11, 2024
5090621
Merge branch 'main' into dev
kensternberg-authentik Mar 11, 2024
035bda4
Merge branch 'main' into dev
kensternberg-authentik Mar 12, 2024
2d0117d
Merge branch 'main' into dev
kensternberg-authentik Mar 13, 2024
22cb5b7
Merge branch 'main' into dev
kensternberg-authentik Mar 14, 2024
8b4e036
Merge branch 'main' into dev
kensternberg-authentik Mar 14, 2024
db96e1a
Merge branch 'main' into dev
kensternberg-authentik Mar 18, 2024
8946b81
Merge branch 'main' into dev
kensternberg-authentik Mar 19, 2024
30beca9
Merge branch 'main' into dev
kensternberg-authentik Mar 19, 2024
5d84082
Merge branch 'main' into dev
kensternberg-authentik Mar 20, 2024
a7e3dca
Merge branch 'main' into dev
kensternberg-authentik Mar 21, 2024
2d254d6
Merge branch 'main' into dev
kensternberg-authentik Mar 25, 2024
3f95020
Merge branch 'main' into dev
kensternberg-authentik Mar 26, 2024
a056703
Merge branch 'main' into dev
kensternberg-authentik Mar 27, 2024
fc00bde
Merge branch 'main' into dev
kensternberg-authentik Mar 29, 2024
7123b2c
Merge branch 'main' into dev
kensternberg-authentik Mar 29, 2024
5d4c380
Merge branch 'main' into dev
kensternberg-authentik Apr 1, 2024
66cefcc
Merge branch 'main' into dev
kensternberg-authentik Apr 2, 2024
875fc5c
Merge branch 'main' into dev
kensternberg-authentik Apr 4, 2024
c84be1d
Merge branch 'main' into dev
kensternberg-authentik Apr 8, 2024
b08dcc2
Merge branch 'main' into dev
kensternberg-authentik Apr 9, 2024
272fdc5
Merge branch 'main' into dev
kensternberg-authentik Apr 10, 2024
23665d1
Merge branch 'main' into dev
kensternberg-authentik Apr 10, 2024
cacdf64
Merge branch 'main' into dev
kensternberg-authentik Apr 11, 2024
085debf
Merge branch 'main' into dev
kensternberg-authentik Apr 12, 2024
f19ed14
Merge branch 'main' into dev
kensternberg-authentik Apr 16, 2024
ac4ba5d
Merge branch 'main' into dev
kensternberg-authentik Apr 17, 2024
98503f6
Merge branch 'main' into dev
kensternberg-authentik Apr 18, 2024
2d94b16
Merge branch 'main' into dev
kensternberg-authentik Apr 22, 2024
c01045d
web: improve state management of Fuze application search
kensternberg-authentik Apr 23, 2024
34de6bf
Merge branch 'main' into dev
kensternberg-authentik Apr 24, 2024
ca42506
Merge branch 'main' into dev
kensternberg-authentik Apr 25, 2024
2a96900
Merge branch 'main' into dev
kensternberg-authentik May 2, 2024
9acebec
Merge branch 'main' into dev
kensternberg-authentik May 3, 2024
8248163
Merge branch 'main' into dev
kensternberg-authentik May 3, 2024
7cb0cd4
Merge branch 'dev' into web/enhance/better-empty-app-search
kensternberg-authentik May 6, 2024
a3251d8
Merge branch 'main' into web/enhance/better-empty-app-search
kensternberg-authentik Jun 13, 2024
baf36c2
web: updated the improved search to Google's Lit standards for events.
kensternberg-authentik Jun 13, 2024
01320f0
Merge branch 'main' into web/enhance/better-empty-app-search
kensternberg-authentik Jun 14, 2024
db67d36
Merge branch 'main' into web/enhance/better-empty-app-search
kensternberg-authentik Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/src/user/LibraryPage/ApplicationEmptyState.stories.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { html } from "lit";

import "./ApplicationEmptyState";
import "./ak-library-application-empty-list";

export default {
title: "ApplicationEmptyState",
title: "Elements / Application Empty State",
};

export const OrdinaryUser = () =>
Expand Down
155 changes: 0 additions & 155 deletions web/src/user/LibraryPage/LibraryPageImpl.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";

import type { Application } from "@goauthentik/api";

import type { AppGroupEntry, AppGroupList } from "./types";
import type { AppGroupEntry, AppGroupList } from "./types.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be we importing these files are .js? If anything we probably shouldn't for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard is quickly becoming "If it's going to be a JS file, always use a .js extension." I'd like to keep doing that from now on. Typescript has extensive documentation on it. Browser stuff should be ES2020 and beyond.


type Pair = [string, string];

Expand All @@ -31,6 +31,13 @@ const LAYOUTS = new Map<string, [string, string]>([
],
]);

/**
* @element ak-library-application-list
* @class LibraryPageApplicationList
*
* Renders the current library list of a User's Applications.
*
*/
@customElement("ak-library-application-list")
export class LibraryPageApplicationList extends AKElement {
static get styles() {
Expand Down
33 changes: 33 additions & 0 deletions web/src/user/LibraryPage/ak-library-application-search-empty.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { AKElement } from "@goauthentik/elements/Base";

import { msg } from "@lit/localize";
import { html } from "lit";
import { customElement } from "lit/decorators.js";

import PFContent from "@patternfly/patternfly/components/Content/content.css";
import PFEmptyState from "@patternfly/patternfly/components/EmptyState/empty-state.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
import PFSpacing from "@patternfly/patternfly/utilities/Spacing/spacing.css";

/**
* Library Page Application List Empty
*
* Display a message if there are no applications defined in the current instance. If the user is an
* administrator, provide a link to the "Create a new application" page.
*/

@customElement("ak-library-application-search-empty")
export class LibraryPageApplicationSearchEmpty extends AKElement {
static get styles() {
return [PFBase, PFEmptyState, PFContent, PFSpacing];
}

render() {
return html` <div class="pf-c-empty-state pf-m-full-height">
<div class="pf-c-empty-state__content">
<i class="fas fa-cubes pf-c-empty-state__icon" aria-hidden="true"></i>
<h1 class="pf-c-title pf-m-lg">${msg("Search returned no results.")}</h1>
</div>
</div>`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,30 @@ import PFDisplay from "@patternfly/patternfly/utilities/Display/display.css";

import type { Application } from "@goauthentik/api";

import { SEARCH_ITEM_SELECTED, SEARCH_UPDATED } from "./constants";
import { customEvent } from "./helpers";

@customElement("ak-library-list-search")
export class LibraryPageApplicationList extends AKElement {
import {
LibraryPageSearchEmpty,
LibraryPageSearchReset,
LibraryPageSearchSelected,
LibraryPageSearchUpdated,
} from "./events.js";

/**
* @element ak-library-list-search
*
* @class LibraryPageApplicationSearch
*
* @classdesc
*
* The interface between our list of applications shown to the user, an input box, and the Fuse
* fuzzy search library.
*
* @fires LibraryPageSearchUpdated
* @fires LibraryPageSearchEmpty
* @fires LibraryPageSearchReset
*
*/
@customElement("ak-library-application-search")
export class LibraryPageApplicationSearch extends AKElement {
static get styles() {
return [
PFBase,
Expand Down Expand Up @@ -75,11 +94,7 @@ export class LibraryPageApplicationList extends AKElement {
}

onSelected(apps: FuseResult<Application>[]) {
this.dispatchEvent(
customEvent(SEARCH_UPDATED, {
apps: apps.map((app) => app.item),
}),
);
this.dispatchEvent(new LibraryPageSearchUpdated(apps.map((app) => app.item)));
}

connectedCallback() {
Expand All @@ -102,7 +117,7 @@ export class LibraryPageApplicationList extends AKElement {
updateURLParams({
search: this.query,
});
this.onSelected([]);
this.dispatchEvent(new LibraryPageSearchReset());
}

onInput(ev: InputEvent) {
Expand All @@ -113,8 +128,13 @@ export class LibraryPageApplicationList extends AKElement {
updateURLParams({
search: this.query,
});

const apps = this.fuse.search(this.query);
if (apps.length < 1) return;
if (apps.length < 1) {
this.dispatchEvent(new LibraryPageSearchEmpty());
return;
}

this.onSelected(apps);
}

Expand All @@ -125,7 +145,7 @@ export class LibraryPageApplicationList extends AKElement {
return;
}
case "Enter": {
this.dispatchEvent(customEvent(SEARCH_ITEM_SELECTED));
this.dispatchEvent(new LibraryPageSearchSelected());
return;
}
}
Expand Down
Loading
Loading