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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue