* removed React UI

* moved js into separate files
* updated screenshot.png
This commit is contained in:
Sander Hautvast 2020-12-29 18:16:35 +01:00
parent 29e71c0f96
commit 87995efa63
20 changed files with 60 additions and 16206 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 KiB

After

Width:  |  Height:  |  Size: 245 KiB

View file

@ -64,8 +64,6 @@
.glyphicon {
position: relative;
font-style: normal;
font-weight: bold;
font-size: 20px;
}
.glyphicon-plus-sign::before {
@ -74,7 +72,6 @@
.glyphicon-min-sign::before {
content: "-";
/*transform: translate(0,-5px);*/
}
.hidden{

View file

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>Perfix</title>
<link rel="stylesheet" href="/css/app.css">
<link rel="stylesheet" href="/css/table.css">
<link rel="stylesheet" href="/css/tree.css">
</head>
<body>
@ -20,6 +20,7 @@
</div>
<script type="application/ecmascript" src="/js/axios.min.js"></script>
<script type="application/ecmascript" src="/js/app.js"></script>
<script type="application/ecmascript" src="/js/table.js"></script>
<script type="application/ecmascript" src="/js/tree.js"></script>
</body>
</html>

View file

@ -1,7 +1,6 @@
let name_filter = "";
let datatable, callstack_data;
let datatable;
const datagrid = document.getElementById("datagrid");
const datatree = document.getElementById("datatree");
function refresh_data_grid() {
if (datagrid.firstChild) {
@ -104,56 +103,6 @@ function append_table(parent) {
}
}
// (function tabular_view() {
// }());
function appendChildren(parent, nodes) {
let node;
for (let i = 0; i < nodes.length; i++) {
node = nodes[i];
let li = document.createElement("li");
let branch = document.createElement("i");
if (node.children.length > 0) {
branch.setAttribute("class", "indicator glyphicon glyphicon-plus-sign");
branch.onclick = function (event) {
let icon = event.currentTarget.parentElement.firstChild;
let ul_to_toggle = icon.nextSibling.nextSibling;
if (ul_to_toggle.getAttribute("class") === "visible") {
icon.setAttribute("class", "indicator glyphicon glyphicon-plus-sign");
ul_to_toggle.setAttribute("class", "hidden");
} else {
icon.setAttribute("class", "indicator glyphicon glyphicon-min-sign");
ul_to_toggle.setAttribute("class", "visible");
}
};
}
let label = document.createElement("a");
label.innerText = Math.floor(node["invocation"].duration / 1000) / 1000 + " ms " + node.name;
li.appendChild(branch);
li.appendChild(label);
let ul = document.createElement("ul");
ul.setAttribute("class", "hidden");
li.appendChild(ul);
appendChildren(ul, node.children);
parent.appendChild(li);
}
}
function refresh_data_tree() {
let datatree = document.getElementById("datatree");
let new_div = document.createElement("div");
new_div.setAttribute("class", "callstack-tree");
datatree.appendChild(new_div);
appendChildren(new_div, callstack_data);
}
(function main() {
update_filter();
@ -162,11 +111,5 @@ function refresh_data_tree() {
datatable = response;
refresh_data_grid();
});
axios.get('http://localhost:2048/callstack')
.then(response => {
callstack_data = response.data;
refresh_data_tree();
});
}());

View file

@ -0,0 +1,56 @@
let callstack_data;
const datatree = document.getElementById("datatree");
function appendChildren(parent, nodes) {
let node;
for (let i = 0; i < nodes.length; i++) {
node = nodes[i];
let li = document.createElement("li");
let branch = document.createElement("i");
if (node.children.length > 0) {
branch.setAttribute("class", "indicator glyphicon glyphicon-plus-sign");
branch.onclick = function (event) {
let icon = event.currentTarget.parentElement.firstChild;
let ul_to_toggle = icon.nextSibling.nextSibling;
if (ul_to_toggle.getAttribute("class") === "visible") {
icon.setAttribute("class", "indicator glyphicon glyphicon-plus-sign");
ul_to_toggle.setAttribute("class", "hidden");
} else {
icon.setAttribute("class", "indicator glyphicon glyphicon-min-sign");
ul_to_toggle.setAttribute("class", "visible");
}
};
}
let label = document.createElement("a");
label.innerText = Math.floor(node["invocation"].duration / 1000) / 1000 + " ms " + node.name;
li.appendChild(branch);
li.appendChild(label);
let ul = document.createElement("ul");
ul.setAttribute("class", "hidden");
li.appendChild(ul);
appendChildren(ul, node.children);
parent.appendChild(li);
}
}
function refresh_data_tree() {
let new_div = document.createElement("div");
new_div.setAttribute("class", "callstack-tree");
datatree.appendChild(new_div);
appendChildren(new_div, callstack_data);
}
(function main() {
axios.get('http://localhost:2048/callstack')
.then(response => {
callstack_data = response.data;
refresh_data_tree();
});
}());

View file

@ -1 +0,0 @@
[{"/Users/Shautvast/IdeaProjects/perfix2/ui/src/index.js":"1","/Users/Shautvast/IdeaProjects/perfix2/ui/src/Tree.js":"2","/Users/Shautvast/IdeaProjects/perfix2/ui/src/List.js":"3"},{"size":170,"mtime":1607098539627,"results":"4","hashOfConfig":"5"},{"size":1516,"mtime":1607070691358,"results":"6","hashOfConfig":"5"},{"size":906,"mtime":1607070691358,"results":"7","hashOfConfig":"5"},{"filePath":"8","messages":"9","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"10"},"b2tntd",{"filePath":"11","messages":"12","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"10"},{"filePath":"13","messages":"14","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/Shautvast/IdeaProjects/perfix2/ui/src/index.js",[],["15","16"],"/Users/Shautvast/IdeaProjects/perfix2/ui/src/Tree.js",[],"/Users/Shautvast/IdeaProjects/perfix2/ui/src/List.js",[],{"ruleId":"17","replacedBy":"18"},{"ruleId":"19","replacedBy":"20"},"no-native-reassign",["21"],"no-negated-in-lhs",["22"],"no-global-assign","no-unsafe-negation"]

15796
ui/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,39 +0,0 @@
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.21.0",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.5.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>Perfix</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>

View file

@ -1,15 +0,0 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": "./index.html",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View file

@ -1,140 +0,0 @@
body {
background:white;
font: normal 12px/150% Arial, Helvetica, sans-serif;
padding:2px;
}
.view{
padding: 10px;
border: 1px solid #006699;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.tree, .tree ul {
margin:0 0 0 1em; /* indentation */
padding:0;
list-style:none;
color:#369;
position:relative;
left:0px;
}
.treeView{
position: relative;
left:-20px;
}
.tree li input ~ ul{
display: none;
height: 0;
}
.tree li input:checked ~ ul{
display: inline;
}
.tree ul {margin-left:1em} /* (indentation/2) */
.tree li:before {
content:"";
display:block;
width:10px; /* same with indentation */
height:0;
border-top:1px solid;
margin-top:-3px; /* border top width */
position:absolute;
top:1em; /* (line-height/2) */
left:px;
}
.tree li {
border-left:1px solid;
margin-left: -3px;
padding: 0 0em; /* indentation + .5em */
line-height: 1.5em; /* default list item's `line-height` */
position: relative;
color: #00496B;
left:20px;
}
.datagrid table {
border-collapse: collapse;
text-align: left;
width: 100%;
}
.datagrid {
padding: 10px;
font: normal 12px/150% Arial, Helvetica, sans-serif;
background: #fff;
border: 1px solid #006699;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.datagrid table td, .datagrid table th {
padding: 3px 10px;
}
.datagrid table thead th:first-child {
border: none;
}
.datagrid table tbody tr {
color: #00496B;
border-left: 1px solid #E1EEF4;
font-size: 12px;
font-weight: normal;
}
.datagrid table tbody .alt td {
background: #E1EEF4;
}
.datagrid table tbody td:first-child {
border-left: none;
}
.datagrid table tbody tr:last-child td {
border-bottom: none;
}
.datagrid table tfoot td div {
border-top: 1px solid #006699;
background: #E1EEF4;
}
.datagrid table tfoot td {
padding: 0;
font-size: 12px
}
.datagrid table tfoot td div {
padding: 2px;
}
.datagrid table tfoot td ul {
margin: 0;
padding: 0;
list-style: none;
text-align: right;
}
.datagrid table tfoot li {
display: inline;
}
.datagrid tbody tr:hover {
text-decoration: none;
border-color: #006699;
color: #FFFFFF;
background: none;
background-color: #00557F;
}
div.dhtmlx_window_active, div.dhx_modal_cover_dv {
position: fixed !important;
}

View file

@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});

View file

@ -1,38 +0,0 @@
import React, { Component } from 'react';
import './App.css';
import axios from 'axios';
class List extends Component {
state = {
data: []
}
componentDidMount() {
this.loadData();
}
loadData() {
axios.get('http://localhost:2048/report')
.then(response => {
this.setState({ data: response.data });
});
}
render() {
return (
<div className="datagrid">
<h1>List view</h1>
<table>
<thead><tr><th>name</th><th>invocations</th><th>totalDuration</th><th>average</th></tr></thead>
<tbody>
{this.state.data.map(datum =>
<tr key={datum.name}><td>{datum.name}</td><td>{datum.invocations}</td><td>{Math.floor(datum.totalDuration/1000)/1000}</td><td>{Math.floor(datum.average/1000)/1000}</td></tr>
)}
</tbody>
</table>
</div>
);
}
}
export default List;

View file

@ -1,53 +0,0 @@
import React, { Component } from 'react';
import axios from 'axios';
import List from './List';
class Tree extends Component {
state = { data: [] };
componentDidMount() {
this.loadData();
}
loadData() {
console.log(this);
axios.get("http://localhost:2048/callstack")
.then(response => this.setState({ data: response.data }));
}
clearData() {
axios.get("http://localhost:2048/clear")
.then(response => this.setState({ data: response.data }));
}
renderChildren(children) {
return (<ul className="tree">
{children.map(
r =>
<li key={r.name}><input type="checkbox" className="tree"/>
{Math.floor(r.invocation.duration / 1000) / 1000} ms &nbsp;
{r.name}
{this.renderChildren(r.children)}
</li>
)}
</ul>)
}
render() {
return (
<div>
<button type="button" onClick={() => this.clearData()}>clear</button>
<button type="button" onClick={() => this.loadData()}>refresh</button>
<div className="view"><h1>Callstack view</h1>
<div className="treeView">
{this.renderChildren(this.state.data)}
</div>
</div>
<p/>
<List />
</div>
)
}
}
export default Tree;

View file

@ -1,6 +0,0 @@
body {
margin: 10;
padding: 0;
font-family: sans-serif;
}

View file

@ -1,6 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Tree from './Tree';
ReactDOM.render(<Tree />, document.getElementById('root'));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B