Skip to content

Commit 2809d44

Browse files
resolve merge conflict
2 parents 1e5969b + 386195c commit 2809d44

File tree

10 files changed

+414
-290
lines changed

10 files changed

+414
-290
lines changed

packages/javascript/bh-shared-ui/src/views/PrivilegeZones/Details/Details.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ describe('Details', async () => {
6262
{ route: `/${privilegeZonesPath}/${zonesPath}/1/${detailsPath}` }
6363
);
6464

65-
expect(await screen.findByText(/Zones/)).toBeInTheDocument();
65+
const zonesList = await screen.findByTestId('privilege-zones_details_zones-list');
66+
expect(within(zonesList).getByText('Zones')).toBeInTheDocument();
6667

6768
expect(await screen.findByTestId('privilege-zones_details_zones-list')).toBeInTheDocument();
6869
expect(await screen.findByTestId('privilege-zones_details_selectors-list')).toBeInTheDocument();

packages/javascript/bh-shared-ui/src/views/PrivilegeZones/Details/Details.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { SortOrder } from '../../../types';
3030
import { useAppNavigate } from '../../../utils';
3131
import { PZEditButton } from '../PZEditButton';
3232
import { PrivilegeZonesContext } from '../PrivilegeZonesContext';
33+
import { PageDescription } from '../fragments';
3334
import { MembersList } from './MembersList';
3435
import SearchBar from './SearchBar';
3536
import { SelectedDetails } from './SelectedDetails';
@@ -91,6 +92,7 @@ const Details: FC = () => {
9192

9293
return (
9394
<div className='h-full'>
95+
<PageDescription />
9496
<div className='flex mt-6'>
9597
<div className='flex flex-wrap basis-2/3 justify-between'>
9698
{InfoHeader && <InfoHeader />}

packages/javascript/bh-shared-ui/src/views/PrivilegeZones/History/HistoryContent.tsx

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,34 +83,44 @@ const HistoryContent = () => {
8383
};
8484

8585
return (
86-
<div data-testid='history-wrapper' className='flex gap-8 mt-6 grow'>
87-
<Card className='grow'>
88-
<CardHeader className='flex-row ml-3 justify-between items-center'>
89-
<CardTitle>History Log</CardTitle>
90-
<div className='flex items-center '>
91-
<SearchInput value={search} onInputChange={setSearch} />
92-
<FilterDialog setFilters={setFilters} filters={filters} />
86+
<>
87+
<p className='mt-6'>
88+
The History Log provides a record of changes to your Zones and Labels, including the type of change that
89+
occurred, who made it, and when it happened.
90+
<br />
91+
Use the log to audit and track changes to your Zones and Labels over time. Log items past 90 days are
92+
cleared.
93+
</p>
94+
<div data-testid='history-wrapper' className='flex gap-8 mt-6 grow'>
95+
<Card className='grow'>
96+
<CardHeader className='flex-row ml-3 justify-between items-center'>
97+
<CardTitle>History Log</CardTitle>
98+
<div className='flex items-center '>
99+
<SearchInput value={search} onInputChange={setSearch} />
100+
<FilterDialog setFilters={setFilters} filters={filters} />
101+
</div>
102+
</CardHeader>
103+
104+
<div
105+
onScroll={(e) => fetchMoreOnBottomReached(e.currentTarget)}
106+
ref={scrollRef}
107+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
108+
tabIndex={0}
109+
className='overflow-y-auto h-[68dvh]'>
110+
<DataTable
111+
data={records}
112+
TableHeaderProps={tableHeaderProps}
113+
TableHeadProps={tableHeadProps}
114+
TableProps={tableProps}
115+
TableCellProps={tableCellProps}
116+
columns={columns}
117+
virtualizationOptions={virtualizationOptions}
118+
/>
93119
</div>
94-
</CardHeader>
95-
<div
96-
onScroll={(e) => fetchMoreOnBottomReached(e.currentTarget)}
97-
ref={scrollRef}
98-
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
99-
tabIndex={0}
100-
className='overflow-y-auto h-[68dvh]'>
101-
<DataTable
102-
data={records}
103-
TableHeaderProps={tableHeaderProps}
104-
TableHeadProps={tableHeadProps}
105-
TableProps={tableProps}
106-
TableCellProps={tableCellProps}
107-
columns={columns}
108-
virtualizationOptions={virtualizationOptions}
109-
/>
110-
</div>
111-
</Card>
112-
<HistoryNote />
113-
</div>
120+
</Card>
121+
<HistoryNote />
122+
</div>
123+
</>
114124
);
115125
};
116126

packages/javascript/bh-shared-ui/src/views/PrivilegeZones/PrivilegeZones.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const PrivilegeZones: FC = () => {
7676
if (!context) {
7777
throw new Error('PrivilegeZones must be used within a PrivilegeZonesContext.Provider');
7878
}
79-
const { savePaths, SupportLink, Summary, Certification } = context;
79+
const { savePaths, Summary, Certification } = context;
8080

8181
const childRoutes: Routable[] = [
8282
...detailsPaths.map((path) => {
@@ -112,11 +112,6 @@ const PrivilegeZones: FC = () => {
112112
<main>
113113
<div className='h-dvh min-w-full px-8'>
114114
<h1 className='text-4xl font-bold pt-8'>Privilege Zone Management</h1>
115-
<p className='mt-6'>
116-
Use Privilege Zones to segment and organize assets based on sensitivity and access level.
117-
<br />
118-
{SupportLink && <SupportLink />}
119-
</p>
120115
<div className='flex flex-col h-[75vh]'>
121116
<Tabs
122117
defaultValue={zonesPath}

packages/javascript/bh-shared-ui/src/views/PrivilegeZones/Save/SelectorForm/SelectorForm.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { useParams } from 'react-router-dom';
2222
import SelectorForm from '.';
2323
import { privilegeZonesKeys } from '../../../../hooks';
2424
import { zoneHandlers } from '../../../../mocks';
25-
import { act, render, screen, waitFor } from '../../../../test-utils';
25+
import { act, render, screen, waitFor, within } from '../../../../test-utils';
2626
import { apiClient, mockCodemirrorLayoutMethods, setUpQueryClient } from '../../../../utils';
2727
import * as utils from '../utils';
2828

@@ -115,7 +115,8 @@ describe('Selector Form', () => {
115115
expect(descriptionInput).toHaveValue('');
116116

117117
// Auto Certification dropdown should not render on BHCE
118-
expect(screen.queryByText(/Automatic Certification/i)).not.toBeInTheDocument();
118+
const form = screen.getByTestId('selector-form');
119+
expect(within(form).queryByText(/Automatic Certification/i)).not.toBeInTheDocument();
119120

120121
expect(screen.getByText('Rule Type')).toBeInTheDocument();
121122

packages/javascript/bh-shared-ui/src/views/PrivilegeZones/Save/SelectorForm/SelectorForm.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { useNotifications } from '../../../../providers';
3636
import { detailsPath, privilegeZonesPath } from '../../../../routes';
3737
import { apiClient, useAppNavigate } from '../../../../utils';
3838
import { SearchValue } from '../../../Explore';
39+
import { RulesLink } from '../../fragments';
3940
import { handleError } from '../utils';
4041
import BasicInfo from './BasicInfo';
4142
import SeedSelection from './SeedSelection';
@@ -145,7 +146,7 @@ const reducer = (state: SelectorFormState, action: Action): SelectorFormState =>
145146
};
146147

147148
const SelectorForm: FC = () => {
148-
const { tagId, selectorId = '', tagType } = usePZPathParams();
149+
const { tagId, selectorId = '', tagType, isLabelPage, tagTypeDisplay } = usePZPathParams();
149150
const navigate = useAppNavigate();
150151
const { addNotification } = useNotifications();
151152

@@ -287,10 +288,27 @@ const SelectorForm: FC = () => {
287288
return (
288289
<SelectorFormContext.Provider
289290
value={{ dispatch, seeds, selectorType, selectedObjects, selectorQuery, autoCertify }}>
291+
{selectorId !== '' ? (
292+
<p className='mt-6'>
293+
{`Update this Rule's details. ${!isLabelPage ? 'Adjust criteria, analysis, or certification settings.' : ''} Changes apply to
294+
the ${tagTypeDisplay} after the next analysis completes.`}
295+
<br />
296+
<RulesLink />.
297+
</p>
298+
) : (
299+
<p className='mt-6'>
300+
{`Create a new Rule to define which Objects belong to this ${tagTypeDisplay}. Use Object based Rules to choose
301+
directly or Cypher based Rules to query dynamically.`}{' '}
302+
<br />{' '}
303+
{`You can also enable/disable the Rule${!isLabelPage ? ' and configure certification settings' : ''}.`}{' '}
304+
<RulesLink />.
305+
</p>
306+
)}
290307
<Form {...form}>
291308
<form
292309
onSubmit={form.handleSubmit(onSubmit)}
293-
className='flex max-xl:flex-wrap gap-6 mb-6 mt-6 max-w-[120rem] justify-between pointer-events-auto'>
310+
className='flex max-xl:flex-wrap gap-6 mb-6 mt-6 max-w-[120rem] justify-between pointer-events-auto'
311+
data-testid='selector-form'>
294312
<BasicInfo control={form.control} />
295313
<SeedSelection control={form.control} />
296314
</form>

0 commit comments

Comments
 (0)