Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Guide page #10

Merged
merged 1 commit into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 124 additions & 2 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"npm-check-updates": "^7.1.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-json-view": "^1.19.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
Expand Down
10 changes: 5 additions & 5 deletions ui/server/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ app.listen(port, () => console.log(`Listening on port ${port}`));
// Get all graphs
app.get('/graphs', (req, res) => {
res.send([ {
"graphId": "roadTraffic",
"graphName": "roadTraffic",
"currentState": "DEPLOYED"
}, {
"graphId": "basicGraph",
"graphName": "basicGraph",
"currentState": "DEPLOYED"
}]);
});

// Get graph by ID
app.get('/graphs/:graphId', (req, res) => {
app.get('/graphs/:graphName', (req, res) => {
res.send({
"graphId": req.params.graphId,
"graphName": req.params.graphName,
"currentState": "DEPLOYED"
});
});

// Delete graph by ID
app.delete('/graphs/:graphId', (req, res) => {
app.delete('/graphs/:graphName', (req, res) => {
res.status(202).end();
});

Expand Down
22 changes: 11 additions & 11 deletions ui/src/components/AddGraph/AddGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface IState {
files: Array<File>,
schemaFieldDisable: boolean,
newGraph: {
graphId: string,
graphName: string,
administrators: Array<string>,
schemaJson: string,
}
Expand All @@ -48,7 +48,7 @@ export default class AddGraph extends React.Component<{}, IState> {
schemaFieldDisable: false,
files: [],
newGraph: {
graphId: "",
graphName: "",
administrators: [],
schemaJson: "",
},
Expand Down Expand Up @@ -89,12 +89,12 @@ export default class AddGraph extends React.Component<{}, IState> {
}));

private async submitNewGraph() {
const {graphId, administrators, schemaJson} = this.state.newGraph;
const {graphName, administrators, schemaJson} = this.state.newGraph;
const schema = new Schema(schemaJson);
const notifications: Notifications = schema.validation();

if (notifications.isEmpty()) {
await new CreateGraphRepo().create(graphId, administrators, schema);
await new CreateGraphRepo().create(graphName, administrators, schema);

} else {
this.setState({notifications: notifications});
Expand Down Expand Up @@ -143,18 +143,18 @@ export default class AddGraph extends React.Component<{}, IState> {

<TextField
variant="outlined"
value={this.state.newGraph.graphId}
value={this.state.newGraph.graphName}
required
fullWidth
id="graphId"
label="Graph ID"
name="graphId"
autoComplete="graph-id"
id="graphName"
label="Graph Name"
name="graphName"
autoComplete="graph-name"
onChange={(event) => {
this.setState({
newGraph: {
...this.state.newGraph,
graphId: event.target.value
graphName: event.target.value
}
});
}}
Expand Down Expand Up @@ -277,7 +277,7 @@ export default class AddGraph extends React.Component<{}, IState> {
files: [],
newGraph: {
...this.state.newGraph,
graphId: "",
graphName: "",
schemaJson:""


Expand Down
5 changes: 4 additions & 1 deletion ui/src/components/Navigation/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import ViewGraph from "../ViewGraph/ViewGraph";
import AddGraph from "../AddGraph/AddGraph";
import UserGuide from "../UserGuide/UserGuide";
import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
import VisibilityIcon from '@material-ui/icons/Visibility';

Expand All @@ -16,8 +17,10 @@ const Routes = [
component: ViewGraph
},
{
path: '#',
path: '/UserGuide',
sidebarName: 'User Guide',
component: UserGuide

},

];
Expand Down
28 changes: 0 additions & 28 deletions ui/src/components/Page1.tsx

This file was deleted.

Loading