Skip to content

Commit 98b491d

Browse files
committed
revamp2
1 parent 04ef4d1 commit 98b491d

4 files changed

Lines changed: 90 additions & 1 deletion

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React, { useState, useContext } from 'react';
2+
import ServiceOverview from './ServiceOverview.jsx';
3+
import DashboardContext from '../context/DashboardContext';
4+
import SetupContext from '../context/SetupContext';
5+
import AddService from './AddService.jsx';
6+
import DeleteService from './DeleteService.jsx';
7+
8+
const ServicesDashboard = (props) => {
9+
// Used to toggle setup required if user wants to add a new database.
10+
const setup = useContext(SetupContext);
11+
12+
// List of the databases saved by users to track microservices.
13+
const serviceList = useContext(DashboardContext);
14+
15+
// Used to hold the buttons created for each database found in context.
16+
const [serviceSelected, setSelection] = useState();

app/newcomp/adrBut.jsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import AddService from '../components/AddService.jsx';
3+
import DeleteService from '../components/DeleteService.jsx';
4+
5+
const Adr = (props) => {
6+
// Used to toggle setup required if user wants to add a new database.
7+
const setup = useContext(SetupContext);
8+
9+
return (
10+
<div className="left-bottom">
11+
<button
12+
className="overviewSubmitBtn"
13+
type="submit"
14+
key="BackToStart"
15+
onClick={() => {
16+
setup.setupRequired = setup.toggleSetup(false);
17+
setSelection(<AddService />);
18+
}}
19+
>
20+
Add Database
21+
</button>
22+
<button
23+
className="overviewSubmitBtn"
24+
type="submit"
25+
key="goToDeletePage"
26+
onClick={() => {
27+
setSelection(<DeleteService />);
28+
}}
29+
>
30+
Delete Database
31+
</button>
32+
<div className="left-bottom">
33+
<button
34+
className="overviewSubmitBtn"
35+
type="submit"
36+
onClick={() => {
37+
location.reload();
38+
}}
39+
>
40+
Refresh overview
41+
</button>
42+
</div>
43+
</div>
44+
);
45+
};
46+
47+
export default Adr;

app/newcomp/services.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React, {useState} from 'react';
2+
import ServiceOverview from '../components/ServiceOverview.jsx';
3+
import Adr from '../newcomp/adrBut.jsx';
4+
5+
const Services = (context) => {
6+
// Used to hold the buttons created for each database found in context.
7+
const [serviceSelected, setSelection] = useState();
8+
const buttonStore = [];
9+
for (let i = 0; i < context.length; i += 1) {
10+
buttonStore.push(
11+
<button
12+
className="microserviceBtn"
13+
type="button"
14+
key={`${i}${context[i]}`}
15+
onClick={() => {
16+
setSelection(<ServiceOverview index={i} />);
17+
}}
18+
>
19+
{context[i]}
20+
</button>,
21+
);
22+
}
23+
return buttonStore;
24+
}
25+
26+
export default Services;

user/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"setupRequired":true,"services":["hard","coded","in"],"splash":true}
1+
{"setupRequired":false,"services":[["test","MongoDB","mongodb+srv://alon:testing123@cluster0-phsei.mongodb.net/test?retryWrites=true&w=majority"]],"splash":false}

0 commit comments

Comments
 (0)