@@ -10,19 +10,23 @@ require([
1010 'use strict' ;
1111
1212 $ ( function ( ) {
13- const engineField = $ ( '#catalog_search_engine' ) ,
14- commentContainer = $ ( '#row_catalog_search_engine p' ) ;
13+ const engineField = $ ( '#catalog_search_engine' ) ;
14+ const commentContainer = $ ( '#row_catalog_search_engine p' ) ;
1515
16- engineField . change ( ( ) => {
17- const engineValue = engineField . val ( ) ;
18- let commentText = $ . mage . __ ( 'If not specified, Default Search Engine will be used.' ) ;
16+ const updateCommentText = ( ) => {
17+ const engineValue = engineField . val ( ) ,
18+ defaultText = $ . mage . __ ( 'If not specified, Default Search Engine will be used.' ) ,
19+ unsupportedText = $ . mage . __ ( 'This search engine option is no longer supported by Adobe. ' +
20+ 'It is recommended to use OpenSearch as a search engine instead.' ) ,
21+ newCommentText = [ 'elasticsearch7' , 'elasticsearch8' ] . includes ( engineValue ) ?
22+ unsupportedText : defaultText ;
1923
20- if ( [ 'elasticsearch7' , 'elasticsearch8' ] . includes ( engineValue ) ) {
21- commentText = $ . mage . __ ( 'This search engine option is no longer supported by Adobe. ' +
22- 'It is recommended to use OpenSearch as a search engine instead.' ) ;
24+ if ( commentContainer . text ( ) !== newCommentText ) {
25+ commentContainer . text ( newCommentText ) ;
2326 }
27+ } ;
2428
25- commentContainer . text ( commentText ) ;
26- } ) ;
29+ engineField . change ( updateCommentText ) ;
30+ updateCommentText ( ) ;
2731 } ) ;
2832} ) ;
0 commit comments