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

API Token use cases integration for account page #531

Merged
merged 10 commits into from
Nov 8, 2024

Conversation

ChengShi-1
Copy link
Contributor

@ChengShi-1 ChengShi-1 commented Oct 28, 2024

What this PR does / why we need

This PR integrates the API Token account page UI with the new API token management use cases, ensuring seamless interaction between the UI and backend functionality.

  • Read current API token
  • Recreate API Token
  • Revoke API Token

Which issue(s) this PR closes:

Special notes for your reviewer:

waiting until this PR is reviewed.

Suggestions on how to test this:

Step 1: Run the Development Environment

  1. Execute npm i.
  2. Navigate with cd packages/design-system && npm run build.
  3. Return with cd ../../.
  4. Ensure you have a .env file similar to .env.example, with the variable VITE_DATAVERSE_BACKEND_URL=http://localhost:8000.
  5. Navigate with cd dev-env.
  6. Start the environment using ./run-env.sh unstable.
  7. To verify the environment, visit http://localhost:8000/ and check your local Dataverse installation.

Step 2: Test the feature

  1. Ensure the application is running on http://localhost:8000/.
  2. Navigate to http://localhost:8000/spa/account?tab=apiToken to begin testing.
  3. Confirm that you are logged in and have appropriate permissions.
  4. Press the "Recreate Token" button on the page.
  • A new API token is displayed and an expiration date is shown in the correct format. YYYY-MM-DD
  • Reload the page by refreshing the browser, ensure the same API token and expiration date remain
  1. Press the "Revoke Token" button on the page.
  • The API token is revoked (disappears from the page).
  • "API Token for Dataverse Admin has not been created." and a "Create Token" button is shown.
  • Reload the page by refreshing the browser, ensure the same API token and expiration date remain
  1. Press the "Create Token" button on the page.
  • A new API token is displayed and an expiration date is shown in the correct format. YYYY-MM-DD.
  • Reload the page by refreshing the browser, ensure the same API token and expiration date remain

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

image
image

Is there a release notes update needed for this change?:

Additional documentation:

@ChengShi-1 ChengShi-1 added Size: 10 A percentage of a sprint. 7 hours. Waiting GREI Re-arch GREI re-architecture-related SPA: Account Page Original size: 10 FY25 Sprint 9 FY25 Sprint 9 (2024-10-23 - 2024-11-06) labels Oct 28, 2024
@ChengShi-1 ChengShi-1 linked an issue Oct 28, 2024 that may be closed by this pull request
@ChengShi-1 ChengShi-1 added the SPA.Q4 Not related to any specific Q4 feature label Oct 28, 2024
@coveralls
Copy link

coveralls commented Oct 29, 2024

Coverage Status

coverage: 97.558% (+0.2%) from 97.388%
when pulling 4cedb79 on api-token-usecase-integration
into 110d696 on develop.

@ChengShi-1 ChengShi-1 self-assigned this Oct 30, 2024
@ChengShi-1 ChengShi-1 added the integration Tasks involving the connection and interaction of UI features with the Dataverse API label Oct 30, 2024
@ChengShi-1 ChengShi-1 marked this pull request as ready for review November 4, 2024 17:24
@ChengShi-1 ChengShi-1 removed the Waiting label Nov 4, 2024
@ChengShi-1 ChengShi-1 removed their assignment Nov 4, 2024
@g-saracca g-saracca self-assigned this Nov 4, 2024
Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

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

Good job @ChengShi-1 !
I've left some comments to improve things, you will need to make a refactor to avoid creating a new repository for api token info and instead use the user repository, that will need changes in several places.

Also try to add some more stories, after that I will check how they look, thanks!

g-saracca
g-saracca previously approved these changes Nov 7, 2024
Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

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

Approving! nice work!! 🚀

@g-saracca g-saracca removed their assignment Nov 7, 2024
@ofahimIQSS ofahimIQSS self-assigned this Nov 7, 2024
@ofahimIQSS
Copy link
Contributor

Hello @ChengShi-1,

Had an observation on this ticket.

Copy to Clipboard isn't working when I Recreate token. Can be reproduced in storybook and local.

Steps to reproduce:

  1. Go to http://localhost:8000/
  2. login
  3. Now go to http://localhost:8000/spa/account?tab=apiToken
  4. Copy API Token to clipboard
  5. Paste API token anywhere to verify copying worked.
  6. Recreate token
  7. Copy to clipboard
  8. Paste API Token

Here is where the issue lies, the recreated token isn't getting copied.

@ChengShi-1
Copy link
Contributor Author

Hello @ChengShi-1,

Had an observation on this ticket.

Copy to Clipboard isn't working when I Recreate token. Can be reproduced in storybook and local.

Steps to reproduce:

  1. Go to http://localhost:8000/
  2. login
  3. Now go to http://localhost:8000/spa/account?tab=apiToken
  4. Copy API Token to clipboard
  5. Paste API token anywhere to verify copying worked.
  6. Recreate token
  7. Copy to clipboard
  8. Paste API Token

Here is where the issue lies, the recreated token isn't getting copied.

Thank you, Omer! one variable was wrong in the copy function, I have a new commit to fix it. Also, it may need to be reviewed and approved again @g-saracca Thanks!!

Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

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

Nice catch @ofahimIQSS, new changes approved 👍

@cmbz cmbz added the FY25 Sprint 10 FY25 Sprint 10 (2024-11-06 - 2024-11-20) label Nov 7, 2024
@ofahimIQSS
Copy link
Contributor

Thanks for the fix @ChengShi-1 looks good now. Merging PR.

Testing of 531.docx

@ofahimIQSS ofahimIQSS merged commit 64b8367 into develop Nov 8, 2024
10 of 14 checks passed
@ofahimIQSS ofahimIQSS deleted the api-token-usecase-integration branch November 8, 2024 14:54
@ofahimIQSS ofahimIQSS removed their assignment Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 9 FY25 Sprint 9 (2024-10-23 - 2024-11-06) FY25 Sprint 10 FY25 Sprint 10 (2024-11-06 - 2024-11-20) GREI Re-arch GREI re-architecture-related integration Tasks involving the connection and interaction of UI features with the Dataverse API Original size: 10 Size: 10 A percentage of a sprint. 7 hours. SPA: Account Page SPA.Q4 Not related to any specific Q4 feature
Projects
Status: Done 🧹
Development

Successfully merging this pull request may close these issues.

API Token section - Read current API Token integration API Token section use cases integration
5 participants