Skip to content

Commit

Permalink
Add new configuration fields; pass down edit mode as prop
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Oct 5, 2021
1 parent 555de94 commit f31678e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/SearchBlock/SearchBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const SearchBlockEdit = (props) => {

return (
<div>
<SearchBlockView {...props} />
<SearchBlockView {...props} mode="edit" />
<SidebarPortal selected={props.selected}>
<BlockDataForm
schema={schema}
Expand Down
4 changes: 2 additions & 2 deletions src/SearchBlock/SearchBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const applyBlockSettings = (config, appName, data, schema) => {
};

export default function SearchBlockView(props) {
const { data = {} } = props;
const { data = {}, mode = 'view' } = props;
const schema = SearchBlockSchema(props);
const { appName = 'default' } = data;
const registry = applyBlockSettings(
Expand All @@ -57,7 +57,7 @@ export default function SearchBlockView(props) {
console.log('registry', { data, registry });
return (
<div className="searchlib-block">
<SearchApp registry={registry} appName={appName} />
<SearchApp registry={registry} appName={appName} mode={mode} />
</div>
);
}
15 changes: 15 additions & 0 deletions src/SearchBlock/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export const SearchBlockSchema = () => ({
title: 'Default',
fields: ['appName'],
},
{
id: 'general',
title: 'General settings',
fields: ['headline', 'subheadline'],
},
{
id: 'nlp',
title: 'NLP Capabilities Settings',
Expand All @@ -21,6 +26,16 @@ export const SearchBlockSchema = () => ({
title: 'Searchlib app',
choices: [],
},

headline: {
title: 'Main headline',
configPath: 'title',
},
subheadline: {
title: 'Text below headline',
configPath: 'subheadline',
},

use_qa_dp: {
title: 'Use DensePassageRetrieval for QA?',
description: (
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const installGlobalSearch = (config) => {
const { globalsearch } = config.settings.searchlib.searchui;

globalsearch.elastic_index = '_es/globalsearch';
globalsearch.layoutComponent = 'LeftColumnLayout';
// globalsearch.layoutComponent = 'LeftColumnLayout';

return config;
};
Expand Down

0 comments on commit f31678e

Please sign in to comment.