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

Conditional Display of Helper Text for AI Provider Account Creation #770

Merged
merged 3 commits into from
May 30, 2024

Conversation

kmgalanakis
Copy link
Contributor

@kmgalanakis kmgalanakis commented May 17, 2024

Description of the Change

Closes #715

How to test the Change

  • Enable/disable the several features with all the available providers and verify that help texts related to the configuration of each provider are hidden/displayed respectively.

Changelog Entry

Changed - Hide the provider's configuration help text when the provider is configured, for all providers.

Credits

Props @kmgalanakis

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@kmgalanakis kmgalanakis self-assigned this May 17, 2024
@github-actions github-actions bot added this to the 3.1.0 milestone May 17, 2024
@kmgalanakis kmgalanakis force-pushed the feature/hide-help-text-if-feature-enabled branch from b7d5c2b to 6940eae Compare May 17, 2024 14:14
Copy link
Collaborator

@dkotter dkotter 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 few comments but also noting this only addresses the helper text for the IBM Watson Provider. Most of our other Providers also show similar helper text so probably best to tackle all of those in a single PR

'title' => [],
],
]
'description' => $this->feature_instance->is_feature_enabled() ?
Copy link
Collaborator

Choose a reason for hiding this comment

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

So the is_feature_enabled method checks three things:

  1. Is the Provider configured properly?
  2. Does the current user have access to this Feature?
  3. Is the Feature turned on?

This is probably fine when someone is setting things up through the onboarding wizard but if changing things from the settings page, this means the helper text won't show if the Feature isn't turned on. This leads to the scenario where the only way to see the helper text is turning the Feature on and then saving the settings.

I think it may be better to use the is_configured method, so we aren't running a user check or enabled check but just checking if the Provider is configured.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @dkotter.

Good point. However, instead of just checking if the feature is configured I preferred to check if the feature is configured with the specified provider. The problem was that when using just is_configured the feature might have been configured with provider A and that would result in hiding the help texts of provider B for the same service. With my approach, the help texts of a provider are only hidden if the feature is configured with the specified provider.

Please let me know what you think.

Thank you

'class' => 'classifai-provider-field hidden provider-scope-' . static::ID, // Important to add this.
]
);
if ( ! $this->feature_instance->is_feature_enabled() ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we want to hide this toggle as someone may want to switch from using an API key to using a Username and Password, which this makes that impossible unless they remove credentials first or disable the Feature first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point @dkotter, thank you. This should be fine now.

…ured" and always show the option to switch to authenticating with username and password
…ers when the feature is configured with the selected provider
@kmgalanakis kmgalanakis requested a review from dkotter May 29, 2024 17:59
@kmgalanakis kmgalanakis marked this pull request as ready for review May 29, 2024 18:03
@kmgalanakis kmgalanakis requested review from jeffpaul and a team as code owners May 29, 2024 18:03
@github-actions github-actions bot added the needs:feedback This requires reporter feedback to better understand the request. label May 29, 2024
Copy link

@kmgalanakis thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?

@kmgalanakis kmgalanakis changed the title Hide the help text for NLU account creation when the feature is already enabled Conditional Display of Helper Text for AI Provider Account Creation May 29, 2024
@jeffpaul jeffpaul requested a review from Sidsector9 May 29, 2024 18:25
Copy link
Member

@Sidsector9 Sidsector9 left a comment

Choose a reason for hiding this comment

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

Tested and works as expected 👍

@jeffpaul jeffpaul merged commit c6af998 into develop May 30, 2024
13 of 17 checks passed
@jeffpaul jeffpaul deleted the feature/hide-help-text-if-feature-enabled branch May 30, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:feedback This requires reporter feedback to better understand the request.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Conditional Display of Helper Text for AI Provider Account Creation
4 participants