From 3b847212d3298bf1861b4aa56f5a1988cc2b951a Mon Sep 17 00:00:00 2001 From: Thomas Gamble Date: Wed, 6 Apr 2016 08:29:53 -0700 Subject: [PATCH 1/2] updated status code format --- src/main/resources/static/scripts/Entry.js | 2 +- src/main/resources/static/scripts/EntryForm.js | 5 ++--- .../resources/static/scripts/__test__/EntryTest.js | 13 +++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/resources/static/scripts/Entry.js b/src/main/resources/static/scripts/Entry.js index f0ab494f..fedca34b 100644 --- a/src/main/resources/static/scripts/Entry.js +++ b/src/main/resources/static/scripts/Entry.js @@ -40,7 +40,7 @@ var Entry = React.createClass({ if(Object.keys(this.state.status).length) { connectionStyle = this.state.status.canConnect ? {color: 'green'} : {color: 'red'}; if(this.state.status.statusCode) { - resultString += " statusCode - " + this.state.status.statusCode; + resultString += " status: " + this.state.status.statusCode; } } diff --git a/src/main/resources/static/scripts/EntryForm.js b/src/main/resources/static/scripts/EntryForm.js index e012b44f..195df4ef 100644 --- a/src/main/resources/static/scripts/EntryForm.js +++ b/src/main/resources/static/scripts/EntryForm.js @@ -21,12 +21,12 @@ var EntryForm = React.createClass({ var port = this.refs.port.getValue(); if (!this.isValid()) { - mixpanel.track("connect attempted with invalid form"); + mixpanel.track("failed connect attempted", {"type": "invalid form"}); return; } if(this.state.isChecked) { - mixpanel.track("connect attempted with proxy"); + mixpanel.track("failed connect attempted", {"type": "invalid form"}); proxyHost = this.refs.proxyHost.getValue(); proxyPort = this.refs.proxyPort.getValue(); } @@ -48,7 +48,6 @@ var EntryForm = React.createClass({ hostUpdate: function() { if(!this.isPortRequired()) { this.setState({isPortRequired:false}); - this.forceUpdate(); } }, isPortRequired: function() { diff --git a/src/main/resources/static/scripts/__test__/EntryTest.js b/src/main/resources/static/scripts/__test__/EntryTest.js index e185af70..bc1220d7 100644 --- a/src/main/resources/static/scripts/__test__/EntryTest.js +++ b/src/main/resources/static/scripts/__test__/EntryTest.js @@ -93,6 +93,19 @@ describe('Entry', () => { }); + it("displays a host and port with a status code", function() { + entry = TestUtils.renderIntoDocument(); + jquery.ajax = jest.fn(() => + entry.successFunc({"canConnect": true, "statusCode": "200"})); + + entry.componentWillMount(); + renderedEntry = ReactDOM.findDOMNode(entry); + + expect(renderedEntry.children[0].textContent).toEqual("test.com:80 status: 200"); + expect(renderedEntry.style._values.color).toEqual("green"); + + }); + it("displays a host and port without a canConnect response", function() { entry = TestUtils.renderIntoDocument(); jquery.ajax = jest.fn(() => From edaad6983583c82218fbcb445f56d4c23388bfcd Mon Sep 17 00:00:00 2001 From: Thomas Gamble Date: Wed, 6 Apr 2016 14:36:29 -0700 Subject: [PATCH 2/2] test update and hubot info --- README.md | 4 ++++ src/main/resources/static/scripts/Entry.js | 1 + 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 751ca1d7..217eb065 100644 --- a/README.md +++ b/README.md @@ -125,4 +125,8 @@ You can run it locally by using ➜ ./gradlew bootRun ``` +#ChatOps + +Willitconnect can also be connected to hubot -- more information at [hubot-will-it-connect](https://www.npmjs.com/package/hubot-will-it-connect) + diff --git a/src/main/resources/static/scripts/Entry.js b/src/main/resources/static/scripts/Entry.js index fedca34b..b1ce3b9f 100644 --- a/src/main/resources/static/scripts/Entry.js +++ b/src/main/resources/static/scripts/Entry.js @@ -17,6 +17,7 @@ var Entry = React.createClass({ mixpanel.track("connection attempted", { "canConnect": data.canConnect, "httpStatus": data.httpStatus, "validHostName":data.validHostName, "validUrl":data.validUrl}); + console.log(data); this.setState({status: data}); }, componentWillMount: function () {