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

fix: Shifted position of expires_in fixes #31059 #35196

Closed
wants to merge 3 commits into from
Closed

fix: Shifted position of expires_in fixes #31059 #35196

wants to merge 3 commits into from

Conversation

toffee-k21
Copy link

@toffee-k21 toffee-k21 commented Jul 25, 2024

Description

Moves expires_in field after scope while configuring oauth2 datasource

Fixes #31059

Summary by CodeRabbit

  • New Features
    • Introduced a new input field for specifying "Authorization expires in (seconds)" in the Datasource form.
  • Improvements
    • Enhanced the logic for handling authentication parameters, improving readability and maintainability.
    • Adjusted input validation for better user experience.

@toffee-k21 toffee-k21 requested a review from ayushpahwa as a code owner July 25, 2024 17:41
Copy link
Contributor

coderabbitai bot commented Jul 25, 2024

Walkthrough

The recent changes to the RestAPIDatasourceForm.tsx enhance the user experience for configuring OAuth2 data sources. The modifications include a refined authentication logic for token handling and the introduction of a new optional input field for specifying authorization expiration. Additionally, the expires_in field has been repositioned for better accessibility, making related authentication fields easier to discover.

Changes

Files Change Summary
app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx Adjusted authentication parameter logic for clarity, added an optional "Authorization expires in" field, and repositioned the expires_in field for improved user flow.

Assessment against linked issues

Objective Addressed Explanation
Move expires_in field after scope while configuring oauth2 datasource (##31059)

In the land of APIs, where tokens roam,
A field was moved, finding its home.
With clearer paths and logic refined,
Users will surely be more aligned. 🌟

So here's to changes, both bright and bold,
Enhancing the journey, a sight to behold! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ad71b8e and 435e124.

Files selected for processing (1)
  • app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx (4 hunks)
Additional context used
Learnings (1)
app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx (1)
Learnt from: sneha122
PR: appsmithorg/appsmith#30012
File: app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx:679-682
Timestamp: 2024-01-04T05:15:31.532Z
Learning: The user `sneha122` has confirmed the resolution of the feedback regarding the redundancy of `|| false` in the `_.get` expression within the `RestAPIDatasourceForm.tsx` file.
Additional comments not posted (3)
app/client/src/pages/Editor/DataSourceEditor/RestAPIDatasourceForm.tsx (3)

Line range hint 183-187:
Good job on improving readability!

The conditional checks for refreshTokenClientCredentialsLocation have been adjusted for better clarity. This makes the code more maintainable.


250-252: URL validation logic looks solid!

The regex-based URL validation ensures that only valid URLs are accepted. This is crucial for preventing incorrect data entry.


663-672: Well done on adding the expires_in field!

The expires_in field for OAuth2 authentication is correctly implemented and positioned. This enhances the user experience by grouping related fields together.

@ayushpahwa ayushpahwa requested review from sneha122 and removed request for ayushpahwa July 31, 2024 05:21
@@ -180,7 +180,7 @@ class DatasourceRestAPIEditor extends React.Component<Props> {
if (_.get(authentication, "grantType") === GrantType.AuthorizationCode) {
if (
_.get(authentication, "refreshTokenClientCredentialsLocation") ===
undefined ||
Copy link
Contributor

Choose a reason for hiding this comment

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

@toffee-k21 can you please format these files. The indentation diff here is not required.

isValid: false,
message: createMessage(INVALID_URL),
};
isValid: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here also, can you please check the indentation.

@@ -660,6 +660,16 @@ class DatasourceRestAPIEditor extends React.Component<Props> {
isRequired: false,
})}
</FormInputContainer>
<FormInputContainer data-location-id={btoa("authentication.expiresIn")}>
Copy link
Contributor

Choose a reason for hiding this comment

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

The expires In dropdown should only appear if the grant type is Authorization Code. For these changes the dropdown is also appearing for other grant type Client Credentials as well.
image

@NilanshBansal NilanshBansal self-assigned this Aug 2, 2024
@NilanshBansal
Copy link
Contributor

@toffee-k21 any updates here?

@sneha122 sneha122 requested a review from NilanshBansal August 6, 2024 05:45
@NilanshBansal NilanshBansal added Stale Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Community Contributor Meant to track issues that are assigned to external contributors labels Aug 7, 2024
@NilanshBansal
Copy link
Contributor

NilanshBansal commented Aug 12, 2024

Changes were suggested on Aug 2, 2024 but we haven't heard back from the user since then.
We will close this PR in 2 days if we don't hear back
@appsmithorg/query-js-pod

@github-actions github-actions bot removed the Stale label Aug 12, 2024
@NilanshBansal
Copy link
Contributor

Closing this PR due to no response.

@rishabhrathod01
Copy link
Contributor

/ok-to-test

Copy link

Whoops! Looks like you're using an outdated method of running the Cypress suite.
Please check this doc to learn how to correct this!

@rishabhrathod01 rishabhrathod01 changed the title Shifted position of expires_in fixes #31059 fix: Shifted position of expires_in fixes #31059 Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contributor Meant to track issues that are assigned to external contributors Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Move expires_in field after scope while configuring oauth2 datasource
3 participants