Skip to content

Commit

Permalink
add plus between tags to clarify how they are used getredash#4628
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkovar committed Jul 2, 2020
1 parent 8f4ac95 commit 0069990
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions client/app/assets/less/redash/tags-control.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
display: inline-block;
}

.tag-separator {
margin: 4px 3px 0 0;
}

&.disabled {
opacity: 0.4;
}
Expand Down
2 changes: 1 addition & 1 deletion client/app/components/NoTaggedObjectsFound.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function NoTaggedObjectsFound({ objectType, tags }) {
return (
<BigMessage icon="fa-tags">
No {objectType} found tagged with&nbsp;
<TagsControl className="inline-tags-control" tags={Array.from(tags)} />.
<TagsControl className="inline-tags-control" tags={Array.from(tags)} tagSeparator={'+'} />.
</BigMessage>
);
}
Expand Down
14 changes: 10 additions & 4 deletions client/app/components/tags-control/TagsControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class TagsControl extends React.Component {
onEdit: PropTypes.func,
className: PropTypes.string,
tagsExtra: PropTypes.node,
tagSeparator: PropTypes.node,
children: PropTypes.node,
};

Expand All @@ -22,6 +23,7 @@ export class TagsControl extends React.Component {
onEdit: () => {},
className: "",
tagsExtra: null,
tagSeparator: null,
children: null,
};

Expand Down Expand Up @@ -49,13 +51,17 @@ export class TagsControl extends React.Component {
}

render() {
const { tags, tagSeparator } = this.props;
return (
<div className={"tags-control " + this.props.className} data-test="TagsControl">
{this.props.children}
{map(this.props.tags, tag => (
<span className="label label-tag" key={tag} title={tag} data-test="TagLabel">
{tag}
</span>
{map(tags, (tag, i) => (
<React.Fragment key={tag}>
{tagSeparator && i > 0 && <span className="tag-separator">{tagSeparator}</span>}
<span className="label label-tag" key={tag} title={tag} data-test="TagLabel">
{tag}
</span>
</React.Fragment>
))}
{this.props.canEdit && this.renderEditButton()}
{this.props.tagsExtra}
Expand Down

0 comments on commit 0069990

Please sign in to comment.