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,
|
||||
text: PropTypes.string.isRequired,
|
||||
database: PropTypes.string.isRequired,
|
||||
groupBys: PropTypes.arrayOf(PropTypes.string),
|
||||
}).isRequired
|
||||
).isRequired,
|
||||
x: PropTypes.number.isRequired,
|
||||
|
@ -43,6 +44,9 @@ export const LayoutRenderer = React.createClass({
|
|||
return this.props.cells.map((cell) => {
|
||||
const qs = cell.queries.map((q) => {
|
||||
_.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}`;
|
||||
return q;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue