Skip to content

Fix dashboard not applying mounting point when linking or redirecting to another page #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 14 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions src/components/Sidebar/AppsMenu.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import AppBadge from 'components/AppBadge/AppBadge.react';
import html from 'lib/htmlString';
import { Link } from 'react-router-dom';
import React from 'react';
import styles from 'components/Sidebar/Sidebar.scss';
import { unselectable } from 'stylesheets/base.scss';
import AppBadge from 'components/AppBadge/AppBadge.react';
import html from 'lib/htmlString';
import { Link } from 'react-router-dom';
import React from 'react';
import styles from 'components/Sidebar/Sidebar.scss';
import { unselectable } from 'stylesheets/base.scss';
import { applyMountPath } from "lib/path";

let AppsMenu = ({ apps, current, height, onSelect }) => (
<div style={{ height }} className={[styles.appsMenu, unselectable].join(' ')}>
Expand All @@ -23,7 +24,7 @@ let AppsMenu = ({ apps, current, height, onSelect }) => (
return null;
}
return (
<Link to={{ pathname: html`/apps/${app.slug}/browser` }} key={app.slug} className={styles.menuRow}>
<Link to={{ pathname: applyMountPath(`apps/${app.slug}/browser`) }} key={app.slug} className={styles.menuRow}>
{app.name}
<AppBadge production={app.production} />
</Link>
Expand Down
21 changes: 11 additions & 10 deletions src/components/Sidebar/AppsSelector.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import PropTypes from 'lib/PropTypes';
import AppsMenu from 'components/Sidebar/AppsMenu.react';
import Popover from 'components/Popover/Popover.react';
import history from 'dashboard/history';
import ParseApp from 'lib/ParseApp';
import Position from 'lib/Position';
import React from 'react';
import ReactDOM from 'react-dom';
import styles from 'components/Sidebar/Sidebar.scss';
import PropTypes from 'lib/PropTypes';
import AppsMenu from 'components/Sidebar/AppsMenu.react';
import Popover from 'components/Popover/Popover.react';
import history from 'dashboard/history';
import ParseApp from 'lib/ParseApp';
import Position from 'lib/Position';
import React from 'react';
import ReactDOM from 'react-dom';
import styles from 'components/Sidebar/Sidebar.scss';
import { applyMountPath } from "lib/path";

export default class AppsSelector extends React.Component {
constructor() {
Expand Down Expand Up @@ -58,7 +59,7 @@ export default class AppsSelector extends React.Component {
if (sections[0] === '') {
sections.shift();
}
history.push(`/apps/${value}/${sections[2]}`);
history.push(applyMountPath(`apps/${value}/${sections[2]}`));
}
});
}
Expand Down
15 changes: 7 additions & 8 deletions src/components/Sidebar/FooterMenu.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import Icon from 'components/Icon/Icon.react';
import Popover from 'components/Popover/Popover.react';
import Position from 'lib/Position';
import React from 'react';
import styles from 'components/Sidebar/Sidebar.scss';

let mountPath = window.PARSE_DASHBOARD_PATH;
import Icon from 'components/Icon/Icon.react';
import Popover from 'components/Popover/Popover.react';
import Position from 'lib/Position';
import React from 'react';
import styles from 'components/Sidebar/Sidebar.scss';
import { applyMountPath } from 'lib/path';

export default class FooterMenu extends React.Component {
constructor() {
Expand Down Expand Up @@ -41,7 +40,7 @@ export default class FooterMenu extends React.Component {
position={this.state.position}
onExternalClick={() => this.setState({ show: false })}>
<div className={styles.popup}>
<a href={`${mountPath}logout`}>Log Out <span className={styles.emoji}>👋</span></a>
<a href={applyMountPath('logout')}>Log Out <span className={styles.emoji}>👋</span></a>
<a target='_blank' href='http://docs.parseplatform.org/parse-server/guide/'>Server Guide <span className={styles.emoji}>📚</span></a>
<a target='_blank' href='http://stackoverflow.com/questions/tagged/parse.com'>Code-level Questions <span className={styles.emoji}>❓</span></a>
<a target='_blank' href='http://stackoverflow.com/questions/tagged/parse-server'>Server Questions <span className={styles.emoji}>❓</span></a>
Expand Down
14 changes: 7 additions & 7 deletions src/components/Sidebar/SidebarHeader.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import Icon from 'components/Icon/Icon.react';
import { Link } from 'react-router-dom';
import React from 'react';
import styles from 'components/Sidebar/Sidebar.scss';
import Icon from 'components/Icon/Icon.react';
import { Link } from 'react-router-dom';
import React from 'react';
import styles from 'components/Sidebar/Sidebar.scss';
import { mountPath, applyMountPath } from 'lib/path';
// get the package.json environment variable
const version = process.env.version;

Expand All @@ -18,18 +19,17 @@ export default class SidebarHeader extends React.Component {
this.state = { };
}
componentWillMount() {
let mountPath = window.PARSE_DASHBOARD_PATH;
fetch(mountPath).then(response => {
this.setState({ dashboardUser: response.headers.get('username') });
});
}
render() {
return (
<div className={styles.header}>
<Link className={styles.logo} to={{ pathname: '/apps' }}>
<Link className={styles.logo} to={{ pathname: applyMountPath('apps') }}>
<Icon width={28} height={28} name='infinity' fill={'#ffffff'} />
</Link>
<Link to='/apps'>
<Link to={applyMountPath('apps')}>
<div className={styles.version}>
<div>
Parse Dashboard {version}
Expand Down
19 changes: 10 additions & 9 deletions src/dashboard/AppData.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
import React from 'react';
import PropTypes from 'lib/PropTypes';
import AppSelector from 'dashboard/AppSelector.react';
import AppsManager from 'lib/AppsManager';
import history from 'dashboard/history';
import ParseApp from 'lib/ParseApp';
import createClass from 'create-react-class';
import React from 'react';
import PropTypes from 'lib/PropTypes';
import AppSelector from 'dashboard/AppSelector.react';
import AppsManager from 'lib/AppsManager';
import history from 'dashboard/history';
import ParseApp from 'lib/ParseApp';
import createClass from 'create-react-class';
import { applyMountPath } from 'lib/path';

let AppData = createClass({
childContextTypes: {
Expand All @@ -27,7 +28,7 @@ let AppData = createClass({
},

generatePath(path) {
return '/apps/' + this.props.params.appId + '/' + path;
return applyMountPath('apps/' + this.props.params.appId + '/' + path);
},

render() {
Expand All @@ -39,7 +40,7 @@ let AppData = createClass({
if (current) {
current.setParseKeys();
} else {
history.replace('/apps');
history.replace(applyMountPath('apps'));
return <div />;
}
return (
Expand Down
Loading