<MetaSize component={component} measures={measures} />
- <MetaTags component={component} />
+ {isProject && <MetaTags component={component} />}
{shouldShowQualityGate && <MetaQualityGate gate={qualityGate} />}
<TagsList
tags={tags.length ? tags : [translate('no_tags')]}
allowUpdate={true}
- allowMultiLine={true}
/>
</button>
{popupOpen &&
expect(shallow(<MetaTags component={componentWithTags} />)).toMatchSnapshot();
});
-
it('should open the tag selector on click', () => {
const wrapper = shallow(<MetaTags component={componentWithTags} />);
expect(wrapper).toMatchSnapshot();
className="button-link"
onClick={[Function]}>
<TagsList
- allowMultiLine={true}
+ allowMultiLine={false}
allowUpdate={true}
tags={
Array [
className="button-link"
onClick={[Function]}>
<TagsList
- allowMultiLine={true}
+ allowMultiLine={false}
allowUpdate={true}
tags={
Array [
className="button-link"
onClick={[Function]}>
<TagsList
- allowMultiLine={true}
+ allowMultiLine={false}
allowUpdate={true}
tags={
Array [
className="button-link"
onClick={[Function]}>
<TagsList
- allowMultiLine={true}
+ allowMultiLine={false}
allowUpdate={true}
tags={
Array [
searchResult: Array<string>
};
-const PAGE_SIZE = 20;
+const LIST_SIZE = 10;
class ProjectTagsSelectorContainer extends React.PureComponent {
props: Props;
}
onSearch = (query: string) => {
- searchProjectTags({ q: query || '', ps: PAGE_SIZE }).then(result => {
+ searchProjectTags({
+ q: query || '',
+ ps: Math.min(this.props.selectedTags.length - 1 + LIST_SIZE, 100)
+ }).then(result => {
this.setState({
searchResult: result.tags
});
position={this.props.position}
tags={this.state.searchResult}
selectedTags={this.props.selectedTags}
+ listSize={LIST_SIZE}
onSearch={this.onSearch}
onSelect={this.onSelect}
onUnselect={this.onUnselect}
type Props = {
selectedElements: Array<string>,
elements: Array<string>,
+ listSize: number,
onSearch: (string) => void,
onSelect: (string) => void,
onUnselect: (string) => void,
};
static defaultProps = {
+ listSize: 10,
validateSearchInput: (value: string) => value
};
}
updateUnselectedElements(props: Props) {
- this.setState({
- unselectedElements: difference(props.elements, props.selectedElements)
+ this.setState((state: State) => {
+ if (props.listSize < state.selectedElements.length) {
+ return { unselectedElements: [] };
+ } else {
+ return {
+ unselectedElements: difference(props.elements, props.selectedElements).slice(
+ 0,
+ props.listSize - state.selectedElements.length
+ )
+ };
+ }
});
}
+.tags-list {
+ white-space: nowrap;
+}
+
.tags-list i::before {
font-size: 12px;
}
position: {},
tags: Array<string>,
selectedTags: Array<string>,
+ listSize: number,
onSearch: (string) => void,
onSelect: (string) => void,
onUnselect: (string) => void
return (
<BubblePopup
position={this.props.position}
- customClass="bubble-popup-bottom-right bubble-popup-menu"
+ customClass="bubble-popup-bottom-right bubble-popup-menu abs-width-300"
>
<MultiSelect
elements={this.props.tags}
selectedElements={this.props.selectedTags}
+ listSize={this.props.listSize}
onSearch={this.props.onSearch}
onSelect={this.props.onSelect}
onUnselect={this.props.onUnselect}
exports[`test should render with selected tags 1`] = `
<BubblePopup
- customClass="bubble-popup-bottom-right bubble-popup-menu"
+ customClass="bubble-popup-bottom-right bubble-popup-menu abs-width-300"
position={
Object {
"left": 0,
"baz",
]
}
+ listSize={10}
onSearch={[Function]}
onSelect={[Function]}
onUnselect={[Function]}
exports[`test should render without tags at all 1`] = `
<BubblePopup
- customClass="bubble-popup-bottom-right bubble-popup-menu"
+ customClass="bubble-popup-bottom-right bubble-popup-menu abs-width-300"
position={
Object {
"left": 0,
}>
<MultiSelect
elements={Array []}
+ listSize={10}
onSearch={[Function]}
onSelect={[Function]}
onUnselect={[Function]}
padding: 4px 16px 0;
.search-box-input { font-size: @smallFontSize; }
+
+ .search-box-submit { vertical-align: baseline; }
}
.menu-search ~ .menu {