added fields page data api call

This commit is contained in:
csawatzky 2025-08-22 09:39:20 -06:00
parent 96958c12a0
commit 3567190c3a
3 changed files with 37 additions and 4 deletions

2
package-lock.json generated
View file

@ -10911,7 +10911,7 @@
},
"node_modules/protobuf-ts": {
"version": "1.0.0",
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#37e19bde4218b369e028606c009729112668ccc6",
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#1b6076608722fff5290457b077604bb0b38d5499",
"dependencies": {
"protobufjs": "^6.8.8"
}

View file

@ -118,7 +118,7 @@ export default function BinsList(props: Props) {
xs: 6,
sm: 4,
md: 3,
lg: 2,
lg: 1.5,
}}
key={i}
className={classes.gridListTile}

View file

@ -18,13 +18,21 @@ export interface IFieldAPIContext {
otherTeam?: string,
asRoot?: boolean
) => Promise<AxiosResponse<pond.ListFieldsResponse>>;
fieldsPageData: (
limit: number,
offset: number,
order?: "asc" | "desc",
orderBy?: string,
search?: string,
otherTeam?: string,
) => Promise<AxiosResponse<pond.ListFieldsPageDataResponse>>
removeField: (key: string, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveFieldResponse>>;
updateField: (
key: string,
field: pond.FieldSettings,
asRoot?: true,
otherTeam?: string
) => Promise<AxiosResponse<pond.UpdateSiteResponse>>;
) => Promise<AxiosResponse<pond.UpdateFieldResponse>>;
}
export const FieldAPIContext = createContext<IFieldAPIContext>({} as IFieldAPIContext);
@ -80,6 +88,30 @@ export default function FieldProvider(props: PropsWithChildren<Props>) {
);
};
const fieldsPageData = (
limit: number,
offset: number,
order?: "asc" | "desc",
orderBy?: string,
search?: string,
otherTeam?: string,
) => {
const view = otherTeam ? otherTeam : as
return get<pond.ListFieldsPageDataResponse>(
pondURL(
"/fieldsPage" +
"?limit=" +
limit +
"&offset=" +
offset +
("&order=" + or(order, "asc")) +
("&by=" + or(orderBy, "key")) +
(view ? "&as=" + view : "") +
(search ? "&search=" + search : "")
)
);
}
const updateField = (key: string, field: pond.FieldSettings, asRoot?: boolean, otherTeam?: string) => {
const view = otherTeam ? otherTeam : as
if (view)
@ -100,7 +132,8 @@ export default function FieldProvider(props: PropsWithChildren<Props>) {
getField,
listFields,
removeField,
updateField
updateField,
fieldsPageData
}}>
{children}
</FieldAPIContext.Provider>