Merge branch 'master' of github.com:metamx/druid

This commit is contained in:
Eric Tschetter 2013-03-18 12:59:33 -05:00
commit bbed862b0b
14 changed files with 35 additions and 22 deletions

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -24,11 +24,11 @@
<artifactId>druid-services</artifactId> <artifactId>druid-services</artifactId>
<name>druid-services</name> <name>druid-services</name>
<description>druid-services</description> <description>druid-services</description>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<modules> <modules>

View File

@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid-examples</artifactId> <artifactId>druid-examples</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -9,7 +9,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid-examples</artifactId> <artifactId>druid-examples</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -23,7 +23,7 @@
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
<name>druid</name> <name>druid</name>
<description>druid</description> <description>druid</description>
<scm> <scm>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>

View File

@ -28,7 +28,7 @@
<parent> <parent>
<groupId>com.metamx</groupId> <groupId>com.metamx</groupId>
<artifactId>druid</artifactId> <artifactId>druid</artifactId>
<version>0.3.23-SNAPSHOT</version> <version>0.3.24-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -55,16 +55,24 @@ var DruidTable = function() {
// build table header // build table header
html += "<thead>"; html += "<thead>";
// find all unique field names
var fieldNames = {};
for (var row in this.getRows()) {
for (var field in this.getRow(row)) {
fieldNames[field] = 1;
}
}
// build table header filters // build table header filters
html += "<tr>"; html += "<tr>";
for (var field in this.getRow(0)) { for (var field in fieldNames) {
html += "<td><input type = \"text\" name=\"" + field + "\" value=\"" + field + "\" class=\"search_init\"/></td>"; html += "<td><input type = \"text\" name=\"" + field + "\" value=\"" + field + "\" class=\"search_init\"/></td>";
} }
html += "</tr>"; html += "</tr>";
// build table header column headings // build table header column headings
html += "<tr>"; html += "<tr>";
for (var field in this.getRow(0)) { for (var field in fieldNames) {
html += "<th>" + field + "</th>"; html += "<th>" + field + "</th>";
} }
html += "</tr>"; html += "</tr>";
@ -74,8 +82,13 @@ var DruidTable = function() {
html += "<tbody>"; html += "<tbody>";
for (var r in this.getRows()) { for (var r in this.getRows()) {
html += "<tr>"; html += "<tr>";
for (var field in this.getRow(r)) { for (var field in fieldNames) {
html += "<td " + "class=\"" + field.replace(' ', '_').toLowerCase() + "\">" + this.getCell(r, field) + "</td>"; var row = this.getRow(r);
if (row.hasOwnProperty(field)) {
html += "<td " + "class=\"" + field.replace(' ', '_').toLowerCase() + "\">" + this.getCell(r, field) + "</td>";
} else {
html += "<td></td>";
}
} }
html += "</tr>"; html += "</tr>";
} }

View File

@ -18,7 +18,7 @@ function buildTable(data, el, dontDisplay, table, row) {
// parse JSON // parse JSON
for (var item in data) { for (var item in data) {
setTable(data[item], el, dontDisplay, table, row); setTable(data[item], el, dontDisplay, table, row, "");
row++; row++;
} }
@ -26,16 +26,16 @@ function buildTable(data, el, dontDisplay, table, row) {
initDataTable(el); initDataTable(el);
} }
function setTable(data, el, dontDisplay, table, row) { function setTable(data, el, dontDisplay, table, row, fieldNamespace) {
for (var field in data) { for (var field in data) {
if (_.contains(dontDisplay, field)) { if (_.contains(dontDisplay, field)) {
// do nothing // do nothing
} else if (Array.isArray(data[field])) { } else if (Array.isArray(data[field])) {
table.setCell(row, field, JSON.stringify(data[field])); table.setCell(row, fieldNamespace + field, JSON.stringify(data[field]));
} else if (!(data[field] instanceof Object)) { } else if (!(data[field] instanceof Object)) {
table.setCell(row, field, data[field]); table.setCell(row, fieldNamespace + field, data[field]);
} else { } else {
setTable(data[field], el, dontDisplay, table, row); setTable(data[field], el, dontDisplay, table, row, fieldNamespace + field + " ");
} }
} }
} }