Skip to content

Commit

Permalink
added comment and popover id
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelolo24 committed Jun 12, 2020
1 parent e269a1a commit bdd87fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ const EdgeLineComponent = React.memo(

let elapsedTimeLeftPosPct = 50;

/**
* Calculates a fractional offset from 0 -> 5% as magFactorX decreases from 1 to a min of .5
*/
if (magFactorX < 1) {
const fractionalOffset = (1 / magFactorX) * ((1 - magFactorX) * 10);
elapsedTimeLeftPosPct += fractionalOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { i18n } from '@kbn/i18n';
import React, { ReactNode, useState, useMemo, useCallback } from 'react';
import { EuiSelectable, EuiButton, EuiPopover, ButtonColor } from '@elastic/eui';
import { EuiSelectable, EuiButton, EuiPopover, ButtonColor, htmlIdGenerator } from '@elastic/eui';
import styled from 'styled-components';

/**
Expand Down Expand Up @@ -35,7 +35,7 @@ export const subMenuAssets = {
}),
},
};

const idGenerator = htmlIdGenerator();
interface ResolverSubmenuOption {
optionTitle: string;
action: () => unknown;
Expand Down Expand Up @@ -137,7 +137,8 @@ const NodeSubMenuComponents = React.memo(
[menuAction]
);

const closePopover = () => setMenuOpen(false);
const closePopover = useCallback(() => setMenuOpen(false), []);
const popoverId = idGenerator('submenu-popover');

const isMenuLoading = optionsWithActions === 'waitingForRelatedEventData';

Expand Down Expand Up @@ -182,7 +183,7 @@ const NodeSubMenuComponents = React.memo(
return (
<div className={className + (menuIsOpen ? ' is-open' : '')}>
<EuiPopover
id="popover"
id={popoverId}
panelPaddingSize="none"
button={submenuPopoverButton}
isOpen={menuIsOpen}
Expand Down

0 comments on commit bdd87fd

Please sign in to comment.