using prefix search for team list and user list pages

This commit is contained in:
Carter 2025-03-06 10:33:16 -06:00
parent 311acc4761
commit 6886c93760
5 changed files with 13 additions and 9 deletions

View file

@ -130,7 +130,6 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
}); });
useEffect(() => { useEffect(() => {
console.log(filterList)
localStorage.setItem(filterKey, JSON.stringify(filterList)); localStorage.setItem(filterKey, JSON.stringify(filterList));
}, [filterList]) }, [filterList])

View file

@ -134,7 +134,7 @@ export default function Users() {
const loadUsers = () => { const loadUsers = () => {
setIsLoading(true) setIsLoading(true)
userAPI.listUsers(pageSize, page*pageSize, "desc", "name", searchText).then(resp => { userAPI.listUsers(pageSize, page*pageSize, "desc", "name", undefined, searchText).then(resp => {
let r: User[] = [] let r: User[] = []
resp.users.forEach((user, _index) => { resp.users.forEach((user, _index) => {
r.push(user) r.push(user)

View file

@ -27,7 +27,8 @@ export interface ITeamAPIContext {
orderBy?: string, orderBy?: string,
search?: string, search?: string,
asRoot?: boolean, asRoot?: boolean,
as?: string as?: string,
prefixSearch?: string,
) => Promise<AxiosResponse<pond.ListTeamsResponse>>; ) => Promise<AxiosResponse<pond.ListTeamsResponse>>;
listAllTeams: () => Promise<AxiosResponse<pond.ListTeamsResponse>>; listAllTeams: () => Promise<AxiosResponse<pond.ListTeamsResponse>>;
listObjectTeams: (scope: Scope, as?: string) => Promise<any>; listObjectTeams: (scope: Scope, as?: string) => Promise<any>;
@ -113,7 +114,8 @@ export default function TeamProvider(props: PropsWithChildren<Props>) {
orderBy?: string, orderBy?: string,
search?: string, search?: string,
asRoot?: boolean, asRoot?: boolean,
as?: string as?: string,
prefixSearch?: string,
) => { ) => {
//let asText = team ? "&as=" + team.key() : ""; //let asText = team ? "&as=" + team.key() : "";
let url = pondURL( let url = pondURL(
@ -125,6 +127,7 @@ export default function TeamProvider(props: PropsWithChildren<Props>) {
("&order=" + or(order, "asc")) + ("&order=" + or(order, "asc")) +
("&by=" + or(orderBy, "key")) + ("&by=" + or(orderBy, "key")) +
(search ? "&search=" + search : "") + (search ? "&search=" + search : "") +
(prefixSearch ? "&prefixSearch=" + prefixSearch : "") +
(asRoot ? "&asRoot=" + asRoot.toString() : "") + (asRoot ? "&asRoot=" + asRoot.toString() : "") +
(as ? "&as=" + as : "") (as ? "&as=" + as : "")
) )

View file

@ -24,7 +24,8 @@ export interface IUserAPIContext {
offset: number, offset: number,
order?: "asc" | "desc", order?: "asc" | "desc",
by?: string, by?: string,
search?: string search?: string,
prefixSearch?: string,
) => Promise<ListUsersResponse>; ) => Promise<ListUsersResponse>;
listProfiles: () => Promise<pond.UserProfile[]>; listProfiles: () => Promise<pond.UserProfile[]>;
listObjectUsers: (scope: Scope) => Promise<any>; listObjectUsers: (scope: Scope) => Promise<any>;
@ -62,7 +63,8 @@ export default function UserProvider(props: PropsWithChildren<any>) {
offset: number, offset: number,
order?: "asc" | "desc", order?: "asc" | "desc",
by?: string, by?: string,
search?: string search?: string,
prefixSearch?: string,
): Promise<ListUsersResponse> => { ): Promise<ListUsersResponse> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
get( get(
@ -73,7 +75,8 @@ export default function UserProvider(props: PropsWithChildren<any>) {
offset + offset +
("&order=" + (order ? order : "asc")) + ("&order=" + (order ? order : "asc")) +
("&by=" + (by ? by : "name")) + ("&by=" + (by ? by : "name")) +
(search ? "&search=" + search : "") (search ? "&search=" + search : "") +
(prefixSearch ? "&prefixSearch=" + prefixSearch : "")
) )
) )
.then((res: any) => { .then((res: any) => {

View file

@ -73,9 +73,8 @@ export default function TeamList() {
setLoading(true); setLoading(true);
let newTeamPerms: Map<string | number, pond.Permission[]> = new Map(); let newTeamPerms: Map<string | number, pond.Permission[]> = new Map();
let newTeamPrefs: Map<string | number, pond.TeamPreferences> = new Map(); let newTeamPrefs: Map<string | number, pond.TeamPreferences> = new Map();
let searchString = search;
teamAPI teamAPI
.listTeams(limit, limit * page, undefined, "name", searchString, undefined, as) .listTeams(limit, limit * page, undefined, "name", undefined, undefined, as, search)
.then(resp => { .then(resp => {
setTotal(resp.data.total ? resp.data.total : 0); setTotal(resp.data.total ? resp.data.total : 0);
let newTeams: Team[] = [] let newTeams: Team[] = []