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

feat: introduce personal access tokens for authorization #4094

Open
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

jamesgeorge007
Copy link
Member

@jamesgeorge007 jamesgeorge007 commented May 29, 2024

Description

This PR includes the UI changes adding support for Personal Access Tokens (tokens associated with a user) providing a mechanism for authorization to access certain services and APIs the Hoppscotch platform offers. Currently, collections and environments from any team workspace (user having access to) can be accessed via PAT primarily for usage in the CLI, #4095.

The BE changes were added in #4079.

Closes HFE-519.

Changes

  • New tab addition in the profile page corresponding to personal access tokens.
  • Add AccessTokens (parent component where other presentational components are rendered and include all business logic), AccessTokensOverview, AccessTokensList, and AccessTokensGenerateModal components compiling various flows wrt personal access tokens.
  • Relevant i18n string entry additions.
  • Adds a new parameter includeTime to the shortDateTime helper function that defaults to true for an additional use case of conditionally including the time.

Preview

pat-ui-flow.mov

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Note to reviewers

  • Currently, the network call to fetch the list of access tokens gets triggered while at the Account tab. A potential optimization that can be done here is ensuring the data fetch happens only while the respective tab is visited. The existing implementation ensures inactive tab contents are rendered (via the render-inactive-tabs prop for HoppSmartTabs) while landing on the initial Account tab and thought to revisit it separately as required.

    <HoppSmartTabs
    v-model="selectedProfileTab"
    styles="sticky overflow-x-auto flex-shrink-0 bg-primary top-0 z-10"
    render-inactive-tabs
    >

  • There's a layout shift while switching between the tabs under the profile page. A pre-existing issue that can be tackled separately.

  • Since more subviews are getting added under the profile page, we could think in the direction of having dedicated routes for subviews where the common header element gets rendered at the parent /profile route with a slot for child routes /profile/account, etc later on.

@jamesgeorge007 jamesgeorge007 changed the title feat: introduce personal access tokens for administration feat: introduce personal access tokens for authorization May 29, 2024
@jamesgeorge007 jamesgeorge007 force-pushed the feat/pat-ui-changes branch 10 times, most recently from acbea3a to 29614eb Compare June 3, 2024 11:20
@jamesgeorge007 jamesgeorge007 marked this pull request as ready for review June 3, 2024 11:25
Copy link
Member

@nivedin nivedin left a comment

Choose a reason for hiding this comment

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

please look into this comments

jamesgeorge007 and others added 4 commits June 11, 2024 17:03
- Grid layout updates improving responsiveness.
- Reply on placeholder for the Label input element in the generate modal instead of a label appearing below.
- Add empty and error states for the access tokens list view.
- Cleanup

Co-authored-by: Nivedin <53208152+nivedin@users.noreply.github.com>
…lution

This is required in the case of cloud where the Auth token is available as an observable.
- Add a loading state for the initial page load if the user visits the `Tokens` tab immediately.
- Show `Expired` as the text if the current date exceeds the token expiration date.
- Toggle the error state during create/delete PAT actions if it was set.
- Cleanup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants