From 6e1f1a442b8991e2bed1ecd54b602d7e6e7356e7 Mon Sep 17 00:00:00 2001 From: Drew Gross Date: Mon, 29 Feb 2016 09:51:07 -0800 Subject: [PATCH] Remove new app dialog --- components/Sidebar/AppsMenu.react.js | 4 +- components/Sidebar/AppsSelector.react.js | 8 +- dashboard/Apps/AppsIndex.react.js | 15 +-- dashboard/Apps/NewAppDialog.react.js | 149 ----------------------- dashboard/Apps/NewAppDialog.scss | 25 ---- 5 files changed, 5 insertions(+), 196 deletions(-) delete mode 100644 dashboard/Apps/NewAppDialog.react.js delete mode 100644 dashboard/Apps/NewAppDialog.scss diff --git a/components/Sidebar/AppsMenu.react.js b/components/Sidebar/AppsMenu.react.js index f23f259ca7..359c7d1a20 100644 --- a/components/Sidebar/AppsMenu.react.js +++ b/components/Sidebar/AppsMenu.react.js @@ -12,7 +12,7 @@ import React from 'react'; import styles from 'components/Sidebar/Sidebar.scss'; import { unselectable } from 'stylesheets/base.scss'; -let AppsMenu = ({ apps, current, height, onSelect, showCreateDialog }) => ( +let AppsMenu = ({ apps, current, height, onSelect }) => (
{current.name} @@ -29,8 +29,6 @@ let AppsMenu = ({ apps, current, height, onSelect, showCreateDialog }) => ( ); })} - - Create a new app
); diff --git a/components/Sidebar/AppsSelector.react.js b/components/Sidebar/AppsSelector.react.js index 55306c6de5..09475f55da 100644 --- a/components/Sidebar/AppsSelector.react.js +++ b/components/Sidebar/AppsSelector.react.js @@ -9,7 +9,6 @@ import AppsMenu from 'components/Sidebar/AppsMenu.react'; import { Directions } from 'lib/Constants'; import Popover from 'components/Popover/Popover.react'; import history from 'dashboard/history'; -import NewAppDialog from 'dashboard/Apps/NewAppDialog.react'; import ParseApp from 'lib/ParseApp'; import Position from 'lib/Position'; import React from 'react'; @@ -23,7 +22,6 @@ export default class AppsSelector extends React.Component { this.state = { open: false, position: null, - showDialog: false, } } @@ -35,7 +33,7 @@ export default class AppsSelector extends React.Component { componentWillReceiveProps(nextProps, nextContext) { if (this.context !== nextContext) { - this.setState({ open: false, showDialog: false }); + this.setState({ open: false }); } } @@ -76,8 +74,7 @@ export default class AppsSelector extends React.Component { apps={this.props.apps} current={this.context.currentApp} height={height} - onSelect={this.select.bind(this)} - showCreateDialog={() => this.setState({ showDialog: true })} /> + onSelect={this.select.bind(this)} /> ); } @@ -87,7 +84,6 @@ export default class AppsSelector extends React.Component { {this.context.currentApp.name}
{popover} - this.setState({ showDialog: false })} /> ); } diff --git a/dashboard/Apps/AppsIndex.react.js b/dashboard/Apps/AppsIndex.react.js index c23865bafe..a27fd11032 100644 --- a/dashboard/Apps/AppsIndex.react.js +++ b/dashboard/Apps/AppsIndex.react.js @@ -12,7 +12,6 @@ import howLongAgo from 'lib/howLongAgo'; import html from 'lib/htmlString'; import Icon from 'components/Icon/Icon.react'; import LiveReload from 'components/LiveReload/LiveReload.react'; -import NewAppDialog from 'dashboard/Apps/NewAppDialog.react'; import pluralize from 'lib/pluralize'; import prettyNumber from 'lib/prettyNumber'; import React from 'react'; @@ -108,7 +107,7 @@ let AppCard = (props) => { export default class AppsIndex extends React.Component { constructor() { super(); - this.state = { search: '', dialogOpen: false }; + this.state = { search: '' }; this.focusField = this.focusField.bind(this); } @@ -128,7 +127,7 @@ export default class AppsIndex extends React.Component { } focusField() { - if (this.refs.search && !this.state.dialogOpen) { + if (this.refs.search) { this.refs.search.focus(); } } @@ -144,9 +143,7 @@ export default class AppsIndex extends React.Component {
You don't have any apps
- this.setState({ dialogOpen: true })}>Create a new app - this.setState({ dialogOpen: false })} /> ); } @@ -161,13 +158,6 @@ export default class AppsIndex extends React.Component { onChange={this.updateSearch.bind(this)} value={this.state.search} placeholder='Start typing to filter…' /> - this.setState({ dialogOpen: true })}> - Create a new app -
    {apps.map(app => @@ -176,7 +166,6 @@ export default class AppsIndex extends React.Component { null )}
- this.setState({ dialogOpen: false })} /> ); } diff --git a/dashboard/Apps/NewAppDialog.react.js b/dashboard/Apps/NewAppDialog.react.js deleted file mode 100644 index a06ee326ae..0000000000 --- a/dashboard/Apps/NewAppDialog.react.js +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2016-present, Parse, LLC - * All rights reserved. - * - * This source code is licensed under the license found in the LICENSE file in - * the root directory of this source tree. - */ -import AppsManager from 'lib/AppsManager'; -import check_gatekeeper from 'lib/check_gatekeeper'; -import Dropdown from 'components/Dropdown/Dropdown.react'; -import DropdownOption from 'components/Dropdown/Option.react'; -import Field from 'components/Field/Field.react'; -import FormModal from 'components/FormModal/FormModal.react'; -import FormNote from 'components/FormNote/FormNote.react'; -import history from 'dashboard/history'; -import Icon from 'components/Icon/Icon.react'; -import Label from 'components/Label/Label.react'; -import Modal from 'components/Modal/Modal.react'; -import React from 'react'; -import SliderWrap from 'components/SliderWrap/SliderWrap.react'; -import styles from './NewAppDialog.scss'; -import TextInput from 'components/TextInput/TextInput.react'; -import validateAndSubmitConnectionString from 'lib/validateAndSubmitConnectionString'; -import { get } from 'lib/AJAX'; -import { Link } from 'react-router'; -import { Promise } from 'parse'; - - -export default class NewAppDialog extends React.Component { - constructor() { - super(); - this.state = { - name: '', - databaseType: 'parse', - connectionURL: '', - connectionWarnings: [], - showConnectionValidationErrors: true, - }; - } - - render() { - let needsConnectionString = this.state.databaseType == 'custom'; - let hasValidName = this.state.name.length > 0 && !AppsManager.findAppByName(this.state.name); - let valid = hasValidName && (!needsConnectionString || this.state.connectionURL); - - let customDBWarning = this.state.databaseType === 'custom' ? - Important: You will not be able to change the database type after creation. - : null; - let URLfield = - - - } - input={ this.setState({ - connectionURL: url, - connectionWarnings: [], - })}/> - }/> - ; - let mongoURLField = check_gatekeeper('show_new_app_form_connection_string') ? [ - Learn more about database types} />} - input={ - this.setState({databaseType: value})} - value={this.state.databaseType} > - -
-
Parse Data
-
Let Parse manage your database for you.
-
-
- -
-
Custom (expert)
-
Provide your own database endpoint.
-
-
-
- } - />, - customDBWarning, - URLfield, - ] : null; - return ( - { - if (this.state.databaseType === 'custom') { - let promise = validateAndSubmitConnectionString( - this.state.connectionURL, - this.state.connectionWarnings, - warnings => this.setState({connectionWarnings: warnings}), - connectionString => AppsManager.create(this.state.name, connectionString) - ); - promise.fail(({ error }) => this.setState({ showConnectionValidationErrors: error !== 'Warnings' })); - return promise; - } else { - return AppsManager.create(this.state.name); - } - }} - showErrors={this.state.showConnectionValidationErrors} - onClose={this.props.onCancel} - icon='blank-app-outline' - iconSize={30} - subtitle='Just give it a name first…' - submitText={this.state.connectionWarnings && this.state.connectionWarnings.length > 0 ? 'Make it anyway' : 'Make it!'} - inProgressText={'Making it\u2026'} - onSuccess={({ slug }) => history.pushState(null, `/apps/${slug}/browser`)} - clearFields={() => this.setState({ - name: '', - connectionURL: '', - connectionWarnings: [], - })} - enabled={valid}> - - } - input={ - this.setState({ name: name })} /> - } /> - {mongoURLField} - {this.state.connectionWarnings.map(warning => {warning})} - - ); - } -} diff --git a/dashboard/Apps/NewAppDialog.scss b/dashboard/Apps/NewAppDialog.scss deleted file mode 100644 index 3837cd50f2..0000000000 --- a/dashboard/Apps/NewAppDialog.scss +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2016-present, Parse, LLC - * All rights reserved. - * - * This source code is licensed under the license found in the LICENSE file in - * the root directory of this source tree. - */ -@import 'stylesheets/globals.scss'; - -.option { - padding: 20px 50px 20px 14px; - white-space: normal; - text-align: left; - line-height: normal; - color: $blue; -} - -.optionTitleNote { - font-size: 12px; -} - -.optionDescription { - font-size: 12px; - color: $mainTextColor; -}