Skip to content
Merged
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react-dnd": "~2.0.2",
"react-dnd-html5-backend": "~2.0.0",
"react-dom": "^0.14.0",
"react-router": "1.0.0-rc1"
"react-router": "2.0.0"
},
"devDependencies": {
"babel-core": "~5.8.12",
Expand Down
2 changes: 1 addition & 1 deletion src/components/CategoryList/CategoryList.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class CategoryList extends React.Component {
(this.props.linkPrefix || '') + (c.link || id)
);
return (
<Link title={c.name} to={link} className={className} key={id} >
<Link title={c.name} to={{ pathname: link }} className={className} key={id} >
<span>{count}</span>
<span>{c.name}</span>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/FileTree/FileTree.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class FileTree extends React.Component {
<Link
key={'f_' + f}
className={[styles.file, isCurrent ? styles.current : ''].join(' ')}
to={this.props.linkPrefix + path}>
to={{ pathname: this.props.linkPrefix + path }}>
{f}
</Link>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/Popover/Popover.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class ContextProxy extends React.Component {
}

ContextProxy.childContextTypes = {
history: React.PropTypes.object
history: React.PropTypes.object,
router: React.PropTypes.object
};

export default class Popover extends React.Component {
Expand Down Expand Up @@ -93,5 +94,6 @@ export default class Popover extends React.Component {
}

Popover.contextTypes = {
history: React.PropTypes.object
history: React.PropTypes.object,
router: React.PropTypes.object
};
2 changes: 1 addition & 1 deletion src/components/Sidebar/AppsSelector.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class AppsSelector extends React.Component {
if (sections[0] === '') {
sections.shift();
}
history.pushState(null, `/apps/${value}/${sections[2]}`);
history.push(null, `/apps/${value}/${sections[2]}`);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar/SidebarHeader.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import styles from 'components/Sidebar/Sidebar.scss';

let SidebarHeader = ({}) =>
<div className={styles.header}>
<Link className={styles.logo} to='/apps'>
<Link className={styles.logo} to={{ pathname: '/apps' }}>
<Icon width={28} height={28} name='infinity' fill={'#ffffff'} />
</Link>
<Link to='/apps'>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar/SidebarSection.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let SidebarSection = ({ active, children, name, link, icon, style }) => {
<div className={classes.join(' ')}>
{active ?
<div style={style} className={styles.section_header}>{iconContent}{name}</div> :
<Link style={style} className={styles.section_header} to={link || ''}>{iconContent}{name}</Link>}
<Link style={style} className={styles.section_header} to={{ pathname: link || '' }}>{iconContent}{name}</Link>}

{children ? <div className={styles.section_contents}>{children}</div> : null}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar/SidebarSubItem.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let SidebarSubItem = ({ active, name, action, link, children }) => {
<div>
<Link
className={styles.subitem}
to={link}>
to={{ pathname: link }}>
{name}
</Link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/AppData.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let AppData = React.createClass({
if (current) {
current.setParseKeys();
} else {
history.replaceState(null, '/apps');
history.replace('/apps');
return <div />;
}
return (
Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/AppSelector.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export default class AppSelector extends React.Component {

handleConfirm() {
let newPath = location.pathname.replace(/\/_(\/|$)/, '/' + this.state.slug + '/');
history.pushState(null, newPath);
history.push(newPath);
}

handleCancel() {
history.pushState(null, '/apps');
history.push('/apps');
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Apps/AppsIndex.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let AppCard = ({
app,
icon,
}) => {
let canBrowse = app.serverInfo.error ? null : () => history.pushState(null, html`/apps/${app.slug}/browser`);
let canBrowse = app.serverInfo.error ? null : () => history.push(html`/apps/${app.slug}/browser`);
let versionMessage = app.serverInfo.error ?
<div className={styles.serverVersion}>Server not reachable: <span className={styles.ago}>{app.serverInfo.error.toString()}</span></div>:
<div className={styles.serverVersion}>Server version: <span className={styles.ago}>{app.serverInfo.parseServerVersion || 'unknown'}</span></div>;
Expand Down
10 changes: 5 additions & 5 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export default class Browser extends DashboardView {
}
return a.toUpperCase() < b.toUpperCase() ? -1 : 1;
});
history.replaceState(null, this.context.generatePath('browser/' + classes[0]));
history.replace(this.context.generatePath('browser/' + classes[0]));
}
}

Expand Down Expand Up @@ -164,7 +164,7 @@ export default class Browser extends DashboardView {
createClass(className) {
this.props.schema.dispatch(ActionTypes.CREATE_CLASS, { className }).then(() => {
this.state.counts[className] = 0;
history.pushState(null, this.context.generatePath('browser/' + className));
history.push(this.context.generatePath('browser/' + className));
}).always(() => {
this.setState({ showCreateClassDialog: false });
});
Expand All @@ -174,7 +174,7 @@ export default class Browser extends DashboardView {
this.props.schema.dispatch(ActionTypes.DROP_CLASS, { className }).then(() => {
this.setState({showDropClassDialog: false });
delete this.state.counts[className];
history.pushState(null, this.context.generatePath('browser'));
history.push(this.context.generatePath('browser'));
}, (error) => {
let msg = typeof error === 'string' ? error : error.message;
if (msg) {
Expand Down Expand Up @@ -308,7 +308,7 @@ export default class Browser extends DashboardView {
let _filters = JSON.stringify(filters.toJSON());
let url = `browser/${source}` + (filters.size === 0 ? '' : `?filters=${encodeURIComponent(_filters)}`);
// filters param change is making the fetch call
history.pushState(null, this.context.generatePath(url));
history.push(this.context.generatePath(url));
}

updateOrdering(ordering) {
Expand All @@ -332,7 +332,7 @@ export default class Browser extends DashboardView {
constraint: 'eq',
compareTo: id
}]);
history.pushState(null, this.context.generatePath(`browser/${className}?filters=${encodeURIComponent(filters)}`));
history.push(this.context.generatePath(`browser/${className}?filters=${encodeURIComponent(filters)}`));
}

updateRow(row, attr, value) {
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Data/CloudCode/CloudCode.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class CloudCode extends DashboardView {

if (!fileName || release.files[fileName] === undefined) {
// Means we're still in /cloud_code/. Let's redirect to /cloud_code/main.js
history.replaceState(null, this.context.generatePath('cloud_code/main.js'))
history.replace(this.context.generatePath('cloud_code/main.js'))
} else {
// Means we can load /cloud_code/<fileName>
app.getSource(fileName).then(
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Data/Jobs/JobEdit.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class JobEdit extends React.Component {
let promise = this.props.params.jobId ?
this.props.jobs.dispatch(ActionTypes.EDIT, { jobId: this.props.params.jobId, updates: schedule }) :
this.props.jobs.dispatch(ActionTypes.CREATE, { schedule });
promise.then(() => {history.pushState(null, this.context.generatePath('jobs/scheduled'))});
promise.then(() => {history.push(this.context.generatePath('jobs/scheduled'))});
return promise;
}

Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/Data/Jobs/Jobs.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ export default class Jobs extends TableView {
}

navigateToNew() {
history.pushState(null, this.context.generatePath('jobs/new'));
history.push(this.context.generatePath('jobs/new'));
}

navigateToJob(jobId) {
history.pushState(null, this.context.generatePath(`jobs/edit/${jobId}`))
history.push(this.context.generatePath(`jobs/edit/${jobId}`))
}

renderSidebar() {
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard/Push/PushAudiencesIndex.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default class PushAudiencesIndex extends DashboardView {
}

handleSendPush(objectId) {
history.pushState(null, this.context.generatePath(`push/new?audienceId=${objectId}`));
history.push(this.context.generatePath(`push/new?audienceId=${objectId}`));
}

renderRow(audience) {
Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/Push/PushDetails.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export default class PushDetails extends DashboardView {
prevLaunchGroup = (
<div className={styles.header}>
<div className={styles.headline}>
This push is the Launch Group for a previous <Link to={getPushDetailUrl(this.context, pushDetails.experiment_push_id)}>experiment</Link>.
This push is the Launch Group for a previous <Link to={{ pathname: getPushDetailUrl(this.context, pushDetails.experiment_push_id) }}>experiment</Link>.
</div>
</div>
);
Expand Down Expand Up @@ -562,7 +562,7 @@ export default class PushDetails extends DashboardView {
if (error) {
promise.reject({ error });
} else {
history.pushState(null, this.context.generatePath('push/activity'));
history.push(this.context.generatePath('push/activity'));
}
}, (error) => {
promise.reject({ error });
Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/Push/PushIndex.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ export default class PushIndex extends DashboardView {
}

navigateToNew() {
history.pushState(null, this.context.generatePath('push/new'));
history.push(this.context.generatePath('push/new'));
}

navigateToDetails(objectId) {
history.pushState(null, this.context.generatePath(`push/${objectId}`));
history.push(this.context.generatePath(`push/${objectId}`));
}

handleShowMore(page) {
Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/Push/PushNew.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class PushNew extends DashboardView {
promise.reject({ error });
} else {
//TODO: global success message banner for passing successful creation - store should also be cleared
history.pushState(null, this.context.generatePath('push/activity'));
history.push(this.context.generatePath('push/activity'));
}
}, (error) => {
promise.reject(error);
Expand Down Expand Up @@ -663,7 +663,7 @@ export default class PushNew extends DashboardView {
<Fieldset
legend='Preview'
description='Double check that everything looks good!'>
<PushPreview pushState={fields} audiences={this.props.pushaudiences} />
<PushPreview push={fields} audiences={this.props.pushaudiences} />
</Fieldset>

<Toolbar section='Push' subsection='Send a new campaign' />
Expand Down
8 changes: 4 additions & 4 deletions src/dashboard/Settings/GeneralSettings.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ let ManageAppFields = ({
description='View your migration progress.' />}
input={<FormButton
color='blue'
onClick={() => history.pushState(null, '/apps/' + appSlug + '/migration')}
onClick={() => history.push('/apps/' + appSlug + '/migration')}
value='View progress' />} />
} else {
migrateAppField = [<Field
Expand Down Expand Up @@ -308,7 +308,7 @@ let ManageAppFields = ({
{cloneAppMessage ? <FormNote
show={true}
color='green'>
<div>{cloneAppMessage} Check out the progress on your <Link to='/apps'>apps page</Link>!</div>
<div>{cloneAppMessage} Check out the progress on your <Link to={{ pathname: '/apps' }}>apps page</Link>!</div>
</FormNote> : null}
{!isCollaborator ? <Field
labelWidth={DEFAULT_SETTINGS_LABEL_WIDTH}
Expand Down Expand Up @@ -427,7 +427,7 @@ export default class GeneralSettings extends DashboardView {
return promise;
}}
onClose={closeModalWithConnectionString}
onSuccess={() => history.pushState(null, '/apps/' + this.context.currentApp.slug + '/migration')}
onSuccess={() => history.push('/apps/' + this.context.currentApp.slug + '/migration')}
clearFields={() => this.setState({
migrationMongoURL: '',
migrationWarnings: [],
Expand Down Expand Up @@ -538,7 +538,7 @@ export default class GeneralSettings extends DashboardView {
inProgressText={'Deleting\u2026'}
enabled={this.state.password.length > 0}
onSubmit={() => AppsManager.deleteApp(this.context.currentApp.slug, this.state.password)}
onSuccess={result => history.pushState(null, '/apps')}
onSuccess={result => history.push('/apps')}
onClose={() => this.setState({showDeleteAppModal: false})}
clearFields={() => this.setState({password: ''})}>
{passwordField}
Expand Down
7 changes: 4 additions & 3 deletions src/dashboard/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import createBrowserHistory from 'history/lib/createBrowserHistory';
let history = createBrowserHistory();

export default history;
// Use the singleton history in react-router v2
import { browserHistory } from 'react-router'

export default browserHistory;