Skip to content

Commit

Permalink
feat(chart): Add Location filter
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Jan 17, 2023
1 parent d4f23ee commit 225a91e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ui/src/scenes/chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const Chart = () => {
const apps = [...new Set(d.versions.map((i) => i.application.name))].filter(
(n) => n.length > 0
);
const locs = [...new Set(d.versions.map((i) => i.location.name))].filter(
(n) => n.length > 0
);

// Create empty data list
let format = getDates(new Date(minDate), new Date(maxDate));
Expand Down Expand Up @@ -81,8 +84,11 @@ const Chart = () => {

return {
versions: Object.values(format),
envs: envs,
apps: apps,
keys: {
environment: envs,
application: apps,
location: locs,
},
};
};

Expand All @@ -99,6 +105,9 @@ const Chart = () => {
environment {
name
}
location {
name
}
version
}
}
Expand Down Expand Up @@ -136,6 +145,7 @@ const Chart = () => {
>
<MenuItem value="environment">Environment</MenuItem>
<MenuItem value="application">Application</MenuItem>
<MenuItem value="location">Location</MenuItem>
</Select>
</FormControl>
</Box>
Expand All @@ -144,7 +154,7 @@ const Chart = () => {
theme={nivoTheme}
colors={{ scheme: "purple_orange" }}
data={data?.versions}
keys={chartContent === "environment" ? data.envs : data.apps}
keys={data.keys[chartContent]}
indexBy="key"
margin={{ top: 50, right: 130, bottom: 150, left: 60 }}
axisBottom={{ tickRotation: 45 }}
Expand Down

0 comments on commit 225a91e

Please sign in to comment.