Skip to content

Commit

Permalink
Merge pull request #186 from wrench-project/dashboard_chartjs
Browse files Browse the repository at this point in the history
Migrating some dashboard plots to Chart.js and improving design with SemanticUI
  • Loading branch information
rafaelfsilva authored Jun 20, 2020
2 parents 0470cdc + 8e908d9 commit d798602
Show file tree
Hide file tree
Showing 20 changed files with 1,227 additions and 329 deletions.
156 changes: 105 additions & 51 deletions tools/wrench/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,125 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>

<title>WRENCH Dashboard</title>

<link rel="stylesheet" href="public/css/bootstrap.min.css"/>
<link rel="stylesheet" href="public/css/styles.css"/>
<link rel="icon" href="public/img/favicon.ico"/>

<link rel="stylesheet" href="public/css/semantic.min.css"/>
<link rel="stylesheet" href="public/css/styles.css"/>
<link rel="stylesheet" href="public/css/Chart.min.css"/>
<script src="public/js/Chart.min.js" type="text/javascript"></script>
<script src='public/js/jquery-3.3.1.min.js' type='text/javascript'></script>
<script src="public/js/d3.min.js" type="text/javascript"></script>
<script src="public/js/jQueryRotate.js" type="text/javascript"></script>
<script src="public/js/semantic.min.js" type="text/javascript"></script>
<script src="public/js/d3.min.js" type="text/javascript"></script>
<script src="public/js/d3-3d.js" type="text/javascript"></script>
<script src="public/js/handlebars.min-v4.7.2.js" type="text/javascript"></script>

