Skip to content

Commit

Permalink
add domain to indicator user filter options #546
Browse files Browse the repository at this point in the history
  • Loading branch information
tmfrnz committed May 4, 2024
1 parent 5021069 commit 9b62054
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions app/components/EntityListSidebar/filterOptionsFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ export const makeAttributeFilterOptions = (entities, config, activeOptionId, loc
} else if (option.reference && !!entity.get(option.reference.key)) {
filterOptions.options[value] = {
label: entity.getIn([option.reference.key, 'attributes', option.reference.label]),
sublabel: option.reference.sublabel
? entity.getIn([option.reference.key, 'attributes', option.reference.sublabel])
: null,
showCount: true,
value: queryValue,
count: 1,
Expand Down Expand Up @@ -485,7 +488,6 @@ export const makeConnectionFilterOptions = (
const value = `${path}:${connectedId}`;
const reference = getEntityReference(connection);
const label = getEntityTitle(connection, option.labels, contextIntl);
const domain = entity.getIn(['attributes', 'domain']);
filterOptions.options[connectedId] = {
label,
reference,
Expand All @@ -496,7 +498,6 @@ export const makeConnectionFilterOptions = (
checked: optionChecked(locationQueryValue, value),
tags: connection.get('categories'),
draft: connection.getIn(['attributes', 'draft']),
domain,
};
}
}
Expand Down
12 changes: 5 additions & 7 deletions app/components/forms/MultiSelectControl/Option.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Id = styled.span`
font-size: ${(props) => props.theme.sizes.print.small};
}
`;
const Domain = styled.div`
const Sublabel = styled.div`
color: ${palette('text', 1)};
font-size: 0.8em;
opacity: 0.6;
Expand All @@ -52,7 +52,7 @@ class Option extends React.Component { // eslint-disable-line react/prefer-state
render() {
const { intl } = this.context;
const {
draft, reference, message, label, messagePrefix, isNew, domain,
draft, reference, message, label, messagePrefix, isNew, sublabel,
} = this.props;

let optionLabel;
Expand Down Expand Up @@ -86,10 +86,8 @@ class Option extends React.Component { // eslint-disable-line react/prefer-state
)
}
</div>
{domain && (
<Domain>
<FormattedMessage {...messages.domain} values={{ domain }} />
</Domain>
{sublabel && (
<Sublabel>{sublabel}</Sublabel>
)}
</Label>
);
Expand All @@ -101,7 +99,7 @@ Option.propTypes = {
message: PropTypes.string,
messagePrefix: PropTypes.string,
reference: PropTypes.string,
domain: PropTypes.string,
sublabel: PropTypes.string,
draft: PropTypes.bool,
isNew: PropTypes.bool,
};
Expand Down
2 changes: 1 addition & 1 deletion app/components/forms/MultiSelectControl/OptionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class OptionList extends React.PureComponent {
message={option.get('message')}
isNew={option.get('isNew')}
draft={option.get('draft')}
domain={option.get('domain')}
sublabel={option.get('domain') || option.get('sublabel')}
/>
</OptionLabel>
{ option.get('showCount') && typeof option.get('count') !== 'undefined'
Expand Down
1 change: 0 additions & 1 deletion app/containers/EntityListForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class EntityListForm extends React.Component { // eslint-disable-line react/pref
} else {
formTitle = formOptions.title;
}

return (
<Styled
sidebarResponsiveLarge={!formOptions.advanced}
Expand Down
1 change: 1 addition & 0 deletions app/containers/IndicatorList/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const CONFIG = {
reference: {
key: 'manager',
label: 'name',
sublabel: 'domain',
without: true,
},
},
Expand Down

0 comments on commit 9b62054

Please sign in to comment.