Skip to content

Commit

Permalink
Merge pull request #83 from thysultan/gh-pages
Browse files Browse the repository at this point in the history
Add DIO.js
  • Loading branch information
mathieuancelin authored Sep 4, 2016
2 parents 99a9df2 + 0c7b49f commit 5a0b36a
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 1 deletion.
119 changes: 119 additions & 0 deletions dio/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"use strict"

var data = [];

var DBMon = dio.createComponent({
render: function() {
return {
type: 'div',
props: {},
children: [
{
type: 'table',
props: {className: 'table table-striped latest-data'},
children: [
{
type: 'tbody',
props: {},
children: data.map(function (db) {
var
children = new Array(7);

children[0] = {
type: 'td',
props: {className: 'dbname'},
children:
[
{
type: 'text',
props: undefined,
children: [db.dbname]
}
]
}

children[1] = {
type: 'td',
props: {className: 'query-count'},
children: [
{
type: 'span',
props: {className: db.lastSample.countClassName},
children:
[
{
type: 'text',
props: undefined,
children: [db.lastSample.nbQueries]
}
]
}
]
}

var length = db.lastSample.topFiveQueries.length;

for (var i = 0; i < length; i++) {
var query = db.lastSample.topFiveQueries[i];

children[i+2] = {
type: 'td',
props: {key: i, className: query.elapsedClassName},
children: [
{
type: 'text',
props: undefined,
children: [query.formatElapsed]
},
{
type: 'div',
props: {className: 'popover left'},
children: [
{
type: 'div',
props: {className: 'popover-content'},
children: [
{
type: 'text',
props: undefined,
children: [query.query]
}
]
},
{
type: 'div',
props: {className: 'arrow'},
children: []
}
]
}
]
};
}

return {
type: 'tr',
props: {key: db.dbname},
children: children
}
})
}
]
}
]
}
}
})

var render = dio.createRender(DBMon, '#app');

function update() {
data = ENV.generateData().toArray();

Monitoring.renderRate.ping();
render();

setTimeout(update, ENV.timeout)
}

update();
Loading

0 comments on commit 5a0b36a

Please sign in to comment.