Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Ngrok Debugger Implementation #2032

Merged
merged 30 commits into from
Jan 11, 2020
Merged

Conversation

srinaath
Copy link
Contributor

@srinaath srinaath commented Jan 6, 2020

Ngrok Debug Console
Added console window to track tunnel errors
Pinned React version
More unit tests coverage in future PR's

Srinaath Ravichandran added 13 commits January 5, 2020 20:50
rerendering debug console on props change

Error viewer console completed
Copy file spec completed

Ngrok tunnel action spec updated
Ngrok module tests

Testing tunnel error generation and capture scenarios
Code cleanup

Renaming functions, test names, using shorthands wherever applicable
Updated icon for ngrok Status
Lock files updated after pull from master
@coveralls
Copy link

coveralls commented Jan 6, 2020

Coverage Status

Coverage increased (+0.1%) to 68.869% when pulling 6c08711 on srravich/1973-ngrok-debugger into d496897 on master.

@srinaath srinaath changed the title WIP: Srravich/1973 ngrok debugger WIP: Ngrok Debugger Implementation Jan 6, 2020
@cwhitten
Copy link
Member

cwhitten commented Jan 6, 2020

@srinaath will remove the clients package-lock.json

@@ -2,6 +2,7 @@

# dependencies
/node_modules
package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could instead add an entry to the root level .gitignore that ignores every lock file except for the root one?

/packages/**/package-lock.json

and then delete the sub-root-level lock files?

packages/app/client/src/constants.ts Outdated Show resolved Hide resolved
packages/app/client/src/state/reducers/ngrokTunnel.ts Outdated Show resolved Hide resolved
logPath: string;
postmanCollectionPath: string;
tunnelStatus: TunnelStatus;
lastTunnelStatusCheckTS: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider expanding to lastTunnelStatusCheckTimestamp for readability

fs.copyFile(sourcePath, destinationPath, err => {
if (err) {
// eslint-disable-next-line no-console
console.error(`Error copying file: ${err}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe move this to the reject call so that it is surfaced to whatever context calls it:

reject(Error copying file: ${err});

// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

export default {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we prefer to use explicitly named exports in this project:

export const PostmanNgrokCollection = { ... };

Comment on lines 200 to 207
protected async copyFile(sourcePath: string, destinationPath: string) {
try {
await copyFileAsync(sourcePath, destinationPath);
return true;
} catch (ex) {
return false;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this returns true and false? The only code that calls this in your PR calls it and doesn't worry about the return value because it is being called as the resolver of the executeCommand() action

@@ -93,7 +99,30 @@ export class NgrokInstance {
return this.pendingConnection;
}
await this.getNgrokInspectUrl(options);
return this.runTunnel(options);
const tunnelInfo: { url; inspectUrl } = await this.runTunnel(options);
this.intervalForHealthCheck = setInterval(() => this.checkTunnelStatus.bind(this)(tunnelInfo.url), 60000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small optimization could be to pull the code that binds the function out of the setInterval() call so that .bind() is not called every time the function fires per interval:

const boundCheckTunnelStatus = this.checkTunnelStatus.bind(this);
this.intervalForHealthCheck = setInterval(() => boundCheckTunnelStatus(tunnelInfo.url), 60000);

Srinaath Ravichandran added 7 commits January 9, 2020 10:12
1. Added space after breaks
2. Seperating container and actual visual component
3. Removing nbsp
4. Adding package-locks to gitignore

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
1.Using named exports
2. Returning errors from rejects
3. Removed dev artifacts

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
1. Added space after breaks
2. Seperating container and actual visual component
3. Removing nbsp
4. Adding package-locks to gitignore

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Pre feedback addressed

1.Using named exports
2. Returning errors from rejects
3. Removed dev artifacts

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Made sure all pacjage locks are removed and spacing between cases

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Untracked Package Locks

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Untracked and deleted package locks

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more minor comments.

Comments tag removed
Typos fixed

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>

Removed unused functions

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
return (
<>
<legend>
Looks like you have hit your free tier limit on connections to your tunnel. These are few solutions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed this one last time: These are few solutions.

Maybe try something like:

(Consider | Try) the following solutions.

or

Below you will find several possible solutions.

tonyanziano
tonyanziano previously approved these changes Jan 10, 2020
Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment. Once that's fixed I think this is good to go!

Signed-off-by: Srinaath Ravichandran <srravich@microsoft.com>
Copy link
Contributor

@tonyanziano tonyanziano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! 👏

@srinaath
Copy link
Contributor Author

Great job! 👏

Thanks @tonyanziano

@srinaath srinaath merged commit cea9a86 into master Jan 11, 2020
@srinaath srinaath deleted the srravich/1973-ngrok-debugger branch January 11, 2020 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants