(({ ...props }) => {
)}
+ {store.router?.params.tab === Tabs.HOSTS && store.campaign?.hostGroupSelect.groupSelect && (
+
+
+ {state.hostCount} Host{state.hostCount === 1 ? '' : 's'} Selected
+
+
+ )}
+
{store.router?.params.tab === Tabs.BEACONS && store.campaign?.beaconGroupSelect.groupSelect && (
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 d8bc40be..c52c8903 100644
--- a/applications/client/src/views/Campaign/Explore/Panels/Host/Host.tsx
+++ b/applications/client/src/views/Campaign/Explore/Panels/Host/Host.tsx
@@ -1,5 +1,13 @@
+import { Checkbox } from '@blueprintjs/core';
import { ViewOff16 } from '@carbon/icons-react';
-import { CarbonIcon, dateShortFormat, dateShortPlaceholder, semanticIcons } from '@redeye/client/components';
+import { css } from '@emotion/react';
+import {
+ CarbonIcon,
+ createState,
+ dateShortFormat,
+ dateShortPlaceholder,
+ semanticIcons,
+} from '@redeye/client/components';
import type { HostModel } from '@redeye/client/store';
import { useStore } from '@redeye/client/store';
import { InfoType, TimeStatus } from '@redeye/client/types';
@@ -23,6 +31,24 @@ type HostRowProps = ComponentProps<'div'> & {
export const HostRow = observer(({ host, ...props }) => {
const store = useStore();
+ const state = createState({
+ AddHost(hostId) {
+ const selectedHosts = store.campaign?.hostGroupSelect.selectedHosts.slice();
+ selectedHosts.push(hostId);
+ store.campaign?.setHostGroupSelect({
+ groupSelect: true,
+ selectedHosts,
+ });
+ },
+ RemoveHost(hostId: string) {
+ const selectedHosts = store.campaign?.hostGroupSelect.selectedHosts.slice();
+ selectedHosts.splice(selectedHosts.indexOf(hostId), 1);
+ store.campaign?.setHostGroupSelect({
+ groupSelect: true,
+ selectedHosts,
+ });
+ },
+ });
if (!host) return null;
@@ -42,10 +68,23 @@ export const HostRow = observer(({ host, ...props }) => {
return (
(!toggleHidden.showHide ? host.select() : null)}
+ onClick={() => (!toggleHidden.showHide && !store.campaign?.hostGroupSelect.groupSelect ? host.select() : null)}
onMouseEnter={() => store.campaign?.interactionState.onHover(host.hierarchy)}
{...props}
>
+ {store.campaign?.hostGroupSelect.groupSelect && (
+
+ // @ts-ignore
+ e.target.checked && host?.id ? state.AddHost(host?.id) : state.RemoveHost(host?.id!)
+ }
+ css={css`
+ margin-bottom: 0;
+ `}
+ />
+ )}
{host.minTime ? store.settings.momentTz(host.minTime).format(dateShortFormat) : dateShortPlaceholder}—
{host.maxTime ? store.settings.momentTz(host.maxTime)?.format(dateShortFormat) : dateShortPlaceholder}
From b14843237ad3c77741e8cadbd0cb8081e125f00d Mon Sep 17 00:00:00 2001
From: Huiqing Li
Date: Fri, 3 Mar 2023 16:23:21 -0800
Subject: [PATCH 04/57] bulk edit popover
---
.../src/views/Campaign/Explore/Explore.tsx | 142 ++++++++++++++----
1 file changed, 110 insertions(+), 32 deletions(-)
diff --git a/applications/client/src/views/Campaign/Explore/Explore.tsx b/applications/client/src/views/Campaign/Explore/Explore.tsx
index d659dc32..7d69260c 100644
--- a/applications/client/src/views/Campaign/Explore/Explore.tsx
+++ b/applications/client/src/views/Campaign/Explore/Explore.tsx
@@ -1,6 +1,7 @@
import type { TabId } from '@blueprintjs/core';
-import { Button, Classes, Intent, Tab } from '@blueprintjs/core';
-import { Edit16, Launch16 } from '@carbon/icons-react';
+import { Button, Classes, Intent, Tab, Menu, MenuItem, Position } from '@blueprintjs/core';
+import { Popover2 } from '@blueprintjs/popover2';
+import { Edit16, Launch16, View16, ViewOff16 } from '@carbon/icons-react';
import { css } from '@emotion/react';
import { CarbonIcon, customIconPaths, ScrollBox } from '@redeye/client/components';
import { createState } from '@redeye/client/components/mobx-create-state';
@@ -180,23 +181,59 @@ export const Explore = observer(({ ...props }) => {
{state.hostCount} Host{state.hostCount === 1 ? '' : 's'} Selected
-
)}
@@ -205,23 +242,59 @@ export const Explore = observer(({ ...props }) => {
{state.beaconCount} Beacon{state.beaconCount === 1 ? '' : 's'} Selected
- {
- // show/hide for now
- // console.log('bulk editing: ', store.campaign?.beaconGroupSelect.selectedBeacons);
- store.campaign?.setBeaconGroupSelect({
- groupSelect: false,
- selectedBeacons: [],
- });
+ modifiers={{
+ offset: {
+ enabled: true,
+ options: {
+ offset: [0, 30],
+ },
+ },
}}
- rightIcon={}
- intent={Intent.PRIMARY}
- text="Bulk Edit"
- css={css`
- padding: 0 1rem;
- `}
- />
+ content={
+
+ }
+ >
+ }
+ intent={Intent.PRIMARY}
+ text="Bulk Edit"
+ css={css`
+ padding: 0 1rem;
+ `}
+ />
+
)}
@@ -259,5 +332,10 @@ const headerStyles = css`
align-items: flex-start;
`;
+const iconStyle = (show?: boolean) => css`
+ margin: 0;
+ color: ${show ? CoreTokens.TextBody : CoreTokens.TextDisabled} !important;
+`;
+
// eslint-disable-next-line import/no-default-export
export default Explore;
From c61c1b9aad678e54449ba910c2d41a15b0e92830 Mon Sep 17 00:00:00 2001
From: Huiqing Li
Date: Fri, 3 Mar 2023 16:35:39 -0800
Subject: [PATCH 05/57] remove popover modifier
---
.../src/views/Campaign/Explore/Explore.tsx | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/applications/client/src/views/Campaign/Explore/Explore.tsx b/applications/client/src/views/Campaign/Explore/Explore.tsx
index 7d69260c..68aa1cd8 100644
--- a/applications/client/src/views/Campaign/Explore/Explore.tsx
+++ b/applications/client/src/views/Campaign/Explore/Explore.tsx
@@ -187,14 +187,6 @@ export const Explore = observer(({ ...props }) => {
interactionKind="hover"
hoverOpenDelay={300}
disabled={state.hostCount === 0}
- modifiers={{
- offset: {
- enabled: true,
- options: {
- offset: [0, 30],
- },
- },
- }}
content={