add group by statement to queries if provided by layout
parent
530631905d
commit
1ffa00dc16
|
@ -16,6 +16,7 @@ export const LayoutRenderer = React.createClass({
|
||||||
rp: PropTypes.string.isRequired,
|
rp: PropTypes.string.isRequired,
|
||||||
text: PropTypes.string.isRequired,
|
text: PropTypes.string.isRequired,
|
||||||
database: PropTypes.string.isRequired,
|
database: PropTypes.string.isRequired,
|
||||||
|
groupBys: PropTypes.arrayOf(PropTypes.string),
|
||||||
}).isRequired
|
}).isRequired
|
||||||
).isRequired,
|
).isRequired,
|
||||||
x: PropTypes.number.isRequired,
|
x: PropTypes.number.isRequired,
|
||||||
|
@ -43,6 +44,9 @@ export const LayoutRenderer = React.createClass({
|
||||||
return this.props.cells.map((cell) => {
|
return this.props.cells.map((cell) => {
|
||||||
const qs = cell.queries.map((q) => {
|
const qs = cell.queries.map((q) => {
|
||||||
_.merge(q, {host: source});
|
_.merge(q, {host: source});
|
||||||
|
if (q.groupBys && q.groupBys.length > 0) {
|
||||||
|
q.text += ` group by ${q.groupBys.join(' ')}`;
|
||||||
|
}
|
||||||
q.text += ` where host = '${host}' and time > ${timeRange}`;
|
q.text += ` where host = '${host}' and time > ${timeRange}`;
|
||||||
return q;
|
return q;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue