web/admin: fix source selection for identification stage (#13007)
closes #12995 Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -85,7 +85,7 @@ class SourceViewSet(
|
||||
serializer_class = SourceSerializer
|
||||
lookup_field = "slug"
|
||||
search_fields = ["slug", "name"]
|
||||
filterset_fields = ["slug", "name", "managed"]
|
||||
filterset_fields = ["slug", "name", "managed", "pbm_uuid"]
|
||||
|
||||
def get_queryset(self): # pragma: no cover
|
||||
return Source.objects.select_subclasses()
|
||||
|
||||
@ -25207,6 +25207,11 @@ paths:
|
||||
description: Number of results to return per page.
|
||||
schema:
|
||||
type: integer
|
||||
- in: query
|
||||
name: pbm_uuid
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- name: search
|
||||
required: false
|
||||
in: query
|
||||
|
||||
@ -27,13 +27,13 @@ export function sourcesSelector(instanceSources: string[] | undefined) {
|
||||
return async () => {
|
||||
const sourcesApi = new SourcesApi(DEFAULT_CONFIG);
|
||||
const sources = await Promise.allSettled(
|
||||
instanceSources.map((instanceId) =>
|
||||
sourcesApi.sourcesAllRetrieve({ slug: instanceId }),
|
||||
),
|
||||
instanceSources.map((instanceId) => sourcesApi.sourcesAllList({ pbmUuid: instanceId })),
|
||||
);
|
||||
return sources
|
||||
.filter((s) => s.status === "fulfilled")
|
||||
.map((s) => s.value)
|
||||
.filter((s) => s.pagination.count > 0)
|
||||
.map((s) => s.results[0])
|
||||
.map(sourceToSelect);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user