<!-- billboard.js scripts -->
<script src="https://cdn.jsdelivr.net/npm/billboard.js/dist/billboard.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/billboard.js/dist/billboard.min.css">
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-dark sticky-top justify-content-between">
<a class="navbar-brand" href="#">
<img src="public/img/logo-vertical.png" id="logo" width="50"/>
WRENCH <span class="small">dashboard</span>
</a>
<form class="form-inline">
<div class="input-group small">
<!-- <div class="input-group-prepend small">
<span class="input-group-text badge-secondary" style="font-size: 1.2em" id="inputGroupFileAddon01">Upload</span>
</div> -->
<div class="custom-file">
<input type="file" accept="application/json" onchange="processFile(this.files);"
class="btn-light" id="inputGroupFile01"
aria-describedby="inputGroupFileAddon01">
<label class="pointer custom-file-label badge-light" for="inputGroupFile01">Choose JSON File</label>
<div class="ui vertical inverted visible sidebar left menu uncover" style="width: 15em; float: left; position: fixed">
<div class="item" style="padding-bottom: 2em !important; padding-top: 2em; text-align: center">
<img src="public/img/logo-vertical.png" style="width: 10em"/>
<div style="margin-top: 1em; color: #ccc; text-align: center">
<h2>WRENCH<br/><span style="font-size: 0.7em">dashboard</span></h2>
</div>
</div>
<div id="main-sidebar" class="hidden">
<template id="graph-template-menu">
{{#each graphInfo}}
<a class="item active" id="btn-{{containerId}}" onclick="toggleDashboard('{{containerId}}');">
<i class="{{icon}} icon"></i>
{{title}}
</a>
{{/each}}
</template>
</div>
</div>

<div class="ui container" style="width: auto; padding: 1em 1em 1em 16em; height: 100%">

<div class="ui tertiary raised segment">
<div class="ui small left action icon input">
<input type="file" accept="application/json" onchange="processFile(this.files);"
id="inputGroupFile01" hidden>
<label for="inputGroupFile01" class="ui grey labeled icon button">
<i class="upload icon"></i>
Simulation Output JSON
</label>
<i class="file icon"></i>
<input type="text" class="grey" id="simulation-json" value="No File Uploaded" readonly>
</div>
<div class="ui right floated icon grey dropdown button" id="main-cog" style="visibility: hidden">
<i class="cog icon"></i>
<div class="small menu">
<div class="item">
<i class="dropdown icon"></i>
<span class="text">Resize All Box Width</span>
<div class="small menu">
<div class="item" onclick="resizeAllBox('full');">
Full Width
</div>
<div class="item" onclick="resizeAllBox('half');">
Half Width
</div>
</div>
</div>
</div>
</div>
</form>
</nav>
</div>

<div class="jumbotron jumbotron-fluid m-5" id="no-file">
<div class="container">
<h2>Welcome to the WRENCH dashboard!</h2>
<hr class="my-4 m-5">
<div class="ui tertiary segment" style="height: 85%; padding: 10em" id="no-file">
<h1>Welcome to the WRENCH dashboard!</h1>
<div class="ui divider"></div>
<p class="lead">To get started, please upload your JSON file in the file upload above.</p>
</div>
</div>

<div id="main-body" class="mt-5 mb-5">
<template id="graph-template">
{{#each graphInfo}}
<div class='element-and-title-container'>
<div class='title-container' onclick='showHideArrow("{{containerId}}", "{{arrowId}}")'>
<h6 class='title-text'>{{title}}</h6>
<div class='arrow-div'>
<span class='arrow-helper'></span>
<img id='{{arrowId}}' class='arrow-img' src='public/img/expand-arrow.png'/>
<div id="main-body" class="ui grid">
<template id="graph-template">
{{#each graphInfo}}
<div class="sixteen wide column" id="{{containerId}}" style="margin-left: 0; margin-right: 0">
<div class="ui raised segments visible">
<div class="ui inverted grey segment">
<i class="{{icon}} icon"></i>
{{title}}
<a class="ui top right attached grey dropdown label">
<i class="cog icon"></i>
<div class="small menu">
<div class="item">
<i class="dropdown icon"></i>
<span class="text">Box Width</span>
<div class="small menu">
<div class="item" onclick="resizeBox('full', '{{containerId}}');">
<i class="check icon" id="dd-width-full-{{containerId}}"></i>
Full Width
</div>
<div class="item" onclick="resizeBox('half', '{{containerId}}');">
<i class="icon" id="dd-width-half-{{containerId}}"></i>
Half Width
</div>
</div>
</div>
</div>
</a>
</div>
<div class="ui segment" style="overflow: auto">
{{{html}}}
</div>
</div>
</div>
{{/each}}
</template>
</div>

<div class='hidden' id='{{containerId}}'>
{{{html}}}
</div>
<div class="ui small grey menu" style="margin-bottom: 2em">
<div class="header item" style="color: #999">
&copy; WRENCH<br/>
</div>
{{/each}}
</template>
</div>
<a class="right item" href="https://wrench-project.org" target="_blank" style="color: #999">
https://wrench-project.org
</a>
</div>

<nav class="bottom-navbar navbar navbar-expand-lg navbar-light bg-light sticky-bottom justify-content-between small" style="color: #999">
<label>&copy; WRENCH</label>
<a href="https://wrench-project.org" target="_blank" style="color: #999">https://wrench-project.org</a>
</nav>
</div>

</body>
<script src="partials/workflow-summary.js"></script>
Expand All @@ -85,6 +135,10 @@ <h6 class='title-text'>{{title}}</h6>
<script src="partials/host-utilization.js"></script>
<script src="partials/render.js"></script>

<!-- CHARTS -->
<script src="scripts/graph-sections/gantt-chart.js" type="text/javascript"></script>
<script src="scripts/graph-sections/host-utilization-chart.js" type="text/javascript"></script>

<script src="scripts/data.js"></script>
<script src="scripts/util.js"></script>
<script src="scripts/button-clicks.js"></script>
Expand All @@ -94,5 +148,5 @@ <h6 class='title-text'>{{title}}</h6>
<script src="scripts/graph-sections/simulation-graph.js"></script>
<script src="scripts/graph-sections/workflow-summary.js"></script>
<script src="scripts/graph-sections/host-utilization.js"></script>
<script src="scripts/initialise.js"></script>
</html>
<script src="scripts/initialize.js"></script>
</html>
2 changes: 1 addition & 1 deletion tools/wrench/dashboard/partials/energy-graphs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const energyGraphsHtml = `
<h6 id='no-energy-file'>The file you uploaded does not have energy data</h6>
<p id='no-energy-file'>The file you uploaded does not have energy data</p>
<!-- Markup -->
<b><p class="energy-title" style="align-content: center">Consumed Energy Graph</p></b>
Expand Down
6 changes: 1 addition & 5 deletions tools/wrench/dashboard/partials/host-utilization.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ const hostUtilizationTooltipHtml =
`

const hostUtilizationHtml = `
<div class="container legend" id="host-utilization-chart-legend">
<small class="inline-block" id="host-utilization-chart-legend-compute-time">Compute Time</small>
<small class="inline-block" id="host-utilization-chart-legend-idle-time">Idle Time</small>
</div>
<div class="chart" id="host-utilization-chart"></div>
<canvas id="host-utilization-chart"></canvas>
`
55 changes: 30 additions & 25 deletions tools/wrench/dashboard/partials/render.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
const graphInfoArray = [
{
"title": "Summary of Simulation Metrics",
"title": "Simulation Metrics",
"containerId": "overall-metrics-table-container",
"arrowId": "overall-metrics-arrow",
"html": workflowSummaryHtml
"html": workflowSummaryHtml,
"icon": "chart pie"
},
{
"title": "Simulation Graph",
"title": "Gantt Chart",
"containerId": "overall-graph-container",
"arrowId": "simulation-graph-arrow",
"html": simulationGraphHtml
"html": simulationGraphHtml,
"icon": "sitemap"
},
{
"title": "Simulation Details",
"containerId": "task-details-table-container",
"arrowId": "simulation-details-arrow",
"html": simulationDetailsHtml
"html": simulationDetailsHtml,
"icon": "table"
},
{
"title": "Energy Graphs",
"title": "Host Utilization",
"containerId": "host-utilization-graph-container",
"html": hostUtilizationHtml,
"icon": "chart bar"
},
{
"title": "Energy Consumption",
"containerId": "energy-graph",
"arrowId": "energy-graph-arrow",
"html": energyGraphsHtml
},
"html": energyGraphsHtml,
"icon": "lightbulb"
},
{
"title": "3D Visualization",
"containerId": "three-d-graph-container",
"arrowId": "three-d-graph-arrow",
"html": threedVisualizationHtml
},
{
"title": "Host Utilization Graph",
"containerId": "host-utilization-graph-container",
"arrowId": "host-utilization-arrow",
"html": hostUtilizationHtml
"html": threedVisualizationHtml,
"icon": "cubes"
}
]

function render() {
const template = document.getElementById('graph-template').innerHTML
const renderGraphs = Handlebars.compile(template)
document.getElementById('main-body').innerHTML = renderGraphs({ graphInfo: graphInfoArray })

const template = document.getElementById('graph-template').innerHTML;
const templateMenu = document.getElementById('graph-template-menu').innerHTML;
const renderGraphs = Handlebars.compile(template);
const renderGraphsMenu = Handlebars.compile(templateMenu);
document.getElementById('main-body').innerHTML = renderGraphs({graphInfo: graphInfoArray});
document.getElementById('main-sidebar').innerHTML = renderGraphsMenu({graphInfo: graphInfoArray});
}

render()
render();

$('.ui.dropdown')
.dropdown();
35 changes: 13 additions & 22 deletions tools/wrench/dashboard/partials/simulation-graph.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
const simulationGraphTooltipHtml = `
<div class="text-left" id="tooltip-container">
<span id="tooltip-task-id"></span><br/>
<span id="tooltip-host"></span><br/>
<span id="tooltip-task-operation"></span><br/>
<span id="tooltip-task-operation-duration"></span>
</div>
`

const simulationGraphHtml = `
<div id='button-and-information-container'>
<button id='toggle-view-button' onclick="toggleView()">Switch to Host View</button>
<img id='information-img' class='information-img' src='public/img/information.png' onclick='showInstructions("host-instructions", "information-img")'/>
<button id='show-io-view-button' onclick="showIoView()" style="display: block">Show I/O Partitions</button>
<button id='hide-io-view-button' onclick="hideIoView()" style="display: none">Hide I/O Partitions</button>
</div>
<div id='host-instructions' class='instructions-container'>
<div id='host-instructions-close-button-container' class='instructions-close-button-container'>
<img id='host-instructions-close-button' class='instructions-close-button' src='public/img/close-button.png' onclick='hideInstructions("host-instructions", "information-img")'/>
<div class="ui grey tertiary menu small" style="margin-top: -0.5em">
<div class="header item">
Chart Options
</div>
<p id='host-instructions-text'>Hover over or click on a host on the legend to isolate that host on the graph. Click on a selected host to deselect it. or just select a different host on the legend</p>
<a class="item" onclick="toggleView(this)">
<i class="exchange icon"></i>
Switch to Host View
</a>
<a class="disabled item">
<i class="columns icon"></i>
Show I/O Partitions
</a>
</div>
<div class="container legend" id="workflow-execution-chart-legend"></div>
<div id="graph-container"></div>
`
<canvas id="graph-container"></canvas>
`
1 change: 1 addition & 0 deletions tools/wrench/dashboard/public/css/Chart.min.css

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

Loading

0 comments on commit d798602

Please sign in to comment.