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(() => {
console.log(filterList)
localStorage.setItem(filterKey, JSON.stringify(filterList));
}, [filterList])

View file

@ -134,7 +134,7 @@ export default function Users() {
const loadUsers = () => {
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[] = []
resp.users.forEach((user, _index) => {
r.push(user)

View file

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

View file

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

View file

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