Skip to content

Commit f39e323

Browse files
committed
card name css changed
1 parent a585343 commit f39e323

File tree

10 files changed

+177
-119
lines changed

10 files changed

+177
-119
lines changed

app/components/Occupied.tsx

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
Typography,
2020
} from '@material-ui/core';
2121

22-
2322
import { makeStyles } from '@material-ui/core/styles';
2423
import { BaseCSSProperties } from '@material-ui/core/styles/withStyles';
2524

@@ -32,7 +31,6 @@ import Badge from '@material-ui/core/Badge';
3231
import PersonIcon from '@material-ui/icons/Person';
3332
import UpdateIcon from '@material-ui/icons/Update';
3433

35-
3634
// // MODALS
3735
import AddModal from '../modals/AddModal';
3836
import ProfileContainer from '../containers/ProfileContainer';
@@ -49,38 +47,37 @@ import { CommsContext } from '../context/CommsContext';
4947

5048
// TYPESCRIPT
5149
interface StyleProps {
52-
root: BaseCSSProperties;
53-
}
54-
type ClickEvent = React.MouseEvent<HTMLElement>;
55-
50+
root: BaseCSSProperties;
51+
}
52+
type ClickEvent = React.MouseEvent<HTMLElement>;
5653

5754
const Occupied = React.memo(() => {
58-
const { setServicesData } = useContext(ApplicationContext);
55+
const { setServicesData, app, setApp } = useContext(ApplicationContext);
5956
const { user, applications, getApplications, deleteApp, mode } = useContext(DashboardContext);
6057
const { commsData } = useContext(CommsContext);
6158
const [serviceModalOpen, setServiceModalOpen] = useState<boolean>(false);
6259
const [addModalOpen, setAddModalOpen] = useState<boolean>(false);
6360
const [personModalOpen, setPersonModalOpen] = useState<boolean>(false);
6461
const [index, setIndex] = useState<number>(0);
65-
const [app, setApp] = useState<string>('');
62+
// const [app, setApp] = useState<string>('');
6663
const [searchTerm, setSearchTerm] = useState<string>('');
6764
const [clickedAt, setClickedAt] = useState<string>('2000-01-01T00:00:00Z');
68-
65+
6966
// Grab services and applications whenever the user changes
7067
useEffect(() => {
7168
setServicesData([]);
7269
getApplications();
73-
}, [ user ]);
70+
}, [user]);
7471

