Skip to content

Commit

Permalink
UX improvement. Fetch props list.
Browse files Browse the repository at this point in the history
  • Loading branch information
artur committed Jan 19, 2024
1 parent eca7671 commit 19cc5c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
16 changes: 7 additions & 9 deletions web/frontend/src/components/Filter.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Box, Typography, useTheme } from "@mui/material";
import { Button } from "@mui/material";
import { tokens } from "../theme";
import React, { useEffect, useState } from "react";
import { QueryBuilderMaterial } from "@react-querybuilder/material";
import { QueryBuilder, formatQuery, parseCEL } from "react-querybuilder";
import {Box, useTheme} from "@mui/material";
import {tokens} from "../theme";
import React, {useEffect, useState} from "react";
import {QueryBuilderMaterial} from "@react-querybuilder/material";
import {formatQuery, parseCEL, QueryBuilder} from "react-querybuilder";
import "react-querybuilder/dist/query-builder.css";
import { BACKEND_URL } from "../AppConfig";
import { useSessionStorage } from "@uidotdev/usehooks";
import {useSessionStorage} from "@uidotdev/usehooks";

const operators = [
{ name: "=", label: "=" },
Expand Down Expand Up @@ -60,7 +58,7 @@ const Filter = () => {
}
});
console.log("updating filter component state");
}, []);
}, [globalProperties]);

const updateFilter = (q) => {
if (q == "") {
Expand Down
9 changes: 9 additions & 0 deletions web/frontend/src/scenes/dashboard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ const Dashboard = () => {
}
);

const fetchGlobalProperties = async () => {
const response = await fetch(BACKEND_URL + "/properties");
let data = await response.json();
let properties = data.map((prop) => prop.property);
setGlobalProperties(properties);
};


var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

Expand All @@ -63,6 +71,7 @@ const Dashboard = () => {
console.log("loading the dashboard");

fetchStatistics();
fetchGlobalProperties();
}, [filter]);

const handleClick = () => {
Expand Down

0 comments on commit 19cc5c9

Please sign in to comment.