Problem/Motivation

When adding or editing a Search API Server, after selecting Backend = ElasticSearch, changing the ElasticSearch Connector radio button has no effect: it always shows the configuration form for Configure Standard ElasticSearch Connector.

In the console, the error An error occurred during the execution of the Ajax response: TypeError: $wrapper[method] is not a function is displayed when you select a different connector plugin.

Steps to reproduce

  1. Follow the steps in Set up a local 8.0.x environment.
  2. Log in
  3. Go to /admin/modules, check Key, then click the Install button.
  4. Go to /admin/config/search/search-api/add-server
  5. Set Backend = ElasticSearch. In the Configure ElasticSearch backend details element, you see a ElasticSearch Connector set of radio buttons. The Standard option is selected by default. Below is a details element with the title Configure Standard ElasticSearch connector.
  6. Set ElasticSearch Connector = Elastic Cloud ID.
    • Expected behavior: the details element with the title Configure Standard ElasticSearch connector is replaced with a details element with the title Configure Elastic Cloud ID ElasticSearch connector
    • Actual behavior: the details element with the title Configure Standard ElasticSearch connector does not change

Proposed resolution

Turns out this is a result of Use replaceWith, not replace, in #ajax form settings which was introduced in 10.3.0 in #3303557: Deprecate and remove the AJAX replace method.

Update src/Plugin/search_api/backend/ElasticSearchBackend.php; change the $form['connector']['#ajax']['method'] from 'replace' to 'replaceWith'.

Remaining tasks

  1. Create a merge request — merge request !170 for 9.0.x created by @mparker17 in #2
  2. Create a merge request — merge request !171 for 8.0.x created by @mparker17 in #4
  3. Community review/feedback — skipped by @mparker17 in #7
  4. Maintainer review/feedback — done by @mparker17 in #7
  5. Commit to 9.0.x — done by @mparker17 in #8
  6. Commit to 8.0.x — done by @mparker17 in #10
  7. Release 9.0.x — released in 9.0.0-alpha2
  8. Release 8.0.x — released in 8.0.0-alpha6

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mparker17 created an issue. See original summary.

mparker17’s picture

Issue summary: View changes
Status: Active » Needs review

Created merge request !170 for the 9.0.x branch.

mparker17’s picture

Issue summary: View changes

Created merge request !171 for the 8.0.x branch.

mparker17’s picture

Issue summary: View changes

I was able to write tests for this!

mparker17’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: +needs backport to 8.0.x

Re-reviewing after a bit of time, this looks good, and manual testing shows it working, so I'm going to merge it.

  • mparker17 committed 6d715845 on 9.0.x
    fix: #3568410 Cannot change connector plugin type while adding/editing a...
mparker17’s picture

Version: 9.0.x-dev » 8.0.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
Issue tags: -needs backport to 8.0.x

Merged to 9.0.x; going to merge to 8.0.x shortly.

  • mparker17 committed 4b8bd824 on 8.0.x
    fix: #3568410 Cannot change connector plugin type while adding/editing a...
mparker17’s picture

Issue summary: View changes
Status: Needs review » Fixed

Merged to 8.0.x. I'll update this issue when this fix is released.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mparker17’s picture

Issue summary: View changes
mparker17’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.