Add mithril bundle version of dbmonster
This commit is contained in:
parent
2af3aa27c7
commit
fbcdcf93e2
2 changed files with 66 additions and 0 deletions
49
examples/dbmonster/mithril-bundle/app.js
Normal file
49
examples/dbmonster/mithril-bundle/app.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict"
|
||||
|
||||
var m = require("../../../mithril")
|
||||
|
||||
perfMonitor.startFPSMonitor()
|
||||
perfMonitor.startMemMonitor()
|
||||
perfMonitor.initProfiler("render")
|
||||
|
||||
var data = []
|
||||
|
||||
m.mount(document.getElementById("app"), {
|
||||
view: function() {
|
||||
return m("div", [
|
||||
m("table", {className: "table table-striped latest-data"}, [
|
||||
m("tbody",
|
||||
data.map(function(db) {
|
||||
return m("tr", {key: db.dbname}, [
|
||||
m("td", {className: "dbname"}, db.dbname),
|
||||
m("td", {className: "query-count"}, [
|
||||
m("span", {className: db.lastSample.countClassName}, db.lastSample.nbQueries)
|
||||
]),
|
||||
db.lastSample.topFiveQueries.map(function(query) {
|
||||
return m("td", {className: query.elapsedClassName}, [
|
||||
query.formatElapsed,
|
||||
m("div", {className: "popover left"}, [
|
||||
m("div", {className: "popover-content"}, query.query),
|
||||
m("div", {className: "arrow"})
|
||||
])
|
||||
])
|
||||
})
|
||||
])
|
||||
})
|
||||
)
|
||||
])
|
||||
])
|
||||
}
|
||||
})
|
||||
|
||||
function update() {
|
||||
data = ENV.generateData().toArray()
|
||||
|
||||
perfMonitor.startProfile("render")
|
||||
m.redraw()
|
||||
perfMonitor.endProfile("render")
|
||||
|
||||
setTimeout(update, ENV.timeout)
|
||||
}
|
||||
|
||||
update()
|
||||
17
examples/dbmonster/mithril-bundle/index.html
Normal file
17
examples/dbmonster/mithril-bundle/index.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="description" content="DBMON Mithril" />
|
||||
<meta charset="utf-8">
|
||||
<link href="../styles.css" rel="stylesheet" type="text/css" />
|
||||
<title>dbmon (Mithril)</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="../../../module/module.js"></script>
|
||||
<script src="../../../mithril.js"></script>
|
||||
<script src="../ENV.js"></script>
|
||||
<script src="https://localvoid.github.io/perf-monitor/0.1/perf-monitor.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue