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

Improve altair experience #50

Merged
merged 2 commits into from
Dec 8, 2023
Merged

Improve altair experience #50

merged 2 commits into from
Dec 8, 2023

Conversation

Mythicaeda
Copy link
Contributor

@Mythicaeda Mythicaeda commented Nov 22, 2023

Partially address NASA-AMMOS/aerie#1210.

  1. Updates the version of Altair from 5.0.28 to 5.2.11 (the latest release). This is important, as the added prerequest script depends on commands added after 5.0.28.
  2. Updates the launch configuration of Altair. Most importantly of these changes, it adds the GraphiQL Explorer plugin (the thing that appears on the right side of Hasura Qurery panel and allows for query building via clicking on entries), adds a prerequest script to sign the user in if their token is invalid/missing, and sets the x-hasura-role: viewer and Authorization header. It also sets the changes the default theme from light to dracula.

Instructions:

  1. When visiting the API Playground for the first time, you will be prompted to install the altair-graphql-plugin-graphql-explorer plugin. Allow this.
  2. When opening a new window, visit the pre-request tab and set your username/password.
  3. Press the Refresh Docs icon directly to the left of the Docs button (two to the left of Send Request)
  4. Open the Explorer panel via the symbol beneath the suitcase on the left sidebar

Your page should now look like this:

Screenshot 2023-11-22 at 9 00 18 AM

Things to note:

  • The script is currently stores its JWT under the token name instead of potentially clashing with the UI for user
  • The script only checks if the JWT is expired. If you dump your database, you will need to temporarily remove the await altair.storage.get("token_exp") from the line const tokenExpiry = await altair.storage.get("token_exp") || 0; to force it to refresh
  • In order to use plugins, Altair has to be in "dev mode"
  • After updating your role, you need to refresh your docs to see changes in the explorer pane.

Docs

The "How to Interact with the API Playground" docs will need to be updated. (Docs ticket here)

Future Work

  • If a login service is added to this endpoint, similar to the UI, then the script can be updated to no longer require users to put their user-pass in the clear every time they open a new window. This means that users will have the correct headers automatically for the Explorer window.

  • We may want to expose what the role set by default for the x-hasura-role header is via an environment variable.

@Mythicaeda Mythicaeda added the feature A new feature or feature request label Nov 22, 2023
@Mythicaeda Mythicaeda self-assigned this Nov 22, 2023
@Mythicaeda Mythicaeda requested a review from camargo as a code owner November 22, 2023 17:02
@Mythicaeda Mythicaeda removed the request for review from camargo November 22, 2023 17:03
@Mythicaeda Mythicaeda linked an issue Nov 27, 2023 that may be closed by this pull request
- Automatically install the GQL explorer plugin
- Update Altair version
@Mythicaeda Mythicaeda force-pushed the improve-altair-experience branch 3 times, most recently from 0ac0238 to 87d6aa7 Compare December 7, 2023 20:32
- Move Login script to external file
- Exclude `static/` directory from esLint
@Mythicaeda Mythicaeda force-pushed the improve-altair-experience branch from 87d6aa7 to a376a8c Compare December 7, 2023 20:36
Copy link
Member

@camargo camargo left a comment

Choose a reason for hiding this comment

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

LGTM based on visual inspection

Copy link
Contributor

@duranb duranb left a comment

Choose a reason for hiding this comment

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

lgtm too!

@Mythicaeda Mythicaeda merged commit 136b211 into develop Dec 8, 2023
2 checks passed
@Mythicaeda Mythicaeda deleted the improve-altair-experience branch December 8, 2023 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the User Experience with the API Playground
3 participants