Skip to content

Commit

Permalink
Metadata: fix text/long-text types search broken (in JS)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Sep 15, 2023
1 parent 3046ddf commit b76cba2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,33 @@ class AdvancedSearch extends Component {

renderField(val) {
const {searchTools:{SearchConstants}} = this.props;
const {name:key, renderer, label} = val
const {name:key, renderer, label, userDefined} = val

const isCore = (key === SearchConstants.KeyBasename || key === SearchConstants.KeyContent || key === SearchConstants.KeyBasenameOrContent)
const fieldname = isCore ? key : SearchConstants.KeyMetaPrefix + key;
const {values} = this.props;
const value = values[fieldname];

if (renderer) {
// Custom renderer
return renderer({
...this.props,
label,
value,
fieldname:key,
fieldname: key,
onChange: this.onChange.bind(this)
});
} else if (userDefined) {
// No Custom renderer but user-defined metadata
// Output a simple textfied **wrapped with** KeyMetaPrefix
return Renderer.formRenderer(
this.props,
{...val, name: fieldname},
{[fieldname]: value},
this.onChange.bind(this)
)
} else {
// Will switch on known field names (mime, scope, search, etc)
return Renderer.formRenderer(
this.props,
val,
Expand Down Expand Up @@ -187,7 +198,7 @@ class AdvancedSearch extends Component {
{name:kk.KeyMetaShared, type:'share', label: getMessage('searchengine.share.title')},
{subheader:getMessage(489)},
{name:kk.KeyMime, type: 'mime', label: getMessage('searchengine.format.title')},
...indexedMeta.map(m => {return {...m, name: m.namespace}}), // copy namespace prop to name
...indexedMeta.map(m => {return {...m, name: m.namespace, userDefined: true}}), // copy namespace prop to name
{subheader:getMessage(498)},
{name:kk.KeyModifDate, type: 'modiftime', label: getMessage(4)},
{name:kk.KeyBytesize, type:'bytesize', label: getMessage(2)},
Expand Down

0 comments on commit b76cba2

Please sign in to comment.