forked from baron/baron-sso
devfront 관계 탭 사용자 검색·다중선택 UX 개선
This commit is contained in:
@@ -58,6 +58,16 @@ export type ClientRelation = {
|
||||
subject: string;
|
||||
subjectType: string;
|
||||
subjectId: string;
|
||||
userName?: string;
|
||||
userEmail?: string;
|
||||
userLoginId?: string;
|
||||
};
|
||||
|
||||
export type DevAssignableUser = {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string;
|
||||
loginId?: string;
|
||||
};
|
||||
|
||||
export type AuditLog = {
|
||||
@@ -75,6 +85,7 @@ export type DevApiMockState = {
|
||||
clients: Client[];
|
||||
consents: Consent[];
|
||||
relations?: Record<string, ClientRelation[]>;
|
||||
users?: DevAssignableUser[];
|
||||
auditLogsByCursor?: Record<
|
||||
string,
|
||||
{ items: AuditLog[]; next_cursor?: string }
|
||||
@@ -261,6 +272,20 @@ export async function installDevApiMock(page: Page, state: DevApiMockState) {
|
||||
});
|
||||
}
|
||||
|
||||
if (pathname === "/api/v1/dev/users" && method === "GET") {
|
||||
const search = (searchParams.get("search") || "").toLowerCase();
|
||||
const limit = Number.parseInt(searchParams.get("limit") || "10", 10);
|
||||
const items = (state.users ?? [])
|
||||
.filter((user) => {
|
||||
if (!search) return true;
|
||||
return [user.name, user.email, user.loginId ?? ""].some((value) =>
|
||||
value.toLowerCase().includes(search),
|
||||
);
|
||||
})
|
||||
.slice(0, Number.isFinite(limit) ? limit : 10);
|
||||
return json(route, { items });
|
||||
}
|
||||
|
||||
if (pathname === "/api/v1/dev/clients" && method === "POST") {
|
||||
const payload = (request.postDataJSON() as {
|
||||
name?: string;
|
||||
|
||||
Reference in New Issue
Block a user