Don't allow dialogs' inputs to be empty, show an error in that case
This commit is contained in:
parent
a88ff826e7
commit
ccf24e513b
@ -31593,6 +31593,7 @@ var _store = require('store');
|
||||
var _store2 = _interopRequireDefault(_store);
|
||||
|
||||
var INVALID_NAME = 'Please enter a valid name.';
|
||||
var INVALID_SEARCH = 'You can\'t leave the input empty';
|
||||
|
||||
exports['default'] = {
|
||||
createDialog: {
|
||||
@ -31604,7 +31605,12 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
if (!input.value) {
|
||||
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||
this.props.dispatch((0, _actionsFile.active)());
|
||||
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||
return;
|
||||
}
|
||||
|
||||
var cwd = _store2['default'].getState().get('cwd');
|
||||
var path = cwd + '/' + input.value;
|
||||
@ -31619,7 +31625,12 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
if (!input.value) {
|
||||
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||
this.props.dispatch((0, _actionsFile.active)());
|
||||
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||
return;
|
||||
}
|
||||
|
||||
var cwd = _store2['default'].getState().get('cwd');
|
||||
var path = cwd + '/' + input.value;
|
||||
@ -31654,7 +31665,12 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
if (!input.value) {
|
||||
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||
this.props.dispatch((0, _actionsFile.active)());
|
||||
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME }));
|
||||
return;
|
||||
}
|
||||
|
||||
var activeFile = _store2['default'].getState().get('activeFile');
|
||||
this.props.dispatch((0, _actionsFile.rename)(activeFile, input.value));
|
||||
@ -31705,7 +31721,12 @@ exports['default'] = {
|
||||
action: function action() {
|
||||
var input = _react2['default'].findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) (0, _actionsDialog.show)('errorDialog', { description: INVALID_NAME });
|
||||
if (!input.value) {
|
||||
this.props.dispatch((0, _actionsDialog.hideAll)());
|
||||
this.props.dispatch((0, _actionsFile.active)());
|
||||
this.props.dispatch((0, _actionsDialog.show)('errorDialog', { description: INVALID_SEARCH }));
|
||||
return;
|
||||
}
|
||||
|
||||
var action = (0, _actionsFilesView.search)(input.value);
|
||||
this.props.dispatch(action);
|
||||
|
@ -5,6 +5,7 @@ import { search } from 'actions/files-view';
|
||||
import store, { bind } from 'store';
|
||||
|
||||
const INVALID_NAME = 'Please enter a valid name.';
|
||||
const INVALID_SEARCH = 'You can\'t leave the input empty';
|
||||
|
||||
export default {
|
||||
createDialog: {
|
||||
@ -17,7 +18,12 @@ export default {
|
||||
action() {
|
||||
let input = React.findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
||||
if (!input.value) {
|
||||
this.props.dispatch(hideAll());
|
||||
this.props.dispatch(active());
|
||||
this.props.dispatch(show('errorDialog', {description: INVALID_NAME}));
|
||||
return;
|
||||
}
|
||||
|
||||
let cwd = store.getState().get('cwd');
|
||||
let path = cwd + '/' + input.value;
|
||||
@ -33,7 +39,12 @@ export default {
|
||||
action() {
|
||||
let input = React.findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
||||
if (!input.value) {
|
||||
this.props.dispatch(hideAll());
|
||||
this.props.dispatch(active());
|
||||
this.props.dispatch(show('errorDialog', {description: INVALID_NAME}));
|
||||
return;
|
||||
}
|
||||
|
||||
let cwd = store.getState().get('cwd');
|
||||
let path = cwd + '/' + input.value;
|
||||
@ -72,7 +83,12 @@ export default {
|
||||
action() {
|
||||
let input = React.findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
||||
if (!input.value) {
|
||||
this.props.dispatch(hideAll());
|
||||
this.props.dispatch(active());
|
||||
this.props.dispatch(show('errorDialog', {description: INVALID_NAME}));
|
||||
return;
|
||||
}
|
||||
|
||||
let activeFile = store.getState().get('activeFile');
|
||||
this.props.dispatch(rename(activeFile, input.value))
|
||||
@ -129,7 +145,12 @@ export default {
|
||||
action() {
|
||||
let input = React.findDOMNode(this.refs.input);
|
||||
|
||||
if (!input.value) show('errorDialog', {description: INVALID_NAME});
|
||||
if (!input.value) {
|
||||
this.props.dispatch(hideAll());
|
||||
this.props.dispatch(active());
|
||||
this.props.dispatch(show('errorDialog', {description: INVALID_SEARCH}));
|
||||
return;
|
||||
}
|
||||
|
||||
let action = search(input.value);
|
||||
this.props.dispatch(action);
|
||||
|
Loading…
Reference in New Issue
Block a user