-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat:Added functionality to retrieve and save GitHub token (#812) #839
Conversation
…s#812) Signed-off-by: wblx <904653630@qq.com>
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.
Nice work. We are close. Here are what we can do to improve this branch.
- Please look into comments and remove or update what are needed to.
- We need to use English within the project, so please update all messages to English and use i18next for supporting other languages. reference to [OSS101] Task 1: Refactor the existing multiple languages feature by adopting a third i18n library #805
- Let's move the save button to the same line of the token input form. When user click on save, the input form would turn into a text and show only characters at the beginning and the end, hide the others with
*
and the save button becomes a edit button.
-
For alerts, we should use user-friendly popup from our ui library. For example, message from antd. Looks like alerts block interactions with browser until we confirm.
-
On test token, can we use the token in the input form? It is intuitive to see the token there and click to test if it is valid. let me know what you think.
cc @HalloMelon for UI changes.
Signed-off-by: wblx <904653630@qq.com>
99703ed
to
b4a25ed
Compare
Sorry for the delay in making the changes until today. Thank you for your diligent review. I have resolved all the issues in the latest version. Additionally, using the token in the input form is intuitive and user-friendly, as it enables immediate feedback on the token's validity, which I have adopted. If there are any further issues, please continue to correct me. |
Signed-off-by: wblx <904653630@qq.com>
e195e81
to
44e98e1
Compare
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.
Almost there! Some minor enhancements are needed before we merge it. The biggest issue it that I can't see the message, not sure what's happend. I didn't take a close look at the code. Let me know if it works for you or you need more info from me.
I think I figured that out. The token won't be valid until I click save. But in the code, I can see that we are using token from the githubRequest as part of input. |
src/helpers/githubApi.ts
Outdated
...options, | ||
headers: { | ||
...options.headers, | ||
Authorization: `Bearer ${token}`, | ||
}, |
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.
This is causing the bug. options has the same thing as headers, they are duplicate. I think we can just keep ...options
and remove the rest.
d3a10e2
to
732a649
Compare
Your suggestion makes a lot of sense. I appreciate your effort in reviewing the new version. |
I simplified the githubApi.ts and moved the decision logic to GitHubToken.tsx.By the way,if we are only using githubToken to get the token from localStorage, we can directly use localStorage.getItem('github_token') ,the previous approach might reduce the number of accesses to localStorage in scenarios where githubRequest is called frequently, thereby improving performance. |
Did you solve this? I don't get any response if I set the headers twice. Removing duplicate options works for me but the message is still not showing. Nothing is showing in the console. Do you have any ideas? |
This is so strange. The day before yesterday, everything was normal when I was using and uploading the code. Yesterday, there were no message when I first clicked, but during the process of modifying the code, it naturally recovered, and everything remained normal for several hours after uploading. Just now, there were no message when I first clicked, but after having a meal, it was fine. I'm thinking about it. |
Signed-off-by: wblx <904653630@qq.com>
I checked today, and the issue didn't happen again. |
Would it be easier to move it to the top of the page? because messages usually appear at the top by default. This is not a change request, you can keep it this way if that could cause the message invisible issue. Also, did we figure out why we have duplicate options here? #839 (comment) |
Signed-off-by: wblx <904653630@qq.com>
By default, the response message appears at the top, but at that time, the user's attention is focused on the GitHubToken component area. If it appears at the top, they might not notice it, and shifting their gaze to focus on the content and then back is also not user-friendly. Therefore, I think the current interaction is better. Additionally, if our function is only to pass in the GitHub token and does not need to retain other request configurations or header information, then ...options and ...options.headers are indeed redundant. The code can be simplified, and I have made the modifications. |
LGTM. Thanks for your efforts! Looks like the branch needs formatting. Please run |
Signed-off-by: Harry <xiaohanwu12@gmail.com>
…s#839) * feat:Added functionality to retrieve and save GitHub token (hypertrons#812) Signed-off-by: wblx <904653630@qq.com> * solved all the problems Signed-off-by: wblx <904653630@qq.com> * sync * Resolve inconsistent margins Signed-off-by: wblx <904653630@qq.com> * response problem Signed-off-by: wblx <904653630@qq.com> * duplicated options Signed-off-by: wblx <904653630@qq.com> * chore: run prettier to format Signed-off-by: Harry <xiaohanwu12@gmail.com> --------- Signed-off-by: wblx <904653630@qq.com> Signed-off-by: Harry <xiaohanwu12@gmail.com>
* replace with OSGraph * replace with OSGraph * fix osgraph * fix OSGraph * fix OSGraph * feat:Added functionality to retrieve and save GitHub token (#839) * feat:Added functionality to retrieve and save GitHub token (#812) Signed-off-by: wblx <904653630@qq.com> * solved all the problems Signed-off-by: wblx <904653630@qq.com> * sync * Resolve inconsistent margins Signed-off-by: wblx <904653630@qq.com> * response problem Signed-off-by: wblx <904653630@qq.com> * duplicated options Signed-off-by: wblx <904653630@qq.com> * chore: run prettier to format Signed-off-by: Harry <xiaohanwu12@gmail.com> --------- Signed-off-by: wblx <904653630@qq.com> Signed-off-by: Harry <xiaohanwu12@gmail.com> * Update the info about ”GitHub Token Configuration“ (#858) * update the info in the "GitHub Token Configuration" * update the info about token * fix: modify the URL link of the webpage * fix: modify the URL link of the webpage * fix: modify page judgment criteria * fix: modify the URL link of the webpage fix: modify the URL link of the webpage fix: modify page judgment criteria fix: modify page judgment criteria fix: reserved digits for the length of the contributor bar (#861) fix: Perceptor tab missing icon (#863) fix: Perceptor tab is not selected after refreshing (#864) fix fix * code optimization * style optimization * modify the jump method --------- Signed-off-by: wblx <904653630@qq.com> Signed-off-by: Harry <xiaohanwu12@gmail.com> Co-authored-by: Sylvan <60059315+wblxxx@users.noreply.github.com> Co-authored-by: Scarlett Zhao <79428895+HalloMelon@users.noreply.github.com>
Brief Information
This pull request is in the type of (more info about types):
Related issues (GitHub tokens):
Details
Recently, there has been a #773 (comment) in the community about GitHub Tokens. In fact, HyperCRX had previously introduced GitHub Tokens to increase the number of requests made to GitHub, as seen in #100. However, in #574, we removed it since there was no longer a frequent need to access the GitHub API.
Considering that HyperCRX may need to frequently access the GitHub API in the future, we need to reintroduce GitHub Tokens with the following specific requirements:
Provide a UI interface allowing users to input their GitHub Tokens.
Securely store user's Tokens.
Encapsulate a network request method that uses the GitHub Token, which will be called by other new features needing to access the GitHub API in the future.
Checklist
Others