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,
|
page*limit,
|
||||||
order,
|
order,
|
||||||
orderBy,
|
orderBy,
|
||||||
search,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
@ -208,6 +208,7 @@ export default function Devices() {
|
||||||
getKeys(),
|
getKeys(),
|
||||||
getTypes(),
|
getTypes(),
|
||||||
fieldContains,
|
fieldContains,
|
||||||
|
search,
|
||||||
).then(resp => {
|
).then(resp => {
|
||||||
let newDevices: Device[] = []
|
let newDevices: Device[] = []
|
||||||
resp.data.devices.forEach(device => {
|
resp.data.devices.forEach(device => {
|
||||||
|
|
@ -225,7 +226,7 @@ export default function Devices() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDevices()
|
loadDevices()
|
||||||
}, [limit, page, order, orderBy, fieldContains, tab])
|
}, [limit, page, order, orderBy, fieldContains, search, tab])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadGroups()
|
loadGroups()
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ export interface IDeviceAPIContext {
|
||||||
keys?: string[],
|
keys?: string[],
|
||||||
types?: string[],
|
types?: string[],
|
||||||
fieldContains?: Map<string, string>,
|
fieldContains?: Map<string, string>,
|
||||||
|
prefixSearch?: string,
|
||||||
) => Promise<AxiosResponse<pond.ListDevicesResponse>>;
|
) => Promise<AxiosResponse<pond.ListDevicesResponse>>;
|
||||||
listForUser: (
|
listForUser: (
|
||||||
asRoot: boolean,
|
asRoot: boolean,
|
||||||
|
|
@ -305,6 +306,7 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
||||||
keys?: string[],
|
keys?: string[],
|
||||||
types?: string[],
|
types?: string[],
|
||||||
fieldContains?: Map<string, string>,
|
fieldContains?: Map<string, string>,
|
||||||
|
prefixSearch?: string,
|
||||||
) => {
|
) => {
|
||||||
const url = pondURL(
|
const url = pondURL(
|
||||||
"/devices" +
|
"/devices" +
|
||||||
|
|
@ -324,7 +326,8 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
||||||
(withMeasurements ? "&measurements=" + withMeasurements.toString() : "") +
|
(withMeasurements ? "&measurements=" + withMeasurements.toString() : "") +
|
||||||
(keys ? "&keys=" + keys.toString() : "") +
|
(keys ? "&keys=" + keys.toString() : "") +
|
||||||
(types ? "&types=" + types.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)=>{
|
return new Promise<AxiosResponse<pond.ListDevicesResponse>>((resolve, reject)=>{
|
||||||
get<pond.ListDevicesResponse>(url).then(resp => {
|
get<pond.ListDevicesResponse>(url).then(resp => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue