Show measurement list after clicking a database

pull/98/head
Andrew Watkins 2016-09-22 08:56:05 -07:00
parent 645fb6e143
commit 635e883127
7 changed files with 9 additions and 14 deletions

View File

@ -15,8 +15,7 @@ const MeasurementList = React.createClass({
},
contextTypes: {
dataNodes: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
clusterID: PropTypes.string,
sources: PropTypes.arrayOf(PropTypes.shape().isRequired).isRequired,
},
getInitialState() {
@ -32,7 +31,7 @@ const MeasurementList = React.createClass({
}
const {sources} = this.context;
const source = sources[0].link.href;
const source = sources[0].links.proxy;
showMeasurements(source, this.props.query.database).then((resp) => {
const {errors, measurementSets} = showMeasurementsParser(resp.data);
if (errors.length) {

View File

@ -19,8 +19,7 @@ const Visualization = React.createClass({
},
contextTypes: {
dataNodes: arrayOf(string.isRequired).isRequired,
clusterID: string.isRequired,
sources: arrayOf(shape).isRequired,
},
getInitialState() {

View File

@ -36,7 +36,6 @@ const DataExplorer = React.createClass({
},
getChildContext() {
console.log("here are your sources: ", this.props.sources)
return {sources: this.props.sources};
},

View File

@ -12,7 +12,7 @@ const Header = React.createClass({
lower: PropTypes.string,
}).isRequired,
explorers: PropTypes.shape({}).isRequired,
explorerID: PropTypes.number.isRequired,
explorerID: PropTypes.string.isRequired,
actions: PropTypes.shape({
setTimeRange: PropTypes.func.isRequired,
createExplorer: PropTypes.func.isRequired,

View File

@ -22,10 +22,10 @@ export function killQuery(host, queryId, clusterID) {
return proxy(url, clusterID);
}
export function showMeasurements(source, database) {
export function showMeasurements(source, db) {
const query = 'SHOW MEASUREMENTS';
return proxy({source, database, query});
return proxy({source, db, query});
}
export function showRetentionPolicies(source, databases) {

View File

@ -2,14 +2,14 @@ import React, {PropTypes} from 'react';
import _ from 'lodash';
import {proxy, buildInfluxUrl} from 'utils/queryUrlGenerator';
function _fetchTimeSeries(host, database, query, clusterID) {
function _fetchTimeSeries(host, database, query) {
const url = buildInfluxUrl({
host,
database,
statement: query,
});
return proxy(url, clusterID);
return proxy(url);
}
export default function AutoRefresh(ComposedComponent) {
@ -22,7 +22,6 @@ export default function AutoRefresh(ComposedComponent) {
host: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
text: PropTypes.string,
}).isRequired).isRequired,
clusterID: PropTypes.string.isRequired,
},
getInitialState() {
return {timeSeries: []};
@ -66,7 +65,7 @@ export default function AutoRefresh(ComposedComponent) {
let count = 0;
const newSeries = [];
queries.forEach(({host, database, text}) => {
_fetchTimeSeries(host, database, text, this.props.clusterID).then((resp) => {
_fetchTimeSeries(host, database, text).then((resp) => {
newSeries.push({identifier: host, response: resp.data});
count += 1;
if (count === queries.length) {

View File

@ -19,7 +19,6 @@ export function buildInfluxUrl() {
}
export function proxy({source, query, db, rp}) {
debugger;
return AJAX({
method: 'POST',
url: source,