-
Notifications
You must be signed in to change notification settings - Fork 178
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
kie-issues#129: chrome-extension: Open in KIE Sandbox button doesn't work in a private repository #1665
Conversation
…work in a private repository
@kbowers-ibm The video looks great, I think it's very nice the way it is! Regarding the code, I think there's a better way to do that, instead of letting an exception occur and have the option to fix the error be shown in EditorPageErrorPage.. From what I understood, if there are no compatible authSessions with the URL being imported, a "cannot read 'id' from undefined" will happen, which will result in an Error being thrown, showing the Error page. I think we could do better, and instead of relying on the EditorPageErrorPage, we could create an internal state directly on |
Yeah that sounds cleaner, good idea! |
Updated functionality from an error message with a clickable button to instead automatically open the import modal if it can't find a branch name - which should never happen with public repos and will always happen with a private repo (if no valid auth token available). If a valid auth token exists it will find the branch and therefore import automatically without opening the modal. NewPrivateFunctionality.mp4 |
@kbowers-ibm Aren't we still erroring out when there's no |
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.
Thanks @kbowers-ibm! We're almost there.
packages/online-editor/src/importFromUrl/NewWorkspaceFromUrlPage.tsx
Outdated
Show resolved
Hide resolved
if (!queryParamBranch && isCertainlyGit(importableUrl.type) && queryParamAuthSessionId !== AUTH_SESSION_NONE.id) { | ||
return; | ||
} |
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.
Can you please explain this change? I struggle to understand it.
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.
So previously I had the state being set to false here. However when I removed it, I noticed that in the case of no auth token and repo is private we get the import modal as expected. However once the github token is added it briefly shows the error screen before carrying on through to import it properly. So this line stops that from happening.
https://github.com/kiegroup/kie-tools/assets/92726146/037a62d2-f0e9-4a9b-9393-548ede2b15d3
@@ -42,7 +42,7 @@ import { fetchSingleFileContent } from "./fetchSingleFileContent"; | |||
import { useGitHubClient } from "../github/Hooks"; | |||
import { AccountsDispatchActionKind, useAccountsDispatch } from "../accounts/AccountsContext"; | |||
import { useAuthSession, useAuthSessions } from "../authSessions/AuthSessionsContext"; | |||
import { useAuthProvider, useAuthProviders } from "../authProviders/AuthProvidersContext"; | |||
import { useAuthProviders } from "../authProviders/AuthProvidersContext"; |
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.
Unused?
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.
Yep, couldn't see any use of it anywhere, so got rid of that and a few others
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.
Hi @kbowers-ibm, I manually tested your PR, please take a look at the below video
Screen.Recording.2023-06-08.at.11.56.08.mov
Consider that I locally rebased your branch with main
, so can you please rebase this PR and double-check this behavior?
@kbowers-ibm Not sure this behavior is related to your change, it seems it occurs with public repos too. |
Hi Yeser, |
@yesamer Also judging by the error and that it's not working on public repos, can I confirm that you have git-cors-proxy-image package running? |
@kbowers-ibm Good point, I forgot to launch it. Thank you. |
@kbowers-ibm Sorry, my bad. I had in my local an old version of your PR. |
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.
Thank you @kbowers-ibm, it works well. Apologies for the confusion, my bad :/
Perfect! Thank you very much @yesamer, appreciate you taking the time :) |
And no worries about the confusion! I forgot to launch git-cors-proxy myself a couple of times during this ticket as well and had a few moments where I thought I'd messed everything up! |
…doesn't work in a private repository (apache#1665)" This reverts commit febba36.
…doesn't work in a private repository (apache#1665)" This reverts commit febba36.
Closes apache/incubator-kie-issues#129
When clicking the Chrome Extensions's "Open in KIE Sandbox" button on a private repo, with no connected account, on KIE Sandbox, a user will now be directed to an error page that has a link to authenticate and reimport.
When clicking the Chrome Extensions's "Open in KIE Sandbox" button on a private repo, with a relevant connected account, it will now be imported in the same way as public repos currently are.
Video demonstrating changes:
https://github.com/kiegroup/kie-tools/assets/92726146/bc52cb97-3cca-4b63-9094-364e1d2982b2