in app/addons/search/components/SearchIndexEditor.js [106:160]
render() {
if (this.props.isLoading) {
return (
<div className="search-index-page-loading">
<GeneralComponents.LoadLines />
</div>
);
}
// If failed to load
if (!this.props.database) {
return null;
}
const pageHeader = this.props.isCreatingIndex ? 'New Search Index' : 'Edit Search Index';
const btnLabel = this.props.isCreatingIndex ? 'Create Document and Build Index' : 'Save Document and Build Index';
return (
<form id="search-index">
<h3 className='simple-header'>{pageHeader}</h3>
<DesignDocSelector
ref={node => this.designDocSelector = node}
designDocLabel="Save to design document"
designDocList={this.getDesignDocList()}
isDbPartitioned={this.props.isDbPartitioned}
newDesignDocName={this.props.newDesignDocName}
newDesignDocPartitioned={this.props.newDesignDocPartitioned}
selectedDesignDocName={this.props.ddocName}
selectedDesignDocPartitioned={this.props.ddocPartitioned}
onSelectDesignDoc={this.props.selectDesignDoc}
onChangeNewDesignDocName={this.props.updateNewDesignDocName}
onChangeNewDesignDocPartitioned={this.props.updateNewDesignDocPartitioned}
docLink={app.helpers.getDocUrl('DOC_URL_DESIGN_DOCS')} />
<div className="row">
<div className="mb-3 col-12 col-lg-6 col-xxl-4 ">
<label htmlFor="search-name">Index name</label>
<Form.Control type="text"
id="search-name"
value={this.props.searchIndexName}
onChange={this.updateSearchIndexName}
/>
</div>
</div>
<GeneralComponents.CodeEditorPanel
id={'search-function'}
className="ace-editor-section mb-3"
ref={node => this.searchIndexEditor = node}
title={"Search index function"}
allowZenMode={false}
docLink={app.helpers.getDocUrl('SEARCH_INDEXES')}
defaultCode={this.props.searchIndexFunction}
blur={this.props.blur} />
<Analyzer ref={node => this.analyzer = node} {...this.props}/>