-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from tbranyen/diffhtml-upstream
Adds in diffHTML example
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const element = document.querySelector('#dbmon tbody'); | ||
const cached = _.template(` | ||
<% databases.map(function(database) { %> | ||
<tr> | ||
<td class="dbname"> | ||
<%= database.dbname %> | ||
</td> | ||
<td class="query-count"> | ||
<span class="<%= database.lastSample.countClassName %>"> | ||
<%= database.lastSample.nbQueries %> | ||
</span> | ||
</td> | ||
<% database.lastSample.topFiveQueries.map(function(sample) { %> | ||
<td class="Query <%= sample.elapsedClassName %>"> | ||
<%= sample.formatElapsed %> | ||
<div class="popover left"> | ||
<div class="popover-content"><%- sample.query %></div> | ||
<div class="arrow"></div> | ||
</div> | ||
</td> | ||
<% }); %> | ||
</tr> | ||
<% }); %> | ||
`); | ||
|
||
function template(databases) { | ||
return cached({ databases }); | ||
} | ||
|
||
function render() { | ||
var databases = ENV.generateData().toArray(); | ||
Monitoring.renderRate.ping(); | ||
|
||
setTimeout(render, ENV.timeout); | ||
|
||
diff.innerHTML(element, template(databases)); | ||
} | ||
|
||
render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="description" content="DBMON DIFFHTML" /> | ||
<meta charset="utf-8"> | ||
<link href="../lib/bootstrap.min.css" rel="stylesheet" type="text/css" /> | ||
<link href="../styles.css" rel="stylesheet" type="text/css" /> | ||
<title>dbmon (diffHTML)</title> | ||
</head> | ||
<body> | ||
<div id="dbmon"> | ||
<div> | ||
<table class="table table-striped latest-data"> | ||
<tbody></tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
||
<script src="../lib/underscore-min.js"></script> | ||
<script src="../lib/diffhtml.min.js"></script> | ||
<script src="../ENV.js"></script> | ||
<script src="../lib/memory-stats.js"></script> | ||
<script src="../lib/monitor.js"></script> | ||
<script src="./app.js"></script> | ||
<script src="../ga.js"></script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters