fix: exclude reserved users from global search results (#7486)

* fix: exclude reserved users from global search results

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Use labelSelector

Signed-off-by: Ryan Wang <i@ryanc.cc>

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/7494/head v2.21.0-alpha.2
Ryan Wang 2025-05-31 22:49:03 +08:00 committed by GitHub
parent f80487b1d5
commit c6f19a233f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 14 deletions

View File

@ -77,23 +77,27 @@ const handleBuildSearchIndex = () => {
}); });
if (currentUserHasPermission(["system:users:view"])) { if (currentUserHasPermission(["system:users:view"])) {
coreApiClient.user.listUser().then((response) => { coreApiClient.user
response.data.items.forEach((user) => { .listUser({
fuse.add({ labelSelector: ["!halo.run/hidden-user"],
title: user.spec.displayName, })
icon: { .then((response) => {
component: markRaw(IconUserSettings), response.data.items.forEach((user) => {
}, fuse.add({
group: t("core.components.global_search.groups.user"), title: user.spec.displayName,
route: { icon: {
name: "UserDetail", component: markRaw(IconUserSettings),
params: {
name: user.metadata.name,
}, },
}, group: t("core.components.global_search.groups.user"),
route: {
name: "UserDetail",
params: {
name: user.metadata.name,
},
},
});
}); });
}); });
});
} }
if (currentUserHasPermission(["system:plugins:view"])) { if (currentUserHasPermission(["system:plugins:view"])) {