Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

NAS visualization #2085

Merged
merged 15 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ build:
cp -rf src/nni_manager/config src/nni_manager/dist/
#$(_INFO) Building WebUI $(_END)
cd src/webui && $(NNI_YARN) && $(NNI_YARN) build
#$(_INFO) Building NAS UI $(_END)
cd src/nasui && $(NNI_YARN) && $(NNI_YARN) build

# All-in-one target for non-expert users
# Installs NNI as well as its dependencies, and update bashrc to set PATH
Expand Down
23 changes: 23 additions & 0 deletions src/nasui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
69 changes: 69 additions & 0 deletions src/nasui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "nasnni-vis-ts",
"version": "0.1.0",
"private": true,
"dependencies": {
"@bardit/cytoscape-expand-collapse": "^2.0.3",
"@material-ui/core": "^4.9.3",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/cytoscape": "^3.14.0",
"@types/d3-graphviz": "^2.6.3",
"@types/dagre-d3": "^0.4.39",
"@types/graphlib-dot": "^0.6.1",
"@types/jest": "^24.0.0",
"@types/lodash": "^4.14.149",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of this dependencies maybe could put into devDependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in future item: Clean up unused dependencies.

"cytoscape": "^3.14.0",
"cytoscape-cola": "^2.3.0",
"cytoscape-dagre": "^2.2.2",
"cytoscape-expand-collapse": "^3.2.0",
"cytoscape-panzoom": "^2.5.3",
"d3": "^5.15.0",
"d3-graphviz": "^2.6.1",
"d3-selection": "^1.4.1",
"dagre-d3": "^0.6.4",
"express": "^4.17.1",
"gojs": "^2.1.9",
"graphlib-dot": "^0.6.4",
"lodash": "^4.17.15",
"protobufjs": "^6.8.8",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.4.0",
"typeface-roboto": "^0.0.75",
"typescript": "~3.7.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"backend": "node server.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/d3": "^5.7.2",
"@types/d3-array": "^2.0.0",
"@types/d3-scale": "^2.1.1",
"@types/d3-selection": "^1.4.1"
},
"proxy": "http://localhost:8080"
}
Binary file added src/nasui/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/nasui/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>NNI NAS Board</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
27 changes: 27 additions & 0 deletions src/nasui/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const express = require('express');
const path = require('path');
const fs = require('fs');
const app = express();
const argv = require('minimist')(process.argv.slice(2));
const port = argv.port || 8080;
const logdir = argv.logdir || './mockdata';

app.use(express.static(path.join(__dirname, 'build')));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
app.get('/refresh', (req, res) => {
const graph = fs.readFileSync(path.join(logdir, 'graph.json'), 'utf8');
const log = fs.readFileSync(path.join(logdir, 'log'), 'utf-8')
.split('\n')
.filter(Boolean)
.map(JSON.parse);
res.send({
'graph': JSON.parse(graph),
'log': log,
});
});

app.listen(port, '0.0.0.0', () => {
console.log(`NNI NAS board is running on port ${port}, logdir is ${logdir}.`);
});
38 changes: 38 additions & 0 deletions src/nasui/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
svg {
overflow: hidden;
}

.node {
white-space: nowrap;
}

.node.input rect, .node.output rect {
fill: #9d0f0f;
}

.node.hub rect {
fill: #0f309d;
}

.node.blob rect {
fill: #0F9D58;
}

.node text {
fill: #fff;
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
font-weight: 500;
}

.cluster rect {
stroke: #333;
fill: #000;
fill-opacity: 0.1;
stroke-width: 1.5px;
}

.edgePath path.path {
stroke: #333;
stroke-width: 1.5px;
fill: none;
}
Loading