Skip to content

Commit 8731c35

Browse files
404-htmlmtrezza
authored andcommitted
fix: context menu in data browser not opening for cell of type number (#1913)
1 parent 3ec64c3 commit 8731c35

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

src/components/BrowserCell/BrowserCell.react.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,17 @@ export default class BrowserCell extends Component {
285285
return {
286286
text: 'Set filter...', items: constraints.map(constraint => {
287287
const definition = Filters.Constraints[constraint];
288+
const copyableValue = String(this.copyableValue);
288289
// Smart ellipsis for value - if it's long trim it in the middle: Lorem ipsum dolor si... aliqua
289-
const value = this.copyableValue.length < 30 ? this.copyableValue :
290-
`${this.copyableValue.substr(0, 20)}...${this.copyableValue.substr(this.copyableValue.length - 7)}`;
291-
const text = `${this.props.field} ${definition.name}${definition.comparable ? (' ' + value) : ''}`;
290+
const value =
291+
copyableValue.length < 30
292+
? copyableValue
293+
: `${copyableValue.substr(0, 20)}...${copyableValue.substr(
294+
copyableValue.length - 7
295+
)}`;
296+
const text = `${this.props.field} ${definition.name}${
297+
definition.comparable ? ' ' + value : ''
298+
}`;
292299
return {
293300
text,
294301
callback: this.pickFilter.bind(this, constraint)

src/components/ContextMenu/ContextMenu.react.js

+25-9
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,32 @@ const MenuSection = ({ level, items, path, setPath, hide }) => {
5151
return (<ul ref={sectionRef} className={styles.category} style={style}>
5252
{items.map((item, index) => {
5353
if (item.items) {
54-
return (<li className={styles.item} onMouseEnter={() => {
55-
const newPath = path.slice(0, level + 1);
56-
newPath.push(index);
57-
setPath(newPath);
58-
}}>{item.text}</li>);
54+
return (
55+
<li
56+
key={`menu-section-${level}-${index}`}
57+
className={styles.item}
58+
onMouseEnter={() => {
59+
const newPath = path.slice(0, level + 1);
60+
newPath.push(index);
61+
setPath(newPath);
62+
}}
63+
>
64+
{item.text}
65+
</li>
66+
);
5967
}
60-
return (<li className={styles.option} onClick={() => {
61-
item.callback && item.callback();
62-
hide();
63-
}}>{item.text}</li>);
68+
return (
69+
<li
70+
key={`menu-section-${level}-${index}`}
71+
className={styles.option}
72+
onClick={() => {
73+
item.callback && item.callback();
74+
hide();
75+
}}
76+
>
77+
{item.text}
78+
</li>
79+
);
6480
})}
6581
</ul>);
6682
}

0 commit comments

Comments
 (0)