Skip to content

Add date filters and refactor quality metrics#111

Merged
ackermannW merged 1 commit intosecomind:mainfrom
AmerMesanovic:filters
Feb 19, 2026
Merged

Add date filters and refactor quality metrics#111
ackermannW merged 1 commit intosecomind:mainfrom
AmerMesanovic:filters

Conversation

@AmerMesanovic
Copy link
Copy Markdown
Collaborator

@AmerMesanovic AmerMesanovic commented Feb 17, 2026

Integrated date range presets (Day, Week, Month, Year).Refactored quality statistics into a standalone StatsOverview component

Screen:
image

Closes #81

Comment thread oobe-apps/industrial-app/src/App.tsx Outdated
const [dataFetching, setDataFetching] = useState(false);
const [imageIds, setImageIds] = useState<string[]>([]);
const [allData, setAllData] = useState<any[]>([]);
const [imageIds, setImageIds] = useState<Record<string, ImageData>>({});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a leftover from previous iteration of this PR. We should rename this variable from imageIds to imagesRecords or something similar.

@AmerMesanovic AmerMesanovic force-pushed the filters branch 5 times, most recently from 559c73b to c36bb5f Compare February 18, 2026 12:12
@ackermannW ackermannW requested a review from Emina-M February 18, 2026 12:19
Comment on lines +50 to +55
const response = await this.axiosInstance.get(
`v1/${realm}/devices/${deviceId}/interfaces/com.oobe.quality.Inspection`,
{ params },
);

return response.data?.data ?? {};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add params without changing data handling logic.

): Promise<Record<string, ImageData>> {
const { realm } = this.config;

const params: any = {};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const params: any = {};
const params: Record<string, string> = {};

Comment thread oobe-apps/industrial-app/src/App.tsx Outdated
import { isRangePreset, presetToDateRange } from "./components/RangeSelect";
import StatsOverview from "./components/StatsOverview";
import IndustrialBarChart from "./components/IndustrialBarChart";
import { ImageData as AstarteImageData } from "types";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name ImageData does not clash with anything, we don't need an alias for it. Same goes for its import in other files.

Comment thread oobe-apps/industrial-app/src/App.tsx Outdated
const [dataFetching, setDataFetching] = useState(false);
const [imagesData, setImagesData] = useState<Record<string, ImageData>>({});
const [allData, setAllData] = useState<AstarteImageData[]>([]);
const [imagesRecords, setImageRecord] = useState<
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert renaming this state variable.

Comment thread oobe-apps/industrial-app/src/App.tsx Outdated
Comment on lines +42 to +60
try {
const imageRecords = await astarteClient.getImagesData(
deviceId,
since,
to,
);
setImageRecord(imageRecords);
const keys = Object.keys(imageRecords);
if (keys.length === 0) {
setAllData([]);
return;
}
const formattedData = Object.values(imageRecords);
setAllData(formattedData);
} catch (e: any) {
setError(e.message || "Error fetching data");
} finally {
setDataFetching(false);
}
Copy link
Copy Markdown
Collaborator

@Emina-M Emina-M Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of extracting fetching data to its own function outside of useEffect, but you should build your code on top of existing code for calling astarteClient.getImagesData().

Comment thread oobe-apps/industrial-app/src/App.tsx Outdated
<Container
fluid
className="p-4"
style={{ backgroundColor: "#fbfbfc", minHeight: "100vh" }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifying backgroundColor is unnecessary.

Comment thread oobe-apps/industrial-app/package.json Outdated
"@formatjs/intl": "^4.1.2",
"@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@fortawesome/react-fontawesome": "^0.2.2",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a newer version of this package because this one gives a deprecated warning.

@AmerMesanovic AmerMesanovic force-pushed the filters branch 5 times, most recently from c4899ab to 905df54 Compare February 18, 2026 15:15
Integrated date range presets (Day, Week, Month, Year).Refactored quality statistics into a standalone StatsOverview component

Signed-off-by: AmerMesanovic <amer.mesanovic@secomind.com>
@ackermannW ackermannW merged commit 28b3acd into secomind:main Feb 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement aggregated values component in the industrial app

3 participants