Skip to content

Commit 73746b3

Browse files
Yoon  ChoiYoon  Choi
authored andcommitted
merge latest pull request
2 parents dcfb4df + b3d8f88 commit 73746b3

26 files changed

+325
-119
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ ehthumbs.db
5858

5959
# proto files #
6060
#####################
61-
*.proto
61+
src/client/components/composer/protos
62+
*.proto

main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ if (
118118
dev = true;
119119
}
120120

121+
121122
// Temporary fix broken high-dpi scale factor on Windows (125% scaling)
122123
// info: https://github.com/electron/electron/issues/9691
123124
if (process.platform === 'win32') {// if user is on windows...
@@ -269,6 +270,14 @@ autoUpdater.on('update-downloaded', info => {
269270
ipcMain.on('quit-and-install', () => {
270271
autoUpdater.quitAndInstall();
271272
});
273+
// App page reloads when user selects "Refresh" from pop-up dialog
274+
ipcMain.on('fatalError', () => {
275+
console.log('received fatal error')
276+
mainWindow.reload();
277+
});
278+
ipcMain.on('uncaughtException', () => {
279+
console.log('received uncaguht fatal error')
280+
});
272281

273282
app.on('activate', () => {
274283
// On macOS it's common to re-create a window in the app when the

src/client/components/composer/ComposerContainer.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class ComposerContainer extends Component {
4040
// this.setState({
4141
// composerDisplay: this.props.composerDisplay,
4242
// });
43+
4344
}
4445

4546
componentDidUpdate() {//keeping the redux store state in sync with this component's local state

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

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ class ComposerNewRequest extends Component {
1515
this.handleSSEPayload = this.handleSSEPayload.bind(this);
1616
}
1717

18-
componentDidMount(){
19-
// console.log('this.props.newRequestSSE.isSSE: ', this.props.newRequestSSE.isSSE);
20-
}
21-
2218
requestValidationCheck() {
2319
let validationMessage;
2420
//Error conditions...
@@ -39,7 +35,6 @@ class ComposerNewRequest extends Component {
3935
validationMessage = "Missing body.";
4036
}
4137
}
42-
4338
return validationMessage || true;
4439
}
4540

@@ -257,12 +252,6 @@ class ComposerNewRequest extends Component {
257252

258253
this.props.setNewRequestStreams({
259254
...this.props.newRequestStreams,
260-
// streamsArr: [''],
261-
// streamContent: [],
262-
// selectedPackage: null,
263-
// selectedService: null,
264-
// selectedRequest: null,
265-
// selectedStreamingType: null,
266255
});
267256

268257
this.props.setNewRequestCookies({
@@ -279,45 +268,41 @@ class ComposerNewRequest extends Component {
279268
JSONFormatted: true,
280269
});
281270

271+
this.props.setNewRequestFields({
272+
...this.props.newRequestFields,
273+
method: this.props.newRequestFields.method,
274+
protocol: '',
275+
url: 'http://',
276+
graphQL: this.props.newRequestFields.graphQL,
277+
gRPC: this.props.newRequestFields.gRPC,
278+
});
279+
282280
if (this.props.newRequestFields.gRPC) {
283281
this.props.setNewRequestBody({
284282
...this.newRequestBody,
285-
bodyContent: '',
286-
bodyVariables: '',
287283
bodyType: 'GRPC',
288284
rawType: '',
289-
JSONFormatted: true,
285+
});
286+
this.props.setNewRequestFields({
287+
...this.props.newRequestFields,
288+
url: this.props.newRequestFields.url,
290289
});
291290
}
292291

293292
if (this.props.newRequestFields.graphQL) {
294293
this.props.setNewRequestBody({
295294
...this.newRequestBody,
296-
bodyContent: '',
297-
bodyVariables: '',
298295
bodyType: 'GQL',
299296
rawType: '',
300-
JSONFormatted: true,
301297
});
302298
}
303299

304-
this.props.setNewRequestFields({
305-
method: this.props.newRequestFields.method,
306-
protocol: '',
307-
url: '',
308-
graphQL: this.props.newRequestFields.graphQL,
309-
gRPC: this.props.newRequestFields.gRPC,
310-
});
311-
312-
if(this.props.newRequestFields.protocol === 'ws://') {
313-
this.props.setNewRequestFields({
314-
method: this.props.newRequestFields.method,
315-
protocol: 'ws://',
316-
url: 'ws://',
317-
graphQL: this.props.newRequestFields.graphQL,
318-
gRPC: this.props.newRequestFields.gRPC,
319-
});
320-
}
300+
if (this.props.newRequestFields.protocol === 'ws://') {
301+
this.props.setNewRequestFields({
302+
protocol: 'ws://',
303+
url: 'ws://',
304+
});
305+
}
321306
this.props.setNewRequestSSE(false);
322307
}
323308
else {

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,21 @@ class FieldEntryForm extends Component {
2525
break;
2626
}
2727
case 'protocol': {
28-
let grabbedProtocol, afterProtocol;
29-
if (!!this.props.newRequestFields.url) {
30-
grabbedProtocol = this.props.newRequestFields.url.match(/(https?:\/\/)|(localhost:)|(wss?:\/\/)/) !== null
31-
? this.props.newRequestFields.url.match(/(https?:\/\/)|(localhost:)|(wss?:\/\/)/)[0]
32-
: ""
33-
afterProtocol = this.props.newRequestFields.url.substring(grabbedProtocol.length, this.props.newRequestFields.url.length)
34-
}
35-
else afterProtocol = ''
28+
// let grabbedProtocol, afterProtocol;
29+
// if (!!this.props.newRequestFields.url) {
30+
// grabbedProtocol = this.props.newRequestFields.url.match(/(https?:\/\/)|(localhost:)|(wss?:\/\/)/) !== null
31+
// ? this.props.newRequestFields.url.match(/(https?:\/\/)|(localhost:)|(wss?:\/\/)/)[0]
32+
// : ""
33+
// afterProtocol = this.props.newRequestFields.url.substring(grabbedProtocol.length, this.props.newRequestFields.url.length)
34+
// }
35+
// else afterProtocol = ''
3636
// console.log('graphQL prop: ',graphQL)
3737
if (!!graphQL) { //if graphql
3838
this.props.setNewRequestFields({
3939
...this.props.newRequestFields,
4040
protocol: '',
41-
url: `http://${afterProtocol}`,
41+
// url: `http://${afterProtocol}`,
42+
url: 'http://',
4243
method: 'QUERY',
4344
graphQL: true,
4445
gRPC: false
@@ -56,7 +57,8 @@ class FieldEntryForm extends Component {
5657
this.props.setNewRequestFields({
5758
...this.props.newRequestFields,
5859
protocol: '',
59-
url: `http://${afterProtocol}`,
60+
// url: `http://${afterProtocol}`,
61+
url: 'http://',
6062
method: 'GET',
6163
graphQL: false,
6264
gRPC: false
@@ -72,7 +74,8 @@ class FieldEntryForm extends Component {
7274
this.props.setNewRequestFields({
7375
...this.props.newRequestFields,
7476
protocol: '',
75-
url: `${afterProtocol}`,
77+
// url: `${afterProtocol}`,
78+
url: '',
7679
method: '',
7780
graphQL: false,
7881
gRPC: true
@@ -88,7 +91,8 @@ class FieldEntryForm extends Component {
8891
this.props.setNewRequestFields({
8992
...this.props.newRequestFields,
9093
protocol: value,
91-
url: value + afterProtocol,
94+
// url: value + afterProtocol,
95+
url: 'ws://',
9296
method: '',
9397
graphQL: false,
9498
gRPC: false

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ class GRPCBodyEntryForm extends Component {
6161
}
6262
// event handler that updates state in the store when typing into the stream query body
6363
onChangeUpdateStream(streamID, value) {
64+
// if client makes additional edits to proto file after hitting save
65+
let saveProtoBtn = document.getElementById("save-proto").innerText;
66+
if (saveProtoBtn === "Changes Saved") {
67+
saveProtoBtn = "Save Changes";
68+
}
6469
const streamsArr = this.props.newRequestStreams.streamsArr;
6570
for (let i = 0; i < streamsArr.length; i++) {
6671
if (streamsArr[i].id === streamID) {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
22
import { remote } from 'electron';
33
import fs from 'fs';
44
import GRPCAutoInputForm from "./GRPCAutoInputForm.jsx";
5-
import protoParserFunc from "../protos/protoParser.js";
5+
import protoParserFunc from "../../../../client/protoParser.js";
66
import dropDownArrow from '../../../../assets/icons/arrow_drop_down_white_192x192.png';
77

88
class GRPCProtoEntryForm extends Component {
@@ -18,7 +18,7 @@ class GRPCProtoEntryForm extends Component {
1818
this.submitUpdatedProto = this.submitUpdatedProto.bind(this);
1919
}
2020

21-
// event handler on the arrow button that allows you to open/close the section
21+
// event handler on the arrow button that allows you to open/close the section
2222
toggleShow() {
2323
this.setState({
2424
show: !this.state.show
@@ -111,9 +111,9 @@ class GRPCProtoEntryForm extends Component {
111111
})
112112
}).catch((err) => console.log(err));
113113
// changes the button label from "Save Changes" to "Changes Saved"
114-
document.getElementById("save-proto").innerText = 'Changes Saved';
114+
document.getElementById("save-proto").innerText = 'Changes Saved';
115115
}
116-
116+
117117
render() {
118118
// arrow button used to collapse or open the Proto section
119119
const arrowClass = this.state.show ? 'composer_subtitle_arrow-open' : 'composer_subtitle_arrow-closed';

src/client/components/composer/protos/1000.proto

Whitespace-only changes.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
syntax = "proto3";
2+
3+
package helloworld;
4+
5+
// The greeting service definition.
6+
service Greeter {
7+
// Sends a greeting
8+
rpc SayHello (HelloRequest) returns (HelloReply) {}
9+
rpc SayHelloCS (stream HelloRequest) returns (HelloReply) {}
10+
rpc SayHellos (HelloRequest) returns (stream HelloReply) {}
11+
rpc SayHelloBidi (stream HelloRequest) returns (stream HelloReply) {}
12+
}
13+
14+
// The request message containing the user's name.
15+
message HelloRequest {
16+
string name = 1;
17+
}
18+
19+
// The response message containing the greetings
20+
message HelloReply {
21+
string message = 1;
22+
}
23+
24+
// The request message containing the user's name.
25+
message HelloHowOldRequest {
26+
int32 age = 1;
27+
}
28+
message HelloAge {
29+
int32 age = 1;
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
syntax = "proto3";
2+
3+
package helloworld;
4+
5+
// The greeting service definition.
6+
service Greeter {
7+
// Sends a greeting
8+
rpc SayHello (HelloRequest) returns (HelloReply) {}
9+
rpc SayHelloCS (stream HelloRequest) returns (HelloReply) {}
10+
rpc SayHellos (HelloRequest) returns (stream HelloReply) {}
11+
rpc SayHelloBidi (stream HelloRequest) returns (stream HelloReply) {}
12+
}
13+
14+
// The request message containing the user's name.
15+
message HelloRequest {
16+
string name = 1;
17+
}
18+
19+
// The response message containing the greetings
20+
message HelloReply {
21+
string message = 1;
22+
}
23+
24+
// The request message containing the user's name.
25+
message HelloHowOldRequest {
26+
int32 age = 1;
27+
}
28+
message HelloAge {
29+
int32 age = 1;
30+
}

0 commit comments

Comments
 (0)