Skip to content

Commit 86419f9

Browse files
authored
Merge pull request #238 from open-source-labs/final-touches
Final touches
2 parents 6c649d6 + 44af48b commit 86419f9

20 files changed

+81
-147
lines changed

__tests__/businessReducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Business reducer', () => {
1313
newRequestFields: {
1414
method: 'GET',
1515
protocol: '',
16-
url: '',
16+
url: 'http://',
1717
graphQL: false
1818
},
1919
newRequestHeaders: {

__tests__/responseTests.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ describe('ResponseEventsDisplay', () => {
8282
describe('ResponseSubscriptionDisplay', () => {
8383
let props;
8484
let wrapper;
85-
let client;
8685
const testURL = 'https://swell-test-graphql.herokuapp.com';
8786
beforeAll(() => {
8887
props = {
@@ -113,9 +112,7 @@ describe('ResponseSubscriptionDisplay', () => {
113112
wrapper = renderer.create(<ResponseSubscriptionDisplay {...props} />);
114113

115114
});
116-
it('should initialize as listening', () => {
115+
xit('should initialize as listening', () => {
117116
expect(wrapper).toMatchSnapshot();
118117
});
119-
xit('should update when the data source updates', () => {
120-
});
121118
});

main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ const tbClearAllButton = new TouchBarButton({
7777
label: 'Clear All',
7878
backgroundColor: '#708090',
7979
click: () => {
80-
// console.log('clearing all');
8180
mainWindow.webContents.send('clearAll');
8281
},
8382
});

package-lock.json

Lines changed: 23 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
"dependencies": {
131131
"apollo-cache-inmemory": "^1.6.2",
132132
"apollo-client": "^2.6.3",
133-
"apollo-link-context": "^1.0.18",
134133
"apollo-link-http": "^1.5.15",
135134
"apollo-link-ws": "^1.0.18",
136135
"chart.js": "^2.7.3",
@@ -194,6 +193,7 @@
194193
"postcss-loader": "^3.0.0",
195194
"postcss-nested": "^4.1.0",
196195
"postcss-pxtorem": "^4.0.1",
196+
"react-test-renderer": "^16.9.0",
197197
"redux-devtools-extension": "^2.13.2",
198198
"sass-loader": "^7.1.0",
199199
"style-loader": "^0.23.1",

src/client/components/composer/NewRequest/ComposerNewRequest.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ComposerNewRequest extends Component {
4343
const protocol = this.props.newRequestFields.url.match(/(https?:\/\/)|(wss?:\/\/)/)[0]
4444

4545
// HTTP && GRAPHQL REQUESTS
46-
if (this.props.newRequestFields.protocol !== 'ws://') {
46+
if (!/wss?:\/\//.test(this.props.newRequestFields.protocol)) {
4747
let URIWithoutProtocol = `${this.props.newRequestFields.url.split(protocol)[1]}/`;
4848
const host = protocol + URIWithoutProtocol.split('/')[0];
4949
let path = `/${URIWithoutProtocol.split('/')
@@ -157,10 +157,10 @@ class ComposerNewRequest extends Component {
157157

158158
render() {
159159
let HeaderEntryFormStyle = { //trying to change style to conditional created strange duplication effect when continuously changing protocol
160-
display: this.props.newRequestFields.protocol !== 'ws://' ? 'block' : 'none',
160+
display: !/wss?:\/\//.test(this.props.newRequestFields.protocol) ? 'block' : 'none',
161161
}
162162
let SubmitButtonClassName = "composer_submit";
163-
if (this.props.newRequestFields.protocol === "ws://") { SubmitButtonClassName += " ws" }
163+
if (/wss?:\/\//.test(this.props.newRequestFields.protocol)) { SubmitButtonClassName += " ws" }
164164
else if (this.props.newRequestFields.graphQL) { SubmitButtonClassName += " gql" }
165165
else { SubmitButtonClassName += " http" }
166166

@@ -190,15 +190,18 @@ class ComposerNewRequest extends Component {
190190
/>
191191

192192
{
193-
this.props.newRequestFields.method && this.props.newRequestFields.protocol !== 'ws://' &&
193+
this.props.newRequestFields.method && !/wss?:\/\//.test(this.props.newRequestFields.protocol) &&
194194
<CookieEntryForm
195195
newRequestCookies={this.props.newRequestCookies}
196196
newRequestBody={this.props.newRequestBody}
197197
setNewRequestCookies={this.props.setNewRequestCookies}
198198
/>
199199
}
200200
{
201-
!this.props.newRequestFields.graphQL && this.props.newRequestFields.method !== 'GET' && this.props.newRequestFields.protocol !== 'ws://' &&
201+
!this.props.newRequestFields.graphQL
202+
&& this.props.newRequestFields.method !== 'GET'
203+
&& !/wss?:\/\//.test(this.props.newRequestFields.protocol)
204+
&&
202205
<BodyEntryForm
203206
newRequestHeaders={this.props.newRequestHeaders}
204207
newRequestBody={this.props.newRequestBody}

src/client/components/composer/NewRequest/FieldEntryForm.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class FieldEntryForm extends Component {
2424
let grabbedProtocol, afterProtocol;
2525
if (!!this.props.newRequestFields.url) {
2626
grabbedProtocol = this.props.newRequestFields.url.match(/(https?:\/\/)|(wss?:\/\/)/) !== null
27-
? this.props.newRequestFields.url.match(/(https?:\/\/)|(wss?:\/\/)/)[0]
28-
: ""
27+
? this.props.newRequestFields.url.match(/(https?:\/\/)|(wss?:\/\/)/)[0]
28+
: ""
2929
afterProtocol = this.props.newRequestFields.url.substring(grabbedProtocol.length, this.props.newRequestFields.url.length)
3030
}
3131
else afterProtocol = ''
@@ -151,7 +151,7 @@ class FieldEntryForm extends Component {
151151

152152
{/* below conditional method selection rendering for http/s */}
153153
{
154-
this.props.newRequestFields.protocol !== 'ws://' && !this.props.newRequestFields.graphQL &&
154+
!/wss?:\/\//.test(this.props.newRequestFields.protocol) && !this.props.newRequestFields.graphQL &&
155155

156156
<select style={{ display: 'block' }} value={this.props.newRequestFields.method} className={'composer_method_select http'} onChange={(e) => {
157157
this.onChangeHandler(e, 'method')
@@ -165,7 +165,7 @@ class FieldEntryForm extends Component {
165165
}
166166
{/* below conditional method selection rendering for graphql */}
167167
{
168-
this.props.newRequestFields.protocol !== 'ws://' && this.props.newRequestFields.graphQL &&
168+
!/wss?:\/\//.test(this.props.newRequestFields.protocol) && this.props.newRequestFields.graphQL &&
169169

170170
<select style={{ display: 'block' }} value={this.props.newRequestFields.method} className={'composer_method_select gql'} onChange={(e) => {
171171
this.onChangeHandler(e, 'method')

src/client/components/composer/NewRequest/ProtocolSelect.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ProtocolSelect extends Component {
1717
const WSStyleClasses = classNames({
1818
composer_protocol_button: true,
1919
ws: true,
20-
'composer_protocol_button-selected_ws': this.props.currentProtocol === 'ws://',
20+
'composer_protocol_button-selected_ws': /wss?:\/\//.test(this.props.currentProtocol),
2121
});
2222
const GQLStyleClasses = classNames({
2323
composer_protocol_button: true,

src/client/components/containers/App.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class App extends Component {
2222
ipcRenderer.on('minimizeAll', ReqResCtrl.minimizeAllReqRes);
2323
ipcRenderer.on('expandAll', ReqResCtrl.expandAllReqRes);
2424
ipcRenderer.on('clearAll', ReqResCtrl.clearAllReqRes);
25-
ipcRenderer.on('message', (e, text) => {
26-
// console.log('Message from updater: ', text)
27-
});
2825
historyController.getHistory();
2926
collectionsController.getCollections();
3027

@@ -33,7 +30,7 @@ class App extends Component {
3330
render() {
3431
return (
3532
<div id="app">
36-
<UpdatePopUpContainer/>
33+
<UpdatePopUpContainer />
3734
<SidebarContainer />
3835
<ContentsContainer />
3936
</div>

src/client/components/containers/NavBarContainer.jsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ class NavBarContainer extends Component {
3737
const inputName = document.querySelector('#collectionNameInput').value;
3838
if (!!inputName.trim()) {
3939
collectionsController.collectionNameExists({ name: inputName })
40-
.catch((err) => console.log("error in checking collection name: ", err))
41-
.then((found) => {
42-
if (found) { //if the name already exists
43-
document.querySelector('#collectionNameInput').setAttribute("style", "border-color: red;");
44-
document.querySelector('#collectionNameError').setAttribute("style", "display: block");
45-
}
46-
else this.saveCollection(inputName)
47-
})
40+
.catch((err) => console.error("error in checking collection name: ", err))
41+
.then((found) => {
42+
if (found) { //if the name already exists
43+
document.querySelector('#collectionNameInput').setAttribute("style", "border-color: red;");
44+
document.querySelector('#collectionNameError').setAttribute("style", "display: block");
45+
}
46+
else this.saveCollection(inputName)
47+
})
4848
}
4949
}
5050
saveCollection(inputName) {
@@ -56,12 +56,12 @@ class NavBarContainer extends Component {
5656
reqRes.timeReceived = null;
5757
reqRes.connection = 'uninitialized';
5858
if (reqRes.response.hasOwnProperty('headers')) reqRes.response = { headers: null, events: null }
59-
else reqRes.response = {messages: []}
59+
else reqRes.response = { messages: [] }
6060
});
6161
const collectionObj = {
6262
name: inputName,
6363
id: uuid(),
64-
created_at: new Date(),
64+
created_at: new Date(),
6565
reqResArray: clonedArray
6666
}
6767
collectionsController.addCollectionToIndexedDb(collectionObj); //add to IndexedDB
@@ -127,8 +127,8 @@ class NavBarContainer extends Component {
127127
}}
128128
>
129129
<h1 id="heading">What would you like to name your collection?</h1>
130-
<input type={'text'} id="collectionNameInput" onKeyDown={(e) => this.handleKeyPress(e)} autoFocus/>
131-
<p id="collectionNameError" style={{display:'none'}}>Collection name already exists!</p>
130+
<input type={'text'} id="collectionNameInput" onKeyDown={(e) => this.handleKeyPress(e)} autoFocus />
131+
<p id="collectionNameError" style={{ display: 'none' }}>Collection name already exists!</p>
132132
<div>
133133
<button onClick={this.saveName}>Save</button>
134134
<button onClick={this.handleCloseModal}>Cancel</button>

0 commit comments

Comments
 (0)