-
Notifications
You must be signed in to change notification settings - Fork 183
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
Arc-1455 server url to app creation #1312
Conversation
…n, completely based on connect modules
…ra into ARC-1406-routing
…ra into ARC-1406-routing
…ra into ARC-1406-routing
…-for-jira into ARC-1453-version-to-url
77c88a6
to
669b3c6
Compare
bb11730
to
06755cc
Compare
a95a720
to
a3be4b5
Compare
@@ -176,6 +154,16 @@ describe("await jirahostMiddleware", () => { | |||
req.cookies.jwt = TEST_JWT_TOKEN; | |||
}); | |||
|
|||
it("cookie should have priority", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this down to make sure this test runs when req.method is GET
b97fe6b
to
aaa6133
Compare
bb9f0d4
to
5f59dd2
Compare
@@ -147,17 +147,6 @@ describe("await jirahostMiddleware", () => { | |||
expect(next).not.toBeCalled(); | |||
}); | |||
|
|||
it("should not be validated and used when wrong URL", async ()=>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this because it's no longer relevant since I changed the second conditional check in extractUnsafeJiraHost
|
||
const extractUnsafeJiraHost = (req: Request): string | null => { | ||
if (moduleUrls.includes(req.path) && req.method == "GET") { | ||
// Only save xdm_e query when on the GET post install url (iframe url) | ||
return req.query.xdm_e as string; | ||
} else if ((req.path == postInstallUrl && req.method != "GET") || req.path == "/jira/sync") { | ||
// Only save the jiraHost from the body for specific routes that use it | ||
} else if (["POST", "DELETE", "PUT"].includes(req.method)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we are/will be making POST/DELETE/PUT requests outside of the GH config page and outside of the /jira/sync route, modified this second conditional the return the jirahost from req.body for any POST/DELETE/PUT req.
7d9f985
to
55d190f
Compare
} | ||
} catch (err) { | ||
req.log.debug(`Something went wrong: ${gheServerURL}`, err); | ||
// TODO - adding error mapping (create confluence page with error codes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rationale:
Continuing task of wiring up the UI screens. This PR focuses on navigating from the GHE server URL screen to the app creation screen.
Changes:
JiraVerifyServerUrlRouter
to handle routing a post request (JiraVerifyServerUrlPost
) to validate the passed url is a valid url, check the db for existing apps and verify we can hit the provided url.JiraAppCreationRouter
handles the get request after the validation passes.JiraVerifyServerUrlPost
middleware which takes in the provided url and makes a simple get request to check that we ping the provided url. If customers have opened a hole in their firewall, we should get a successful response back, otherwise, it will fail.Demo:
Like the last 2 PRs, the new path is hidden behind a FF.
With FF set to false we still navigate from the config screen to the connect an org screen:
176094892-a9aea163-eca0-493c-8365-111f24b6ae07.mov
With the FF set to true (done manually on my local for demo purposes only) we can navigate from the config page to the server url screen. In the scenario where I have 'opened a hole in the firewall' (aka connected to the VPN) and I have no existing GH apps, I'm navigated to the auto/manual app creation page.
Screen.Recording.2022-06-29.at.8.23.33.pm.mov
If I do have existing apps, instead of being navigated to /github-app-creation-page I'll be navigated to
github-list-apps-page
(the view and the module for this don't exist yet so it renders nothing and the error flag pops up but not the path)Screen.Recording.2022-06-29.at.8.27.51.pm.mov
If we can't verify the url, we'll render an error (this component hasn't been created yet but note the response in my terminal ). For demo purposes, I'm disconnected from my VPN for this one.
Screen.Recording.2022-06-29.at.8.31.10.pm.mov
To test locally:
In src/routes/jira/configuration/jira-configuration-get.ts change the value from false to true for the FF check for handleNavigationClassName. You will be able to test these changes again once this has been deployed to prod as the FF is on for our segment 🎉
What's up next:
In ARC 1456 I'll be implementing the auto app creation flow, saving the data from the response to the db, and wrapping out the first-time install flow. I'm going to tackle a couple of clean-up items and some documentation so I can give this bad boy a chance to get approved and merged so I stop branching off my previous branch and blowing out my commit history 🙃
Also ARC 1473 to map errors when the verify server post fails and rendering the error in the UI.