7572
// Dynamic refs
7673
const delRef = useRef<any>([]);
77-
74+
7875
// Asks user to confirm deletion
7976
const confirmDelete = (event: ClickEvent, application: string, i: number) => {
8077
const message = `The application '${app}' will be permanently deleted. Continue?`;
8178
if (confirm(message)) deleteApp(i);
8279
};
83-
80+
8481
// Handle clicks on Application cards
8582
const handleClick = (event: ClickEvent, selectedApp: string, i: number) => {
8683
if (delRef.current[i] && !delRef.current[i].contains(event.target)) {
@@ -249,7 +246,11 @@ const Occupied = React.memo(() => {
249246
You have {notification ? notification.length : 0} new alerts
250247
</span>
251248
<NotificationsIcon className="navIcon" id="notificationsIcon" />
252-
<Badge overlap="rectangular" badgeContent={notification ? notification.length : 0} color="secondary" />
249+
<Badge
250+
overlap="rectangular"
251+
badgeContent={notification ? notification.length : 0}
252+
color="secondary"
253+
/>
253254
</div>
254255
<div className="personIconArea">
255256
<Button className="personTooltip" onClick={() => setPersonModalOpen(true)}>
@@ -267,61 +268,66 @@ const Occupied = React.memo(() => {
267268
</Button>
268269
</div>
269270
{applications &&
270-
applications.filter((db: any) => db[0].toLowerCase().includes(searchTerm.toLowerCase()))
271-
.map((application: string[], i: number | any | string | undefined) => (
272-
<div className="card" key={`card-${i}`} id={`card-${application[1]}`}>
273-
<Card
274-
key={`card-${i}`}
275-
className={classes.paper}
276-
variant="outlined"
277-
onClick={event => handleClick(event, application[0], i)}
278-
>
279-
<div className="databaseIconContainer">
280-
<div className="databaseIconHeader">
281-
{application[1] === 'SQL' ? (
282-
<img className="databaseIcon" alt="SQL" />
283-
) : (
284-
<img className="databaseIcon" alt="MongoDB" />
285-
)}
271+
applications
272+
.filter((db: any) => db[0].toLowerCase().includes(searchTerm.toLowerCase()))
273+
.map((application: string[], i: number | any | string | undefined) => (
274+
<div className="card" key={`card-${i}`} id={`card-${application[1]}`}>
275+
<Card
276+
key={`card-${i}`}
277+
className={classes.paper}
278+
variant="outlined"
279+
onClick={event => handleClick(event, application[0], i)}
280+
>
281+
<div className="databaseIconContainer">
282+
<div className="databaseIconHeader">
283+
{application[1] === 'SQL' ? (
284+
<img className="databaseIcon" alt="SQL" />
285+
) : (
286+
<img className="databaseIcon" alt="MongoDB" />
287+
)}
288+
</div>
286289
</div>
287-
</div>
288290

289-
<CardHeader
290-
avatar={
291-
<IconButton
292-
id="iconButton"
293-
ref={element => {
294-
delRef.current[i] = element;
295-
}}
296-
className={classes.iconbutton}
297-
aria-label="Delete"
298-
onClick={event => confirmDelete(event, application[0], i)}
299-
>
300-
<HighlightOffIcon
301-
className={classes.btnStyle}
302-
id="deleteIcon"
291+
<CardHeader
292+
avatar={
293+
<IconButton
294+
id="iconButton"
303295
ref={element => {
304296
delRef.current[i] = element;
305297
}}
306-
/>
307-
</IconButton>
308-
}
309-
/>
310-
<CardContent>
311-
<p id="databaseName">Database Name:</p>
312-
<Typography className={classes.fontStyles}>{application[0]}</Typography>
313-
</CardContent>
314-
<hr className="cardLine" />
298+
className={classes.iconbutton}
299+
aria-label="Delete"
300+
onClick={event => confirmDelete(event, application[0], i)}
301+
>
302+
<HighlightOffIcon
303+
className={classes.btnStyle}
304+
id="deleteIcon"
305+
ref={element => {
306+
delRef.current[i] = element;
307+
}}
308+
/>
309+
</IconButton>
310+
}
311+
/>
312+
<CardContent>
313+
{/* <p id="databaseName">Name:</p> */}
314+
<Typography id="databaseName" className={classes.fontStyles}>
315+
{application[0]}
316+
</Typography>
317+
<p id="serviceName">Service:</p>
318+
<Typography className={classes.fontStyles}>{application[3]}</Typography>
319+
</CardContent>
320+
<hr className="cardLine" />
315321

316-
<div className="cardFooter">
317-
<UpdateIcon className="cardFooterIcon" />
318-
<em>
319-
<p id="cardFooterText">{application[3]}</p>
320-
</em>
321-
</div>
322-
</Card>
323-
</div>
324-
))}
322+
<div className="cardFooter">
323+
<UpdateIcon className="cardFooterIcon" />
324+
<em>
325+
<p id="cardFooterText">{application[4]}</p>
326+
</em>
327+
</div>
328+
</Card>
329+
</div>
330+
))}
325331

326332
<Modal open={addModalOpen} onClose={() => setAddModalOpen(false)}>
327333
<AddModal setOpen={setAddModalOpen} />

app/components/Splash.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React, { useState, useEffect } from 'react';
22
import '../stylesheets/Splash.scss';
33

4-
const Splash: React.FC = React.memo((props) => {
5-
const [visible, setVisible] = useState(true);
6-
useEffect(() => {
7-
setTimeout(() => setVisible(false), 4000);
8-
}, []);
4+
const Splash: React.FC = React.memo(props => {
5+
const [visible, setVisible] = useState(false);
6+
// useEffect(() => {
7+
// setTimeout(() => setVisible(false), 4000);
8+
// }, []);
99

1010
return (
1111
<>
12-
{visible &&
13-
<div id="splash">
12+
{visible && (
13+
<div id="splash">
1414
<img id="splashLogo" src="../assets/logo.svg" alt="Chronos" />
1515
</div>
16-
}
16+
)}
1717
</>
1818
);
1919
});

app/context/ApplicationContext.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface AppContextProps {
1717

1818
export const ApplicationContext = React.createContext<any>(null);
1919

20-
const ApplicationContextProvider: React.FC<AppContextProps> = React.memo((props) => {
20+
const ApplicationContextProvider: React.FC<AppContextProps> = React.memo(props => {
2121
const children = props.children;
2222
const [servicesData, setServicesData] = useState([]);
2323
const [app, setApp] = useState<string>('');
@@ -64,14 +64,24 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo((props)
6464
const store: object = {};
6565
data.forEach(el => {
6666
store[el.metric] = el;
67-
})
67+
});
6868
setSavedMetrics(store);
6969
});
7070
}, []);
7171

7272
return (
7373
<ApplicationContext.Provider
74-
value={{ connectToDB, fetchServicesNames, setServicesData, servicesData, app, getSavedMetrics, setSavedMetrics, savedMetrics }}
74+
value={{
75+
connectToDB,
76+
fetchServicesNames,
77+
setServicesData,
78+
servicesData,
79+
app,
80+
setApp,
81+
getSavedMetrics,
82+
setSavedMetrics,
83+
savedMetrics,
84+
}}
7585
>
7686
{children}
7787
</ApplicationContext.Provider>

app/context/DashboardContext.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React, { useState, createContext, useCallback } from 'react';
44
const { ipcRenderer } = window.require('electron');
55

66
interface IFields {
7+
typeOfService: string;
78
database: string;
89
URI: string;
910
name: string;
@@ -29,9 +30,9 @@ export const DashboardContext = createContext<any>(null);
2930

3031
const DashboardContextProvider = React.memo((props: any) => {
3132
const children = props.children;
32-
33+
3334
// Initial user will always be the guest
34-
const [user, setUser] = useState('guest');
35+
const [user, setUser] = useState('guest');
3536
const [applications, setApplications] = useState<string[]>([]);
3637
const [mode, setMode] = useState<string>('light');
3738

@@ -41,10 +42,10 @@ const DashboardContextProvider = React.memo((props: any) => {
4142
}, []);
4243

4344
const addApp = useCallback((fields: IFields) => {
44-
const { database, URI, name, description } = fields;
45+
const { typeOfService, database, URI, name, description } = fields;
4546
const result = ipcRenderer.sendSync(
4647
'addApp',
47-
JSON.stringify([name, database, URI, description])
48+
JSON.stringify([name, database, URI, description, typeOfService])
4849
);
4950
setApplications(result);
5051
}, []);

app/context/helpers.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useRef, useEffect } from 'react';
44

55
export function transformData(healthData) {
66
const categoryList = getCategory(healthData[0]);
7+
if (!categoryList[0]) categoryList = getCategory(healthData[0]);
78
const serviceList = getServices(healthData);
89
const categoryList_time = [];
910
const categoryList_data = [];
@@ -122,7 +123,7 @@ export const useIsMount = () => {
122123

123124
// Keep this in sync with the format in the users.json file for guests
124125
export const guestUser = {
125-
"username": "guest",
126-
"services":[],
127-
"mode": "light"
126+
username: 'guest',
127+
services: [],
128+
mode: 'light',
128129
};

app/modals/AddModal.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DashboardContext } from '../context/DashboardContext';
44
import '../stylesheets/AddModal.scss';
55

66
interface IFields {
7+
typeOfService: string;
78
database: string;
89
URI: string;
910
name: string;
@@ -25,6 +26,7 @@ const AddModal: React.FC<AddModalProps> = React.memo(({ setOpen }) => {
2526
const { addApp }: IDashboard = useContext(DashboardContext);
2627

2728
const [fields, setFields] = useState<IFields>({
29+
typeOfService: 'AWS',
2830
database: 'SQL',
2931
URI: '',
3032
name: '',
@@ -47,7 +49,7 @@ const AddModal: React.FC<AddModalProps> = React.memo(({ setOpen }) => {
4749
});
4850
};
4951

50-
const { database, URI, name, description } = fields;
52+
const { typeOfService, database, URI, name, description } = fields;
5153

5254
return (
5355
<div className="add-container">
@@ -57,9 +59,26 @@ const AddModal: React.FC<AddModalProps> = React.memo(({ setOpen }) => {
5759
</div>
5860
<form onSubmit={handleSubmit}>
5961
<p>Required*</p>
62+
<div>
63+
<label htmlFor="serv-type">
64+
Type of Service<span>*</span>
65+
</label>
66+
<select
67+
id="serv-type"
68+
name="typeOfService"
69+
value={typeOfService}
70+
onChange={e => handleChange(e)}
71+
>
72+
<option value="AWS">AWS</option>
73+
<option value="Docker">Docker</option>
74+
<option value="gRPC">gRPC</option>
75+
<option value="Kubernetes">Kubernetes</option>
76+
<option value="Microservices">Microservices</option>
77+
</select>
78+
</div>
6079
<div>
6180
<label htmlFor="db-type">
62-
Type<span>*</span>
81+
Type of Database<span>*</span>
6382
</label>
6483
<select id="db-type" name="database" value={database} onChange={e => handleChange(e)}>
6584
<option value="SQL">SQL</option>

app/stylesheets/Occupied.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ select:-webkit-autofill:focus {
531531
width: 85%;
532532
border: none;
533533
height: 1px;
534-
margin-top: 59px;
534+
margin-top: 20px;
535535
margin-bottom: 15px;
536536
}
537537

@@ -557,8 +557,13 @@ select:-webkit-autofill:focus {
557557
}
558558

559559
#databaseName {
560-
margin-top: 40px;
560+
margin-top: 20px;
561561
margin-bottom: 0;
562562
color: $header;
563+
font-size: 36px;
564+
}
565+
566+
#serviceName {
563567
font-size: 11px;
568+
margin-top: 6px;
564569
}

electron/Main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const createWindow = () => {
2626
if (process.env.NODE_ENV === 'development') {
2727
// Development: load the application window to the port in the webpack config
2828
win.loadURL('http://localhost:8081/');
29+
win.webContents.openDevTools();
2930
} else {
3031
// Production
3132
win.loadFile(path.resolve(__dirname, '../index.html'));

0 commit comments

Comments
 (0)