devices list page now uses prefix search to match results better
This commit is contained in:
parent
3732d76156
commit
6360cba756
2 changed files with 7 additions and 3 deletions
|
|
@ -198,7 +198,7 @@ export default function Devices() {
|
|||
page*limit,
|
||||
order,
|
||||
orderBy,
|
||||
search,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
|
|
@ -208,6 +208,7 @@ export default function Devices() {
|
|||
getKeys(),
|
||||
getTypes(),
|
||||
fieldContains,
|
||||
search,
|
||||
).then(resp => {
|
||||
let newDevices: Device[] = []
|
||||
resp.data.devices.forEach(device => {
|
||||
|
|
@ -225,7 +226,7 @@ export default function Devices() {
|
|||
|
||||
useEffect(() => {
|
||||
loadDevices()
|
||||
}, [limit, page, order, orderBy, fieldContains, tab])
|
||||
}, [limit, page, order, orderBy, fieldContains, search, tab])
|
||||
|
||||
useEffect(() => {
|
||||
loadGroups()
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ export interface IDeviceAPIContext {
|
|||
keys?: string[],
|
||||
types?: string[],
|
||||
fieldContains?: Map<string, string>,
|
||||
prefixSearch?: string,
|
||||
) => Promise<AxiosResponse<pond.ListDevicesResponse>>;
|
||||
listForUser: (
|
||||
asRoot: boolean,
|
||||
|
|
@ -305,6 +306,7 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
keys?: string[],
|
||||
types?: string[],
|
||||
fieldContains?: Map<string, string>,
|
||||
prefixSearch?: string,
|
||||
) => {
|
||||
const url = pondURL(
|
||||
"/devices" +
|
||||
|
|
@ -324,7 +326,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
(withMeasurements ? "&measurements=" + withMeasurements.toString() : "") +
|
||||
(keys ? "&keys=" + keys.toString() : "") +
|
||||
(types ? "&types=" + types.toString() : "") +
|
||||
(fieldContains ? "&fieldContains=" + JSON.stringify(Object.fromEntries(fieldContains)) : "")
|
||||
(fieldContains ? "&fieldContains=" + JSON.stringify(Object.fromEntries(fieldContains)) : "") +
|
||||
(prefixSearch ? "&prefixSearch=" + prefixSearch : "")
|
||||
);
|
||||
return new Promise<AxiosResponse<pond.ListDevicesResponse>>((resolve, reject)=>{
|
||||
get<pond.ListDevicesResponse>(url).then(resp => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue