-
- {Object.keys(this._prompts).map(id => {
- const promptDef = this._prompts[id];
- const modal = modals.find(m => m.id === id);
+
+ {Object.keys(this._prompts).map(id => {
+ const promptDef = this._prompts[id];
+ const modal = modals.find(m => m.id === id);
- if (!modal) {
- return null;
- }
+ if (!modal) {
+ return null;
+ }
- return (
-
actions.hideModal(modal.id)}
- onSubmit={value => promptDef.onSubmit(modal, value)}
- />
- )
- })}
-
-
- {this._modals.map(c => {
- const id = c.defaultProps.id;
- const isVisible = modals.find(m => m.id === id);
- const modal = React.createElement(c, {
- key: id,
- onClose: () => actions.hideModal(id)
- });
- return isVisible ? modal : null;
- })}
-
-
- {/*
-
Request deleted
-
-
*/}
-
+ return (
+
actions.hideModal(modal.id)}
+ onSubmit={value => promptDef.onSubmit(modal, value)}
+ />
+ )
+ })}
);
}
}
-Modals.propTypes = {
+Prompts.propTypes = {
actions: PropTypes.shape({
hideModal: PropTypes.func.isRequired,
updateRequestGroup: PropTypes.func.isRequired,
@@ -113,5 +89,5 @@ function mapDispatchToProps (dispatch) {
export default connect(
mapStateToProps,
mapDispatchToProps
-)(Modals);
+)(Prompts);
diff --git a/app/components/modals/RequestGroupEnvironmentEditModal.js b/app/components/modals/RequestGroupEnvironmentEditModal.js
new file mode 100644
index 000000000..4bcd37810
--- /dev/null
+++ b/app/components/modals/RequestGroupEnvironmentEditModal.js
@@ -0,0 +1,65 @@
+import React, {Component, PropTypes} from 'react'
+import Modal from '../base/Modal'
+import ModalBody from '../base/ModalBody'
+import ModalHeader from '../base/ModalHeader'
+import ModalFooter from '../base/ModalFooter'
+import Editor from '../base/Editor'
+import KeyValueEditor from '../base/KeyValueEditor'
+import * as modalIds from '../../constants/modals'
+
+class RequestGroupEnvironmentEditModal extends Component {
+ constructor (props) {
+ super(props);
+ this.state = {
+ pairs: []
+ }
+ }
+
+ _saveChanges () {
+ this.props.onChange(this.state.pairs);
+ }
+
+ _keyValueChange (pairs) {
+ this.setState({pairs});
+ }
+
+ render () {
+ const editorOptions = {
+ mode: 'application/json',
+ placeholder: '{ "array": [1, 2, 3, 4] }',
+ theme: 'neat'
+ };
+
+ return (
+
+ Environment Variables
+
+
+
+
+ {/*
+ Hello
+
+ */}
+
+
+
+
+
+ );
+ }
+}
+
+RequestGroupEnvironmentEditModal.propTypes = {
+ // requestGroup: PropTypes.object.isRequired,
+ onChange: PropTypes.func.isRequired
+};
+
+RequestGroupEnvironmentEditModal.defaultProps = {
+ id: modalIds.ENVIRONMENT_EDITOR
+};
+
+export default RequestGroupEnvironmentEditModal;
diff --git a/app/containers/App.js b/app/containers/App.js
index 152a56a5d..3b6adde7b 100644
--- a/app/containers/App.js
+++ b/app/containers/App.js
@@ -4,17 +4,19 @@ import {bindActionCreators} from 'redux'
import {Tab, Tabs, TabList, TabPanel} from 'react-tabs'
import Editor from '../components/base/Editor'
-import Modals from '../components/modals/ModalContainer'
+import Prompts from '../components/modals/Prompts'
import KeyValueEditor from '../components/base/KeyValueEditor'
import RequestBodyEditor from '../components/RequestBodyEditor'
import RequestAuthEditor from '../components/RequestAuthEditor'
import RequestUrlBar from '../components/RequestUrlBar'
import Sidebar from '../components/Sidebar'
+import RequestGroupEnvironmentEditModal from '../components/modals/RequestGroupEnvironmentEditModal'
import * as GlobalActions from '../actions/global'
import * as RequestGroupActions from '../actions/requestGroups'
import * as RequestActions from '../actions/requests'
import * as ResponseActions from '../actions/responses'
+import * as ModalActions from '../actions/modals'
// Don't inject component styles (use our own)
Tabs.setUseDefaultStyles(false);
@@ -144,13 +146,19 @@ class App extends Component {
}
render () {
- const {actions, requests, responses, requestGroups, tabs} = this.props;
+ const {actions, requests, responses, requestGroups, tabs, modals} = this.props;
const activeRequest = requests.all.find(r => r.id === requests.active);
const activeResponse = responses[activeRequest && activeRequest.id];
return (
-
+
+ {!modals.find(m => m.id === RequestGroupEnvironmentEditModal.defaultProps.id) ? null : (
+
actions.hideModal(RequestGroupEnvironmentEditModal.defaultProps.id)}
+ onChange={v => console.log(v)}
+ />
+ )}
/node_modules/redux-thunk",
+ "/node_modules/redux-mock-store",
+ "/node_modules/nunjucks",
+ "/node_modules/jsonschema",
"/node_modules/react",
"/node_modules/react-dom",
"/node_modules/react-addons-test-utils"
+ ],
+ "testFileExtensions": [
+ "test.js"
+ ],
+ "moduleFileExtensions": [
+ "js",
+ "electron.js",
+ "chrome.js"
]
}
}
diff --git a/webpack/dev.electron.config.js b/webpack/dev.electron.config.js
index 73b053112..86871e485 100644
--- a/webpack/dev.electron.config.js
+++ b/webpack/dev.electron.config.js
@@ -37,7 +37,8 @@ base.plugins = [
base.target = webpackTargetElectronRenderer(base);
-base.resolve.extensions.push('electron.js');
+base.resolve.extensions.push('.electron.js');
+console.log(base);
module.exports = base;