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: add default sourceID configuration fields #223

Merged
merged 6 commits into from
Jun 20, 2024

Conversation

luqven
Copy link
Contributor

@luqven luqven commented Jun 14, 2024

Description

  • Adds a configuration field for a default source ID
  • Updates sources dropdown button to show loading while fetching sources
  • Defaults the Dialog to the configured source ID if set, otherwise fetches sources list

Before

  • No way to configure a default source
  • Loading indicator on sources dropdown was only shown when clicking dropdown
  • Hitting "save" with an invalid configuration would persist the changes despite showing a warning or error

After

  • Customers can configure a default source
  • Loading indicator for sources dropdown visible without clicking
  • Trying to save an invalid configuration does not persist the changes

Loading indicator

source-dropdown-loading-indicator.mp4

Default source

source-dropdown-default-source.mp4

API KEY Validation

NOTE: the source ID is hidden in the video but not when you clone or preview this branch. This is on purpose. I'm only hiding the source ID on the video out of extreme caution.

default-source-validation.mp4

Steps to test

  1. Clone, npm install, and pnpm run start
  2. Go to Contentful development space
  3. Opent the content with the localhost field
  4. Remove any previously selected image
  5. Refresh the page
  6. To go Apps --> Installed Apps --> imgix development --> configure
  7. Add the sourceID of your choosing as the default sourceID
  8. See that API key validation succeeds/fails if associated/not associated with said source
  9. Go back to the previous content entry
  10. Add an image
  11. See that the modal defaults to the configured source ID

Checklist

  • Read the contributing guidelines.
  • Each commit follows the Conventional Commit spec format.
  • Update the readme (if applicable).
  • Update or add any necessary API documentation (if applicable)
  • All existing unit tests are still passing (if applicable).
  • Add some steps so we can test your bug fix or feature (if applicable).
  • Add new passing unit tests to cover the code introduced by your PR (if applicable).
  • Any breaking changes are specified on the commit on which they are introduced with BREAKING CHANGE in the body of the commit.

@luqven luqven added the enhancement New feature or request label Jun 14, 2024
@luqven luqven self-assigned this Jun 14, 2024
Copy link

vercel bot commented Jun 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contentful 🛑 Canceled (Inspect) Jun 21, 2024 0:09am
contentful-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 0:09am

Copy link
Contributor

@marco-salcedo marco-salcedo left a comment

Choose a reason for hiding this comment

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

Left a non-blocking comment, LGTM 🚀

Comment on lines 260 to 262
const previouslySelectedSource =
invocationParams?.selectedImage?.selectedSource?.id ||
installationParams.sourceID;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): I almost called out that the comparison below was in invalid, but seeing what previouslySelectedSource actually is, I see that its a direct comparison.

I think we should rename this variable previouslySelectedSourceId and update where needed.

Suggested change
const previouslySelectedSource =
invocationParams?.selectedImage?.selectedSource?.id ||
installationParams.sourceID;
const previouslySelectedSourceId =
invocationParams?.selectedImage?.selectedSource?.id ||
installationParams.sourceID;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment:

I can see why that's confusing 😅 , I can update this variable name to make this easier to grok 👍🏼 .

@luqven luqven force-pushed the l/PE-5732/fetch-image-medatadata-on-select branch from c500c2c to 48f8ba6 Compare June 20, 2024 23:42
@luqven luqven force-pushed the l/PE-5800/configurable-default-source branch from b086aed to d56b245 Compare June 20, 2024 23:42
@luqven luqven force-pushed the l/PE-5732/fetch-image-medatadata-on-select branch from 48f8ba6 to 35af9f4 Compare June 20, 2024 23:51
@luqven luqven force-pushed the l/PE-5800/configurable-default-source branch from d56b245 to 49b8339 Compare June 20, 2024 23:52
@luqven luqven force-pushed the l/PE-5732/fetch-image-medatadata-on-select branch from 35af9f4 to d272b1a Compare June 20, 2024 23:54
Base automatically changed from l/PE-5732/fetch-image-medatadata-on-select to main June 20, 2024 23:55
@luqven luqven force-pushed the l/PE-5800/configurable-default-source branch from 49b8339 to fa4f4f8 Compare June 20, 2024 23:55
@luqven luqven merged commit 095e23c into main Jun 20, 2024
1 of 5 checks passed
@luqven luqven deleted the l/PE-5800/configurable-default-source branch June 20, 2024 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants