|
|
@@ -8,10 +8,18 @@ type GraphContextMenuProps = ContextMenuProps & {
|
|
|
getContextMenuSource: () => FlotDataPoint | null;
|
|
|
};
|
|
|
|
|
|
-export const GraphContextMenu: React.FC<GraphContextMenuProps> = ({ getContextMenuSource, ...otherProps }) => {
|
|
|
+export const GraphContextMenu: React.FC<GraphContextMenuProps> = ({ getContextMenuSource, items, ...otherProps }) => {
|
|
|
const theme = useContext(ThemeContext);
|
|
|
const source = getContextMenuSource();
|
|
|
|
|
|
+ // Do not render items that do not have label specified
|
|
|
+ const itemsToRender = items
|
|
|
+ ? items.map(group => ({
|
|
|
+ ...group,
|
|
|
+ items: group.items.filter(item => item.label),
|
|
|
+ }))
|
|
|
+ : [];
|
|
|
+
|
|
|
const renderHeader = source
|
|
|
? () => {
|
|
|
if (!source) {
|
|
|
@@ -44,5 +52,5 @@ export const GraphContextMenu: React.FC<GraphContextMenuProps> = ({ getContextMe
|
|
|
}
|
|
|
: null;
|
|
|
|
|
|
- return <ContextMenu {...otherProps} renderHeader={renderHeader} />;
|
|
|
+ return <ContextMenu {...otherProps} items={itemsToRender} renderHeader={renderHeader} />;
|
|
|
};
|