Merge branch 'main' into dev
* main: core: applications api: prefetch related policies (#10273) web: restore hasLaunchUrl to client-side criteria for filtering apps (#10291)
This commit is contained in:
@ -103,7 +103,7 @@ class ApplicationSerializer(ModelSerializer):
|
|||||||
class ApplicationViewSet(UsedByMixin, ModelViewSet):
|
class ApplicationViewSet(UsedByMixin, ModelViewSet):
|
||||||
"""Application Viewset"""
|
"""Application Viewset"""
|
||||||
|
|
||||||
queryset = Application.objects.all().prefetch_related("provider")
|
queryset = Application.objects.all().prefetch_related("provider").prefetch_related("policies")
|
||||||
serializer_class = ApplicationSerializer
|
serializer_class = ApplicationSerializer
|
||||||
search_fields = [
|
search_fields = [
|
||||||
"name",
|
"name",
|
||||||
|
@ -13,6 +13,7 @@ import styles from "./LibraryPageImpl.css";
|
|||||||
|
|
||||||
import type { Application } from "@goauthentik/api";
|
import type { Application } from "@goauthentik/api";
|
||||||
|
|
||||||
|
import { appHasLaunchUrl } from "./LibraryPageImpl.utils";
|
||||||
import "./ak-library-application-empty-list.js";
|
import "./ak-library-application-empty-list.js";
|
||||||
import "./ak-library-application-list.js";
|
import "./ak-library-application-list.js";
|
||||||
import "./ak-library-application-search-empty.js";
|
import "./ak-library-application-search-empty.js";
|
||||||
@ -136,7 +137,10 @@ export class LibraryPage extends AKElement {
|
|||||||
const selected = this.selectedApp?.slug;
|
const selected = this.selectedApp?.slug;
|
||||||
const layout = this.uiConfig.layout as string;
|
const layout = this.uiConfig.layout as string;
|
||||||
const background = this.uiConfig.background;
|
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
|
return html`<ak-library-application-list
|
||||||
layout="${layout}"
|
layout="${layout}"
|
||||||
@ -152,6 +156,10 @@ export class LibraryPage extends AKElement {
|
|||||||
></ak-library-application-search>`;
|
></ak-library-application-search>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderNoAppsFound() {
|
||||||
|
return html`<ak-library-application-search-empty></ak-library-application-search-empty>`;
|
||||||
|
}
|
||||||
|
|
||||||
renderSearchEmpty() {
|
renderSearchEmpty() {
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
@ -162,10 +170,9 @@ export class LibraryPage extends AKElement {
|
|||||||
?isadmin=${this.isAdmin}
|
?isadmin=${this.isAdmin}
|
||||||
></ak-library-application-empty-list>`;
|
></ak-library-application-empty-list>`;
|
||||||
}
|
}
|
||||||
if (this.filteredApps.length === 0) {
|
return this.filteredApps.some(appHasLaunchUrl) // prettier-ignore
|
||||||
return html`<ak-library-application-search-empty></ak-library-application-search-empty>`;
|
? this.renderApps()
|
||||||
}
|
: this.renderNoAppsFound();
|
||||||
return this.renderApps();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Reference in New Issue
Block a user