diff --git a/applications/client/src/views/Campaign/Explore/Panels/Beacon/Beacon.tsx b/applications/client/src/views/Campaign/Explore/Panels/Beacon/Beacon.tsx index 1c5ebe0c..2d1211ba 100644 --- a/applications/client/src/views/Campaign/Explore/Panels/Beacon/Beacon.tsx +++ b/applications/client/src/views/Campaign/Explore/Panels/Beacon/Beacon.tsx @@ -3,8 +3,17 @@ import { ViewOff16 } from '@carbon/icons-react'; import { dateShortFormat, semanticIcons } from '@redeye/client/components'; import type { BeaconModel } from '@redeye/client/store'; import { useStore } from '@redeye/client/store'; +import { InfoType } from '@redeye/client/types'; import { TimeStatus } from '@redeye/client/types/timeline'; -import { IconLabel, InfoRow, RowMuted, RowTime, RowTitle, useToggleHidden } from '@redeye/client/views'; +import { + IconLabel, + InfoRow, + RowMuted, + RowTime, + RowTitle, + ToggleHiddenDialog, + useToggleHidden, +} from '@redeye/client/views'; import { FlexSplitter } from '@redeye/ui-styles'; import { observer } from 'mobx-react-lite'; import type { ComponentProps } from 'react'; @@ -23,7 +32,7 @@ export const BeaconRow = observer(({ beacon, ...props }) => { [beacon.displayName, beacon.server?.displayName] ); - const [, mutateToggleHidden] = useToggleHidden( + const [toggleHidden, mutateToggleHidden] = useToggleHidden( async () => await store.graphqlStore.mutateToggleBeaconHidden({ campaignId: store.campaign?.id!, @@ -45,8 +54,8 @@ export const BeaconRow = observer(({ beacon, ...props }) => { {beacon?.displayName || `${beacon.server?.displayName}`} {beacon.meta?.[0]?.maybeCurrent?.username} - {beacon?.hidden && } + {beacon?.hidden && } (({ beacon, ...props }) => { icon={semanticIcons.commands} className={skeletonClass} /> - + toggleHidden.update('showHide', true)} + /> + { + e.stopPropagation(); + toggleHidden.update('showHide', false); + }} + onHide={() => mutateToggleHidden.mutate()} + /> ); }); diff --git a/applications/client/src/views/Campaign/Explore/Panels/Host/Host.tsx b/applications/client/src/views/Campaign/Explore/Panels/Host/Host.tsx index 8d6a1deb..192cfe15 100644 --- a/applications/client/src/views/Campaign/Explore/Panels/Host/Host.tsx +++ b/applications/client/src/views/Campaign/Explore/Panels/Host/Host.tsx @@ -2,8 +2,8 @@ import { ViewOff16 } from '@carbon/icons-react'; import { CarbonIcon, dateShortFormat, dateShortPlaceholder, semanticIcons } from '@redeye/client/components'; import type { HostModel } from '@redeye/client/store'; import { useStore } from '@redeye/client/store'; -import { TimeStatus } from '@redeye/client/types'; -import { IconLabel, InfoRow, RowTime, RowTitle, useToggleHidden } from '@redeye/client/views'; +import { InfoType, TimeStatus } from '@redeye/client/types'; +import { IconLabel, InfoRow, RowTime, RowTitle, ToggleHiddenDialog, useToggleHidden } from '@redeye/client/views'; import { FlexSplitter, Txt } from '@redeye/ui-styles'; import { observer } from 'mobx-react-lite'; import type { ComponentProps } from 'react'; @@ -18,7 +18,7 @@ export const HostRow = observer(({ host, ...props }) => { if (!host) return null; - const [, mutateToggleHidden] = useToggleHidden(async () => + const [toggleHidden, mutateToggleHidden] = useToggleHidden(async () => host.cobaltStrikeServer ? await store.graphqlStore.mutateToggleServerHidden({ campaignId: store.campaign?.id!, @@ -48,15 +48,30 @@ export const HostRow = observer(({ host, ...props }) => { {host.displayName} - {host?.hidden && } + {host?.hidden && } {!host.cobaltStrikeServer && ( <> )} - + toggleHidden.update('showHide', true)} + /> + { + e.stopPropagation(); + toggleHidden.update('showHide', false); + }} + onHide={() => mutateToggleHidden.mutate()} + /> ); }); diff --git a/applications/client/src/views/Campaign/Explore/Panels/Meta/HideDialog.tsx b/applications/client/src/views/Campaign/Explore/Panels/Meta/HideDialog.tsx index 48ac6dbc..335a0d08 100644 --- a/applications/client/src/views/Campaign/Explore/Panels/Meta/HideDialog.tsx +++ b/applications/client/src/views/Campaign/Explore/Panels/Meta/HideDialog.tsx @@ -41,7 +41,8 @@ export const ToggleHiddenDialog = observer( intent={Intent.PRIMARY} rightIcon={} loading={loading} - onClick={() => { + onClick={(e) => { + e.stopPropagation(); setLoading(true); onHide(); }} diff --git a/applications/client/src/views/Campaign/Explore/Panels/QuickMeta.tsx b/applications/client/src/views/Campaign/Explore/Panels/QuickMeta.tsx index 319c0bba..58130d90 100644 --- a/applications/client/src/views/Campaign/Explore/Panels/QuickMeta.tsx +++ b/applications/client/src/views/Campaign/Explore/Panels/QuickMeta.tsx @@ -1,4 +1,4 @@ -import { Menu, MenuItem, Position } from '@blueprintjs/core'; +import { Button, Menu, MenuItem, Position } from '@blueprintjs/core'; import { Popover2 } from '@blueprintjs/popover2'; import { OverflowMenuVertical16, View16, ViewOff16 } from '@carbon/icons-react'; import { css } from '@emotion/react'; @@ -12,10 +12,12 @@ import type { ComponentProps } from 'react'; type HostRowProps = ComponentProps<'div'> & { modal: HostModel | ServerModel | BeaconModel; - mutateToggleHidden: UseMutationResult; + mutateToggleHidden?: UseMutationResult; + disabled?: boolean; + click?: () => void; }; -export const QuickMeta = observer(({ modal, mutateToggleHidden }) => { +export const QuickMeta = observer(({ modal, mutateToggleHidden, click, disabled = false }) => { if (!modal) return null; return ( @@ -35,6 +37,7 @@ export const QuickMeta = observer(({ modal, mutateToggleHidden }) content={ (({ modal, mutateToggleHidden }) icon={} onClick={(e) => { e.stopPropagation(); - mutateToggleHidden.mutate(); + // mutateToggleHidden?.mutate(); + click?.(); }} /> } > - +