Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
* main:
  core: applications api: prefetch related policies (#10273)
  web: restore hasLaunchUrl to client-side criteria for filtering apps (#10291)
  • Loading branch information
kensternberg-authentik committed Jun 29, 2024
2 parents db059d9 + 136b7de commit fec46df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion authentik/core/api/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Meta:
class ApplicationViewSet(UsedByMixin, ModelViewSet):
"""Application Viewset"""

queryset = Application.objects.all().prefetch_related("provider")
queryset = Application.objects.all().prefetch_related("provider").prefetch_related("policies")
serializer_class = ApplicationSerializer
search_fields = [
"name",
Expand Down
17 changes: 12 additions & 5 deletions web/src/user/LibraryPage/ak-library-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import styles from "./LibraryPageImpl.css";

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

import { appHasLaunchUrl } from "./LibraryPageImpl.utils";
import "./ak-library-application-empty-list.js";
import "./ak-library-application-list.js";
import "./ak-library-application-search-empty.js";
Expand Down Expand Up @@ -136,7 +137,10 @@ export class LibraryPage extends AKElement {
const selected = this.selectedApp?.slug;
const layout = this.uiConfig.layout as string;
const background = this.uiConfig.background;
const groupedApps = groupBy(this.filteredApps, (app) => app.group || "");
const groupedApps = groupBy(
this.filteredApps.filter(appHasLaunchUrl),
(app) => app.group || "",
);

return html`<ak-library-application-list
layout="${layout}"
Expand All @@ -152,6 +156,10 @@ export class LibraryPage extends AKElement {
></ak-library-application-search>`;
}

renderNoAppsFound() {
return html`<ak-library-application-search-empty></ak-library-application-search-empty>`;
}

renderSearchEmpty() {
return nothing;
}
Expand All @@ -162,10 +170,9 @@ export class LibraryPage extends AKElement {
?isadmin=${this.isAdmin}
></ak-library-application-empty-list>`;
}
if (this.filteredApps.length === 0) {
return html`<ak-library-application-search-empty></ak-library-application-search-empty>`;
}
return this.renderApps();
return this.filteredApps.some(appHasLaunchUrl) // prettier-ignore
? this.renderApps()
: this.renderNoAppsFound();
}

render() {
Expand Down

0 comments on commit fec46df

Please sign in to comment.