Skip to content

Commit 14ac040

Browse files
authored
Merge pull request #5 from oslabs-beta/mvp
Mvp
2 parents 194185c + 81825c9 commit 14ac040

9 files changed

Lines changed: 28 additions & 26 deletions

File tree

app/components/Occupied/Occupied.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const Occupied = React.memo(() => {
5656
<div
5757
className="dashboardArea"
5858
>
59-
6059
<header className="mainHeader">
6160
<section
6261
className="header"

app/containers/DashboardContainer.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import '../stylesheets/Dashboard.scss';
1515
const DashboardContainer = React.memo(() => {
1616

1717
const [visible, setVisible] = useState(false);
18-
const [ example,setExample ] = useState(false);
19-
2018
/**
2119
* When DashBoard Container first mounted, visible is default to false, so that the Splash component can be stay visible.
2220
* After 4 seconds, set the DashBoard Container visibility to true
@@ -43,10 +41,8 @@ const DashboardContainer = React.memo(() => {
4341
<EventContextProvider>
4442
<QueryContextProvider>
4543
<AwsContextProvider>
46-
<SidebarContainer
47-
setExample={setExample}
48-
/>
49-
<MainContainer />
44+
<SidebarContainer />
45+
<MainContainer/>
5046
</AwsContextProvider>
5147
</QueryContextProvider>
5248
</EventContextProvider>

app/containers/GraphsContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ interface Params {
3030
service: string;
3131
}
3232

33-
const GraphsContainer: React.FC = React.memo(props => {
33+
const GraphsContainer: React.FC = React.memo(() => {
3434
const navigate = useNavigate();
3535
const { app, service } = useParams<keyof Params>() as Params;
3636
const [live, setLive] = useState<boolean>(false);

app/containers/MainContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import AwsGraphsContainer from '../containers/AWSGraphsContainer';
1313

1414
import '../stylesheets/MainContainer.scss';
1515

16-
const MainContainer = React.memo(() => {
16+
const MainContainer = React.memo((props) => {
1717
const { mode, applications } = useContext(DashboardContext);
1818
const currentModeCSS = mode === 'light' ? lightAndDark.lightModeMain : lightAndDark.darkModeMain;
1919

20+
2021
return (
2122
<>
2223
<div className="main-container" style={currentModeCSS}>

app/containers/SidebarContainer.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,16 @@ import SettingsIcon from '@material-ui/icons/Settings';
99
import '../stylesheets/SidebarContainer.scss';
1010
import { ApplicationContext } from '../context/ApplicationContext';
1111
import { AwsContext } from '../context/AwsContext';
12+
import { DashboardContext } from '../context/DashboardContext';
1213

13-
interface SidebarContainerProps {
14-
setExample:React.Dispatch<React.SetStateAction<boolean>>
15-
}
16-
17-
const SidebarContainer = React.memo((props:SidebarContainerProps) => {
18-
const { setExample } = props;
14+
const SidebarContainer = React.memo(() => {
1915

2016
// Extract invervalID from ApplicationContext. Initival value: intervalID = null
2117
const { intervalID } = useContext(ApplicationContext);
2218
// Extract isLoading and setLoading state from AwsContext. Initial value: isLoading = true
2319
const { isLoading, setLoadingState } = useContext(AwsContext);
2420
// clear interval and set loading state to true when leaving graph containers
25-
21+
const { addApp } = useContext(DashboardContext)
2622
/**
2723
* @function handleCLick - check if the 'intervalID' exists. If so, theres a timer running and the fuunction clears the timer using @function clearInterval - function.
2824
* Checks if variable 'isLoading' is false and if so the content is not loading and therefore, sets it to true using the setLoadingState function.
@@ -32,6 +28,17 @@ const SidebarContainer = React.memo((props:SidebarContainerProps) => {
3228
if (!isLoading) setLoadingState(true);
3329
};
3430

31+
const handleExample = () => {
32+
const fields = {
33+
typeOfService: 'Microservices',
34+
database: 'MongoDB',
35+
URI: "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.5",
36+
name: 'Example',
37+
description: 'Microservices'
38+
}
39+
addApp(fields)
40+
}
41+
3542
return (
3643
<div className="sidebar-container" id="mySidebar">
3744
<div className="sidebar">
@@ -90,10 +97,10 @@ const SidebarContainer = React.memo((props:SidebarContainerProps) => {
9097
/>
9198
&emsp;Contact
9299
</Link>
93-
<Link className="sidebar-link" to="/applications/:Mike/:service" id="dash" onClick={handleClick}>
100+
<Link className="sidebar-link" to="/" id="dash" onClick={handleClick}>
94101
<button
95102
className="example-button"
96-
onClick={() => setExample(true)}
103+
onClick={() => handleExample()}
97104
>
98105
EXAMPLE
99106
</button>

app/context/AwsContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface AwsAppInfo {
2323
}
2424

2525
const AwsContextProvider: React.FC<Props> = React.memo(({ children }) => {
26+
2627
const [awsData, setAwsData] = useState<AwsData>({ CPUUtilization: [], NetworkIn: [], NetworkOut: [], DiskReadBytes: [] })
2728
const [awsEcsData, setAwsEcsData] = useState<any>({});
2829
const [awsEksData, setAwsEksData] = useState<any>({});

app/context/DashboardContext.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const DashboardContextProvider = React.memo((props: any) => {
4444
// Initial user will always be the guest
4545
const [user, setUser] = useState<string>('guest');
4646
const [applications, setApplications] = useState<string[][]>([]);
47+
console.log({applications})
4748
const [mode, setMode] = useState<string>('light');
4849

4950

@@ -54,16 +55,12 @@ const DashboardContextProvider = React.memo((props: any) => {
5455

5556
const addApp = useCallback((fields: IFields) => {
5657
const { typeOfService, database, URI, name, description } = fields;
57-
const newApp = [name, database, URI, description, typeOfService];
58-
console.log('what is the service that was passed into add app: ', typeOfService)
58+
5959
const result = ipcRenderer.sendSync(
6060
'addApp',
6161
JSON.stringify([name, database, URI, description, typeOfService])
6262
);
6363
setApplications(result);
64-
// console.log('applications: ', applications);
65-
// console.log('new app to add: ', newApp);
66-
// setApplications([...applications, newApp]);
6764
console.log('the current application that was added is : ', result);
6865
}, []);
6966

@@ -101,7 +98,7 @@ const DashboardContextProvider = React.memo((props: any) => {
10198
deleteApp,
10299
mode,
103100
setMode,
104-
changeMode,
101+
changeMode
105102
}}
106103
>
107104
{children}

app/modals/EnvModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Button, Typography } from '@material-ui/core';
2+
import { Typography } from '@material-ui/core';
33
import '../stylesheets/EnvModal.scss';
44
import { CloudQueue, Computer } from '@material-ui/icons';
55
import { TModalSetter } from '../components/Occupied/types/Occupied';

app/stylesheets/SidebarContainer.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@
233233
.example-button {
234234
height:100px;
235235
width:100px;
236-
color:yellow;
236+
color:whitesmoke;
237237
cursor:pointer;
238+
font-weight: 600;
238239
}
239240

240241
.example-button:hover {

0 commit comments

Comments
 (0)