Skip to content

Commit 0c483b7

Browse files
committed
The selected metrics state is now in sidebar container
This state was included in the reset list on handleExit When handle exit is clicked it now brings the user back to the main dashboard page
1 parent 43e0b09 commit 0c483b7

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

app/containers/SidebarContainer/SidebarContainer.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useContext } from 'react';
2-
import { Link } from 'react-router-dom';
2+
import { Link,useNavigate } from 'react-router-dom';
33

44
import ListIcon from '@mui/icons-material/List';
55
import InfoIcon from '@mui/icons-material/Info';
@@ -10,6 +10,7 @@ import './styles.scss';
1010
import { ApplicationContext } from '../../context/ApplicationContext';
1111
import { AwsContext } from '../../context/AwsContext';
1212
import { DashboardContext } from '../../context/DashboardContext';
13+
import { QueryContext } from '../../context/QueryContext';
1314

1415
const SidebarContainer = React.memo(() => {
1516
// Extract invervalID from ApplicationContext. Initival value: intervalID = null
@@ -18,6 +19,9 @@ const SidebarContainer = React.memo(() => {
1819
const { isLoading, setLoadingState } = useContext(AwsContext);
1920
// clear interval and set loading state to true when leaving graph containers
2021
const { addApp,setApplications,deleteApp } = useContext(DashboardContext)
22+
const { setSelectedMetrics } = useContext(QueryContext)
23+
24+
const navigate = useNavigate();
2125

2226
/**
2327
* @function handleCLick - check if the 'intervalID' exists. If so, theres a timer running and the fuunction clears the timer using @function clearInterval - function.
@@ -68,13 +72,15 @@ const SidebarContainer = React.memo(() => {
6872
}
6973

7074
const handleExitExample = () => {
75+
7176
setExample(false)
72-
// setApplications([])
7377
setAppIndex(0);
7478
setApp('');
7579
setServicesData([]);
76-
setChart('communications')
80+
setChart('all')
7781
deleteApp(0,'all')
82+
setSelectedMetrics([])
83+
navigate("/")
7884
}
7985

8086
return (

0 commit comments

Comments
 (0)