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
- Follow the steps in Set up a local 8.0.x environment.
- Log in
- Go to
/admin/modules, checkKey, then click theInstallbutton. - Go to
/admin/config/search/search-api/add-server - Set Backend =
ElasticSearch. In the Configure ElasticSearch backend details element, you see a ElasticSearch Connector set of radio buttons. TheStandardoption is selected by default. Below is a details element with the title Configure Standard ElasticSearch connector. - 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
Create a merge request— merge request !170 for 9.0.x created by @mparker17 in #2Create a merge request— merge request !171 for 8.0.x created by @mparker17 in #4Community review/feedback— skipped by @mparker17 in #7Maintainer review/feedback— done by @mparker17 in #7Commit to 9.0.x— done by @mparker17 in #8Commit to 8.0.x— done by @mparker17 in #10Release 9.0.x— released in 9.0.0-alpha2Release 8.0.x— released in 8.0.0-alpha6
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork elasticsearch_connector-3568410
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
Comment #3
mparker17Created merge request !170 for the
9.0.xbranch.Comment #5
mparker17Created merge request !171 for the
8.0.xbranch.Comment #6
mparker17I was able to write tests for this!
Comment #7
mparker17Re-reviewing after a bit of time, this looks good, and manual testing shows it working, so I'm going to merge it.
Comment #9
mparker17Merged to 9.0.x; going to merge to 8.0.x shortly.
Comment #11
mparker17Merged to 8.0.x. I'll update this issue when this fix is released.
Comment #13
mparker17This was released in elasticsearch_connector-9.0.0-alpha2.
Comment #14
mparker17This was released in elasticsearch_connector-8.0.0-alpha6