diff --git a/mock/mock.go b/mock/mock.go index e989260abc..3f73904dc9 100644 --- a/mock/mock.go +++ b/mock/mock.go @@ -22,7 +22,7 @@ func NewExplorationStore(nowFunc func() time.Time) mrfusion.ExplorationStore { ID: 1, Name: "Ferdinand Magellan", UserID: 1, - Data: `"{"panels":{“123":{"id”:"123","queryIds":[“456"]}},"queryConfigs":{"456":{"id”:"456","database":null,"measurement":null,"retentionPolicy":null,"fields":[],"tags":{},"groupBy":{"time":null,"tags":[]},"areTagsAccepted":true,"rawText":null}}}"`, + Data: `"{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}"`, CreatedAt: nowFunc(), UpdatedAt: nowFunc(), } diff --git a/ui/src/CheckDataNodes.js b/ui/src/CheckDataNodes.js index 986db4d98f..2bc2a7c487 100644 --- a/ui/src/CheckDataNodes.js +++ b/ui/src/CheckDataNodes.js @@ -25,16 +25,14 @@ const CheckDataNodes = React.createClass({ getInitialState() { return { isFetching: true, - // A list of 'queryable' data nodes. - dataNodes: null, + source: null, }; }, componentDidMount() { - getSources().then((resp) => { - const dataNodes = resp.data.sources; + getSources().then(({data: {sources}}) => { this.setState({ - dataNodes, + source: sources[0], isFetching: false, }); }).catch((err) => { @@ -48,13 +46,14 @@ const CheckDataNodes = React.createClass({ return
; } - const {dataNodes} = this.state; - if (!dataNodes || !dataNodes.length) { + const {source} = this.state; + if (!source || !source.links.proxy) { + // this should probably be changed.... return ; } return this.props.children && React.cloneElement(this.props.children, Object.assign({}, this.props, { - dataNodes, + proxyLink: source.links.proxy, })); }, }); diff --git a/ui/src/chronograf/actions/view/index.js b/ui/src/chronograf/actions/view/index.js index da4a051836..03304bc21f 100644 --- a/ui/src/chronograf/actions/view/index.js +++ b/ui/src/chronograf/actions/view/index.js @@ -227,13 +227,14 @@ function loadExplorer(explorer) { }; } -export function fetchExplorers({clusterID, explorerID, push}) { +export function fetchExplorers({sourceLink, userID, explorerID, push}) { return (dispatch) => { dispatch({type: 'FETCH_EXPLORERS'}); AJAX({ - url: `/api/int/v1/explorers?cluster_id=${clusterID}`, - }).then((resp) => { - const explorers = resp.data.map(parseRawExplorer); + url: `/chronograf/v1/sources/1/users/1/explorations`, + }).then(({data: {explorations}}) => { + debugger; + const explorers = explorations.map(parseRawExplorer); dispatch(loadExplorers(explorers)); // Create a new explorer session for a user if they don't have any diff --git a/ui/src/chronograf/containers/App.js b/ui/src/chronograf/containers/App.js index f02b1c6cfa..27e25a1b60 100644 --- a/ui/src/chronograf/containers/App.js +++ b/ui/src/chronograf/containers/App.js @@ -6,41 +6,31 @@ import DataExplorer from './DataExplorer'; const App = React.createClass({ propTypes: { - dataNodes: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, + proxyLink: PropTypes.string.isRequired, fetchExplorers: PropTypes.func.isRequired, router: PropTypes.shape({ push: PropTypes.func.isRequired, }).isRequired, params: PropTypes.shape({ - clusterID: PropTypes.string.isRequired, explorerID: PropTypes.string, }).isRequired, }, componentDidMount() { - const {clusterID, explorerID} = this.props.params; + const {explorerID} = this.props.params; this.props.fetchExplorers({ - clusterID, + sourceLink: 'linkgoesheres', // source.links.self + userID: 1, // userID explorerID: Number(explorerID), push: this.props.router.push, }); }, - childContextTypes: { - clusterID: PropTypes.string, - }, - - getChildContext() { - return { - clusterID: this.props.params.clusterID, - }; - }, - render() { - const {clusterID, explorerID} = this.props.params; + const {explorerID} = this.props.params; return (
- +
); }, diff --git a/ui/src/chronograf/containers/DataExplorer.js b/ui/src/chronograf/containers/DataExplorer.js index c5145caa42..5960b084fe 100644 --- a/ui/src/chronograf/containers/DataExplorer.js +++ b/ui/src/chronograf/containers/DataExplorer.js @@ -16,7 +16,7 @@ import { const DataExplorer = React.createClass({ propTypes: { - dataNodes: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, + proxyLink: PropTypes.string.isRequired, timeRange: PropTypes.shape({ upper: PropTypes.string, lower: PropTypes.string, @@ -32,11 +32,11 @@ const DataExplorer = React.createClass({ }, childContextTypes: { - dataNodes: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, + proxyLink: PropTypes.string, }, getChildContext() { - return {dataNodes: this.props.dataNodes}; + return {proxyLink: this.props.proxyLink}; }, getInitialState() { @@ -52,7 +52,7 @@ const DataExplorer = React.createClass({ }, render() { - const {timeRange, explorers, explorerID, clusterID, setTimeRange, createExplorer, chooseExplorer, deleteExplorer, editExplorer} = this.props; + const {timeRange, explorers, explorerID, setTimeRange, createExplorer, chooseExplorer, deleteExplorer, editExplorer} = this.props; if (explorers === FETCHING) { // TODO: page-wide spinner @@ -71,11 +71,10 @@ const DataExplorer = React.createClass({ explorers={explorers} timeRange={timeRange} explorerID={explorerID} - clusterID={clusterID} /> - +
);