Successfully create new explorer

pull/10616/head
Andrew Watkins 2016-09-27 14:52:37 -07:00
parent ac5e7689b8
commit cde8c2b5ff
2 changed files with 5 additions and 6 deletions

View File

@ -142,11 +142,11 @@ export function toggleTagAcceptance(queryId) {
}; };
} }
export function createExploration(url, push) { export function createExploration(sourceLink, push) {
return (dispatch) => { return (dispatch) => {
const initialState = getInitialState(); const initialState = getInitialState();
AJAX({ AJAX({
url: `${url}/users/1/explorations`, // TODO: change this to use actual user link once users are introduced url: `${sourceLink}/users/1/explorations`, // TODO: change this to use actual user link once users are introduced
method: 'POST', method: 'POST',
data: JSON.stringify({ data: JSON.stringify({
data: JSON.stringify(initialState), data: JSON.stringify(initialState),
@ -157,8 +157,7 @@ export function createExploration(url, push) {
}).then((resp) => { }).then((resp) => {
const explorer = parseRawExplorer(resp.data); const explorer = parseRawExplorer(resp.data);
dispatch(loadExplorer(explorer)); dispatch(loadExplorer(explorer));
debugger; push(`/chronograf/data_explorer/${btoa(explorer.link.href)}`); // Base64 encode explorer URI
push(`/chronograf/data_explorer/${explorer.id}`);
}); });
}; };
} }
@ -239,7 +238,7 @@ export function fetchExplorers({source, userID, explorerID, push}) {
// Create a new explorer session for a user if they don't have any // Create a new explorer session for a user if they don't have any
// saved (e.g. when they visit for the first time). // saved (e.g. when they visit for the first time).
if (!explorers.length) { if (!explorers.length) {
dispatch(createExplorer(push)); dispatch(createExploration(push));
return; return;
} }

View File

@ -179,7 +179,7 @@ const EditExplorerModal = React.createClass({
<button type="button" className="close" data-dismiss="modal" aria-label="Close"> <button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span> <span aria-hidden="true">×</span>
</button> </button>
<h4 className="modal-title">Rename Exploreration</h4> <h4 className="modal-title">Rename Explorer</h4>
</div> </div>
<form onSubmit={this.handleConfirm}> <form onSubmit={this.handleConfirm}>
<div className="modal-body"> <div className="modal-body">