Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/components/inputs/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class SelectInput extends Component {
if (!!readOnly) {
valueStr = options.filter((o) => JSON.stringify(o.value) === JSON.stringify(value)).map((o) => o.label);
}
const moduleProp = this.props.intl.messages[`${module}.pickerNoOptionsLabel`] ? module : "core";
console.log("moduleProp", moduleProp);
console.log("module", module);
return (
<Fragment>
{!readOnly && (
Expand All @@ -90,25 +93,33 @@ class SelectInput extends Component {
id: `${_.uuid()}-input`,
title: title,
}}
value={!!value ? JSON.stringify(value) : null}
value={!!value ? JSON.stringify(value) : ""}
onChange={this._onChange}
IconComponent={this.renderIconComponent()}
disabled={disabled}
endAdornment={this.renderEndAdornment()}
displayEmpty
//NOTE: We want to get rid of default styling (marginTop) if label is not rendered
{...(withLabel ? null : { style: { marginTop: "0px" } })}
>
{placeholder && (
<MenuItem disabled value="">
<FormattedMessage module={module} id={placeholder} />
</MenuItem>
)}
{options.map((option, idx) => (
<MenuItem key={`${module}-${name}-option-${idx}`} value={JSON.stringify(option.value)}>
{option.label}

{options.length === 0 && (
<MenuItem disabled key={`${module}-${name}-option-0`}>
<FormattedMessage module={moduleProp} id="pickerNoOptionsLabel" />
</MenuItem>
))}
)}

{options.length > 0 &&
options.map((option, idx) => (
<MenuItem key={`${module}-${name}-option-${idx}`} value={JSON.stringify(option.value)}>
{option.label}
</MenuItem>
))
}
</Select>
</FormControl>
)}
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"core.pickerNoOptionsLabel": "No options available",
"core.roleManagement.label": "Roles Management",
"core.roleManagement.searcher.results.title": "{rolesTotalCount} Roles Found",
"core.roleManagement.roleName": "Role Name",
Expand Down