@cccsaurora/howler-ui 3.2.0-dev.1791.1 → 3.2.0-dev.1797.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/app/App.js +33 -0
- package/components/elements/display/DocumentationButton.js +9 -2
- package/components/elements/display/DocumentationButton.test.js +12 -2
- package/components/elements/display/Markdown.js +6 -0
- package/components/elements/hit/HitBanner.js +23 -2
- package/components/elements/hit/HitBanner.test.js +31 -0
- package/components/hooks/useMyPreferences.js +21 -0
- package/components/routes/advanced/QueryBuilder.js +3 -24
- package/components/routes/advanced/QueryBuilderControls.d.ts +51 -0
- package/components/routes/advanced/QueryBuilderControls.js +50 -0
- package/components/routes/cases/detail/CaseDetailControls.d.ts +16 -0
- package/components/routes/cases/detail/CaseDetailControls.js +19 -0
- package/components/routes/cases/detail/CaseDetails.js +4 -20
- package/components/routes/cases/detail/CaseRuleRow.d.ts +10 -0
- package/components/routes/cases/detail/CaseRuleRow.js +11 -0
- package/components/routes/cases/detail/CaseRules.js +4 -7
- package/components/routes/cases/detail/CaseSidebar.js +45 -89
- package/components/routes/cases/detail/CaseSidebarActions.d.ts +10 -0
- package/components/routes/cases/detail/CaseSidebarActions.js +18 -0
- package/components/routes/cases/detail/CaseSidebarNavigation.d.ts +49 -0
- package/components/routes/cases/detail/CaseSidebarNavigation.js +44 -0
- package/components/routes/cases/modals/AddRecordToCaseModal.js +3 -7
- package/components/routes/cases/modals/AddToCaseModal.js +3 -10
- package/components/routes/cases/modals/CaseItemTypeSelect.d.ts +15 -0
- package/components/routes/cases/modals/CaseItemTypeSelect.js +16 -0
- package/components/routes/cases/modals/CaseSelector.d.ts +9 -0
- package/components/routes/cases/modals/CaseSelector.js +11 -0
- package/components/routes/help/AdvancedDocumentation.d.ts +3 -0
- package/components/routes/help/AdvancedDocumentation.js +66 -0
- package/components/routes/help/AdvancedDocumentation.test.d.ts +1 -0
- package/components/routes/help/AdvancedDocumentation.test.js +95 -0
- package/components/routes/help/CaseDocumentation.d.ts +3 -0
- package/components/routes/help/CaseDocumentation.js +76 -0
- package/components/routes/help/CaseDocumentation.test.d.ts +1 -0
- package/components/routes/help/CaseDocumentation.test.js +127 -0
- package/components/routes/help/DossierDocumentation.d.ts +3 -0
- package/components/routes/help/DossierDocumentation.js +94 -0
- package/components/routes/help/DossierDocumentation.test.d.ts +1 -0
- package/components/routes/help/DossierDocumentation.test.js +90 -0
- package/components/routes/help/Help.js +4 -1
- package/components/routes/help/Help.test.js +17 -2
- package/components/routes/help/components/CaseDocumentationPreviews.d.ts +12 -0
- package/components/routes/help/components/CaseDocumentationPreviews.js +127 -0
- package/components/routes/help/markdown/en/advancedLanguages.md.js +1 -0
- package/components/routes/help/markdown/en/advancedLucene.md.js +1 -0
- package/components/routes/help/markdown/en/advancedOverview.md.js +1 -0
- package/components/routes/help/markdown/en/advancedResults.md.js +1 -0
- package/components/routes/help/markdown/en/casesFolders.md.js +1 -0
- package/components/routes/help/markdown/en/casesInvestigation.md.js +1 -0
- package/components/routes/help/markdown/en/casesItems.md.js +1 -0
- package/components/routes/help/markdown/en/casesOverview.md.js +1 -0
- package/components/routes/help/markdown/en/casesRecords.md.js +1 -0
- package/components/routes/help/markdown/en/casesRules.md.js +1 -0
- package/components/routes/help/markdown/en/casesSidebar.md.js +1 -0
- package/components/routes/help/markdown/en/casesSummary.md.js +1 -0
- package/components/routes/help/markdown/en/dossiersLeads.md.js +1 -0
- package/components/routes/help/markdown/en/dossiersOverview.md.js +1 -0
- package/components/routes/help/markdown/en/dossiersPivots.md.js +1 -0
- package/components/routes/help/markdown/en/dossiersQuery.md.js +1 -0
- package/components/routes/help/markdown/en/dossiersUsage.md.js +1 -0
- package/components/routes/help/markdown/fr/advancedLanguages.md.js +1 -0
- package/components/routes/help/markdown/fr/advancedLucene.md.js +1 -0
- package/components/routes/help/markdown/fr/advancedOverview.md.js +1 -0
- package/components/routes/help/markdown/fr/advancedResults.md.js +1 -0
- package/components/routes/help/markdown/fr/casesFolders.md.js +1 -0
- package/components/routes/help/markdown/fr/casesInvestigation.md.js +1 -0
- package/components/routes/help/markdown/fr/casesItems.md.js +1 -0
- package/components/routes/help/markdown/fr/casesOverview.md.js +1 -0
- package/components/routes/help/markdown/fr/casesRecords.md.js +1 -0
- package/components/routes/help/markdown/fr/casesRules.md.js +1 -0
- package/components/routes/help/markdown/fr/casesSidebar.md.js +1 -0
- package/components/routes/help/markdown/fr/casesSummary.md.js +1 -0
- package/components/routes/help/markdown/fr/dossiersLeads.md.js +1 -0
- package/components/routes/help/markdown/fr/dossiersOverview.md.js +1 -0
- package/components/routes/help/markdown/fr/dossiersPivots.md.js +1 -0
- package/components/routes/help/markdown/fr/dossiersQuery.md.js +1 -0
- package/components/routes/help/markdown/fr/dossiersUsage.md.js +1 -0
- package/locales/en/help/main.json +3 -0
- package/locales/en/translation.json +27 -0
- package/locales/fr/help/main.json +3 -0
- package/locales/fr/translation.json +27 -0
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Stack, Tab, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
3
|
+
import { PageCenter } from '@tui/core';
|
|
4
|
+
import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown';
|
|
5
|
+
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { useSearchParams } from 'react-router';
|
|
9
|
+
import { AddRecordsPreview, CaseControlsPreview, CaseDashboardPreview, CaseDashboardInsightsPreview, CaseDetailsPreview, CaseFolderTreePreview, CaseInvestigationViewsPreview, CaseItemTypesPreview, CaseNavigationPreview, CaseTasksPreview, CorrelationRulePreview } from './components/CaseDocumentationPreviews';
|
|
10
|
+
import HelpTabs from './components/HelpTabs';
|
|
11
|
+
import FOLDERS_EN from './markdown/en/casesFolders.md';
|
|
12
|
+
import ITEMS_EN from './markdown/en/casesItems.md';
|
|
13
|
+
import INVESTIGATION_EN from './markdown/en/casesInvestigation.md';
|
|
14
|
+
import OVERVIEW_EN from './markdown/en/casesOverview.md';
|
|
15
|
+
import RECORDS_EN from './markdown/en/casesRecords.md';
|
|
16
|
+
import RULES_EN from './markdown/en/casesRules.md';
|
|
17
|
+
import SIDEBAR_EN from './markdown/en/casesSidebar.md';
|
|
18
|
+
import SUMMARY_EN from './markdown/en/casesSummary.md';
|
|
19
|
+
import FOLDERS_FR from './markdown/fr/casesFolders.md';
|
|
20
|
+
import ITEMS_FR from './markdown/fr/casesItems.md';
|
|
21
|
+
import INVESTIGATION_FR from './markdown/fr/casesInvestigation.md';
|
|
22
|
+
import OVERVIEW_FR from './markdown/fr/casesOverview.md';
|
|
23
|
+
import RECORDS_FR from './markdown/fr/casesRecords.md';
|
|
24
|
+
import RULES_FR from './markdown/fr/casesRules.md';
|
|
25
|
+
import SIDEBAR_FR from './markdown/fr/casesSidebar.md';
|
|
26
|
+
import SUMMARY_FR from './markdown/fr/casesSummary.md';
|
|
27
|
+
const CaseDocumentation = () => {
|
|
28
|
+
const { i18n, t } = useTranslation();
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
const useHorizontal = useMediaQuery(theme.breakpoints.down(1700));
|
|
31
|
+
useScrollRestoration();
|
|
32
|
+
const sections = ['overview', 'sidebar', 'summary', 'folders', 'records', 'items', 'investigation', 'rules'];
|
|
33
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
34
|
+
const tab = sections.find(section => section === searchParams.get('tab')) ?? 'overview';
|
|
35
|
+
const onChange = useCallback((nextTab) => {
|
|
36
|
+
const nextParams = new URLSearchParams(searchParams);
|
|
37
|
+
nextParams.set('tab', nextTab);
|
|
38
|
+
setSearchParams(nextParams);
|
|
39
|
+
}, [searchParams, setSearchParams]);
|
|
40
|
+
const documentation = useMemo(() => i18n.language === 'en'
|
|
41
|
+
? {
|
|
42
|
+
overview: OVERVIEW_EN,
|
|
43
|
+
sidebar: SIDEBAR_EN,
|
|
44
|
+
summary: SUMMARY_EN,
|
|
45
|
+
folders: FOLDERS_EN,
|
|
46
|
+
records: RECORDS_EN,
|
|
47
|
+
items: ITEMS_EN,
|
|
48
|
+
investigation: INVESTIGATION_EN,
|
|
49
|
+
rules: RULES_EN
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
overview: OVERVIEW_FR,
|
|
53
|
+
sidebar: SIDEBAR_FR,
|
|
54
|
+
summary: SUMMARY_FR,
|
|
55
|
+
folders: FOLDERS_FR,
|
|
56
|
+
records: RECORDS_FR,
|
|
57
|
+
items: ITEMS_FR,
|
|
58
|
+
investigation: INVESTIGATION_FR,
|
|
59
|
+
rules: RULES_FR
|
|
60
|
+
}, [i18n.language]);
|
|
61
|
+
const documentationComponents = {
|
|
62
|
+
case_navigation: _jsx(CaseNavigationPreview, {}),
|
|
63
|
+
case_controls: _jsx(CaseControlsPreview, {}),
|
|
64
|
+
case_details: _jsx(CaseDetailsPreview, {}),
|
|
65
|
+
case_dashboard: _jsx(CaseDashboardPreview, {}),
|
|
66
|
+
case_dashboard_insights: _jsx(CaseDashboardInsightsPreview, {}),
|
|
67
|
+
folder_tree: _jsx(CaseFolderTreePreview, {}),
|
|
68
|
+
add_records: _jsx(AddRecordsPreview, {}),
|
|
69
|
+
case_tasks: _jsx(CaseTasksPreview, {}),
|
|
70
|
+
investigation_views: _jsx(CaseInvestigationViewsPreview, {}),
|
|
71
|
+
correlation_rule: _jsx(CorrelationRulePreview, {}),
|
|
72
|
+
case_item_types: _jsx(CaseItemTypesPreview, {})
|
|
73
|
+
};
|
|
74
|
+
return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { sx: { flexDirection: useHorizontal ? 'column' : 'row', '& h1': { mt: 0 } }, children: [_jsx(HelpTabs, { value: tab, children: sections.map(section => (_jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t(`help.cases.${section}.title`) }), value: section, onClick: () => onChange(section) }, section))) }), _jsx(Box, { children: tab in documentation && _jsx(Markdown, { md: documentation[tab], components: documentationComponents }) })] }) }));
|
|
75
|
+
};
|
|
76
|
+
export default CaseDocumentation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
const mockUseMediaQuery = vi.hoisted(() => vi.fn(() => false));
|
|
7
|
+
const mockSetSearchParams = vi.hoisted(() => vi.fn());
|
|
8
|
+
const mockSearchParams = vi.hoisted(() => ({ value: new URLSearchParams() }));
|
|
9
|
+
const mockLanguage = vi.hoisted(() => ({ value: 'en' }));
|
|
10
|
+
vi.mock('@mui/material', async (importOriginal) => {
|
|
11
|
+
const actual = await importOriginal();
|
|
12
|
+
return {
|
|
13
|
+
...actual,
|
|
14
|
+
useMediaQuery: mockUseMediaQuery
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
vi.mock('@tui/core', () => ({
|
|
18
|
+
PageCenter: ({ children }) => _jsx("div", { children: children }),
|
|
19
|
+
useAppTheme: () => ({ isDark: false }),
|
|
20
|
+
useAppUser: () => ({ user: { username: 'documentation-analyst' } })
|
|
21
|
+
}));
|
|
22
|
+
vi.mock('mermaid', () => ({
|
|
23
|
+
default: {
|
|
24
|
+
initialize: vi.fn(),
|
|
25
|
+
run: vi.fn()
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
vi.mock('components/elements/display/Notebook', () => ({
|
|
29
|
+
Notebook: () => null
|
|
30
|
+
}));
|
|
31
|
+
vi.mock('components/elements/UserList', () => ({
|
|
32
|
+
default: ({ userIds }) => _jsx("div", { children: userIds.join(',') })
|
|
33
|
+
}));
|
|
34
|
+
vi.mock('../cases/detail/aggregates/CaseAggregate', () => ({
|
|
35
|
+
default: ({ subtitle }) => _jsx("div", { children: subtitle })
|
|
36
|
+
}));
|
|
37
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
38
|
+
useScrollRestoration: vi.fn()
|
|
39
|
+
}));
|
|
40
|
+
vi.mock('react-i18next', () => ({
|
|
41
|
+
useTranslation: () => ({
|
|
42
|
+
i18n: { language: mockLanguage.value },
|
|
43
|
+
t: (key) => {
|
|
44
|
+
const labels = {
|
|
45
|
+
'modal.cases.add_to_case': { en: 'Add to Case', fr: 'Ajouter au cas' },
|
|
46
|
+
'page.cases.sidebar.add_event': { en: 'Add event', fr: 'Ajouter un événement' }
|
|
47
|
+
};
|
|
48
|
+
return labels[key]?.[mockLanguage.value] ?? key;
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
}));
|
|
52
|
+
vi.mock('react-router', () => ({
|
|
53
|
+
Link: ({ children, to }) => _jsx("a", { href: to, children: children }),
|
|
54
|
+
useLocation: () => ({ pathname: '/cases/example-case', search: '' }),
|
|
55
|
+
useSearchParams: () => [mockSearchParams.value, mockSetSearchParams]
|
|
56
|
+
}));
|
|
57
|
+
vi.mock('./components/HelpTabs', () => ({
|
|
58
|
+
default: ({ children }) => _jsx("div", { children: children })
|
|
59
|
+
}));
|
|
60
|
+
import CaseDocumentation from './CaseDocumentation';
|
|
61
|
+
describe('CaseDocumentation', () => {
|
|
62
|
+
beforeEach(() => {
|
|
63
|
+
mockLanguage.value = 'en';
|
|
64
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'summary', keep: 'value' });
|
|
65
|
+
mockSetSearchParams.mockClear();
|
|
66
|
+
});
|
|
67
|
+
it('renders the query-selected tab and updates the query string when navigating', async () => {
|
|
68
|
+
const user = userEvent.setup();
|
|
69
|
+
render(_jsx(CaseDocumentation, {}));
|
|
70
|
+
expect(screen.getByRole('heading', { name: 'Case summary' })).toBeInTheDocument();
|
|
71
|
+
await user.click(screen.getByRole('tab', { name: 'help.cases.rules.title' }));
|
|
72
|
+
expect(mockSetSearchParams).toHaveBeenCalledTimes(1);
|
|
73
|
+
const nextParams = mockSetSearchParams.mock.calls[0][0];
|
|
74
|
+
expect(nextParams.get('tab')).toBe('rules');
|
|
75
|
+
expect(nextParams.get('keep')).toBe('value');
|
|
76
|
+
});
|
|
77
|
+
it('renders localized Markdown and translated preview components', () => {
|
|
78
|
+
mockLanguage.value = 'fr';
|
|
79
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'records' });
|
|
80
|
+
render(_jsx(CaseDocumentation, {}));
|
|
81
|
+
expect(screen.getByRole('heading', { name: 'Ajouter des enregistrements aux cas' })).toBeInTheDocument();
|
|
82
|
+
const previewLabel = screen.getByRole('heading', { name: 'Ajouter au cas' });
|
|
83
|
+
expect(previewLabel).toBeInTheDocument();
|
|
84
|
+
});
|
|
85
|
+
it.each([
|
|
86
|
+
{ language: 'en', label: 'Add event', link: 'Adding records to cases' },
|
|
87
|
+
{ language: 'fr', label: 'Ajouter un événement', link: 'Ajouter des enregistrements aux cas' }
|
|
88
|
+
])('renders the event control and records guide link in $language', ({ language, label, link }) => {
|
|
89
|
+
mockLanguage.value = language;
|
|
90
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'sidebar' });
|
|
91
|
+
render(_jsx(CaseDocumentation, {}));
|
|
92
|
+
expect(screen.getByRole('button', { name: label })).toBeInTheDocument();
|
|
93
|
+
expect(screen.getByRole('link', { name: link })).toHaveAttribute('href', '/help/cases?tab=records');
|
|
94
|
+
});
|
|
95
|
+
it.each([
|
|
96
|
+
{ language: 'en', heading: 'Backfill historical matches', control: 'Submit to correlation' },
|
|
97
|
+
{ language: 'fr', heading: 'Rattraper les correspondances historiques', control: 'Soumettre à la corrélation' }
|
|
98
|
+
])('renders the historical backfill guide in $language', ({ language, heading, control }) => {
|
|
99
|
+
mockLanguage.value = language;
|
|
100
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'rules' });
|
|
101
|
+
render(_jsx(CaseDocumentation, {}));
|
|
102
|
+
expect(screen.getByRole('heading', { name: heading })).toBeInTheDocument();
|
|
103
|
+
expect(screen.getByText(control, { selector: 'strong' })).toBeInTheDocument();
|
|
104
|
+
});
|
|
105
|
+
it.each([
|
|
106
|
+
{ tab: 'folders', example: 'Investigation' },
|
|
107
|
+
{ tab: 'investigation', example: 'page.cases.search' },
|
|
108
|
+
{ tab: 'rules', example: 'alerts/{{howler.analytic}}' }
|
|
109
|
+
])('renders the actual $tab example control', ({ tab, example }) => {
|
|
110
|
+
mockSearchParams.value = new URLSearchParams({ tab });
|
|
111
|
+
render(_jsx(CaseDocumentation, {}));
|
|
112
|
+
expect(screen.getAllByText(example).length).toBeGreaterThan(0);
|
|
113
|
+
});
|
|
114
|
+
it('renders the actual item-type selector in the items guide', () => {
|
|
115
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'items' });
|
|
116
|
+
render(_jsx(CaseDocumentation, {}));
|
|
117
|
+
expect(screen.getByRole('combobox', { name: 'modal.cases.add_item.type' })).toBeInTheDocument();
|
|
118
|
+
});
|
|
119
|
+
it('shows the dashboard aggregate cards in the summary guide', () => {
|
|
120
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'summary' });
|
|
121
|
+
render(_jsx(CaseDocumentation, {}));
|
|
122
|
+
expect(screen.getByText('page.cases.dashboard.threat')).toBeInTheDocument();
|
|
123
|
+
expect(screen.getByText('page.cases.dashboard.target')).toBeInTheDocument();
|
|
124
|
+
expect(screen.getByText('page.cases.dashboard.indicators')).toBeInTheDocument();
|
|
125
|
+
expect(screen.getByText('page.cases.dashboard.duration')).toBeInTheDocument();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '@iconify/react';
|
|
3
|
+
import { Language, Person } from '@mui/icons-material';
|
|
4
|
+
import { Box, Stack, Tab, Tabs, ToggleButton, ToggleButtonGroup, Tooltip, Typography, useMediaQuery, useTheme } from '@mui/material';
|
|
5
|
+
import { PageCenter } from '@tui/core';
|
|
6
|
+
import Markdown from '@cccsaurora/howler-ui/components/elements/display/Markdown';
|
|
7
|
+
import PivotLink from '@cccsaurora/howler-ui/components/elements/hit/related/pivots/PivotLink';
|
|
8
|
+
import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
|
|
9
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import { useSearchParams } from 'react-router';
|
|
12
|
+
import LeadRenderer from '../hits/view/LeadRenderer';
|
|
13
|
+
import RecordQuery from '../hits/search/RecordQuery';
|
|
14
|
+
import HelpTabs from './components/HelpTabs';
|
|
15
|
+
import LEADS_EN from './markdown/en/dossiersLeads.md';
|
|
16
|
+
import OVERVIEW_EN from './markdown/en/dossiersOverview.md';
|
|
17
|
+
import PIVOTS_EN from './markdown/en/dossiersPivots.md';
|
|
18
|
+
import QUERY_EN from './markdown/en/dossiersQuery.md';
|
|
19
|
+
import USAGE_EN from './markdown/en/dossiersUsage.md';
|
|
20
|
+
import LEADS_FR from './markdown/fr/dossiersLeads.md';
|
|
21
|
+
import OVERVIEW_FR from './markdown/fr/dossiersOverview.md';
|
|
22
|
+
import PIVOTS_FR from './markdown/fr/dossiersPivots.md';
|
|
23
|
+
import QUERY_FR from './markdown/fr/dossiersQuery.md';
|
|
24
|
+
import USAGE_FR from './markdown/fr/dossiersUsage.md';
|
|
25
|
+
const SAMPLE_LEAD = {
|
|
26
|
+
icon: 'material-symbols:find-in-page',
|
|
27
|
+
format: 'markdown',
|
|
28
|
+
label: { en: 'Investigation guide', fr: "Guide d'investigation" },
|
|
29
|
+
content: 'Review the matching hit and confirm its investigation context.'
|
|
30
|
+
};
|
|
31
|
+
const SAMPLE_PIVOT = {
|
|
32
|
+
icon: 'material-symbols:link',
|
|
33
|
+
format: 'link',
|
|
34
|
+
label: { en: 'Open investigation tool', fr: "Ouvrir l'outil d'investigation" },
|
|
35
|
+
value: 'https://investigate.example/?host={{hostname}}',
|
|
36
|
+
mappings: [{ key: 'hostname', field: 'host.name' }]
|
|
37
|
+
};
|
|
38
|
+
const SAMPLE_DOSSIER = {
|
|
39
|
+
dossier_id: 'documentation-example',
|
|
40
|
+
title: 'VPN Monitor',
|
|
41
|
+
owner: 'analyst',
|
|
42
|
+
type: 'global',
|
|
43
|
+
query: 'howler.analytic:"VPN Monitor" AND howler.status:open',
|
|
44
|
+
leads: [SAMPLE_LEAD],
|
|
45
|
+
pivots: [SAMPLE_PIVOT]
|
|
46
|
+
};
|
|
47
|
+
const DossierDeliveryPreview = () => {
|
|
48
|
+
const { i18n, t } = useTranslation();
|
|
49
|
+
const [tab, setTab] = useState('details');
|
|
50
|
+
return (_jsxs(Stack, { spacing: 1, children: [_jsxs(Tabs, { value: tab, onChange: (_, nextTab) => setTab(nextTab), children: [_jsx(Tab, { label: t('hit.viewer.details'), value: "details" }), _jsx(Tab, { label: _jsxs(Stack, { direction: "row", spacing: 0.5, children: [_jsx(Icon, { icon: SAMPLE_LEAD.icon }), _jsx("span", { children: i18n.language === 'en' ? SAMPLE_LEAD.label?.en : SAMPLE_LEAD.label?.fr })] }), value: "lead" })] }), tab === 'lead' && _jsx(LeadRenderer, { lead: SAMPLE_LEAD })] }));
|
|
51
|
+
};
|
|
52
|
+
const DossierScopePreview = () => {
|
|
53
|
+
const { t } = useTranslation();
|
|
54
|
+
const [scope, setScope] = useState('global');
|
|
55
|
+
return (_jsxs(ToggleButtonGroup, { exclusive: true, size: "small", value: scope, onChange: (_, nextScope) => nextScope && setScope(nextScope), children: [_jsx(Tooltip, { title: t('route.dossiers.manager.global'), children: _jsx(ToggleButton, { value: "global", children: _jsx(Language, { fontSize: "small" }) }) }), _jsx(Tooltip, { title: t('route.dossiers.manager.personal'), children: _jsx(ToggleButton, { value: "personal", children: _jsx(Person, { fontSize: "small" }) }) })] }));
|
|
56
|
+
};
|
|
57
|
+
const DossierDocumentation = () => {
|
|
58
|
+
const { i18n, t } = useTranslation();
|
|
59
|
+
const theme = useTheme();
|
|
60
|
+
const useHorizontal = useMediaQuery(theme.breakpoints.down(1700));
|
|
61
|
+
useScrollRestoration();
|
|
62
|
+
const sections = ['overview', 'query', 'leads', 'pivots', 'usage'];
|
|
63
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
64
|
+
const tab = sections.find(section => section === searchParams.get('tab')) ?? 'overview';
|
|
65
|
+
const onChange = useCallback((nextTab) => {
|
|
66
|
+
const nextParams = new URLSearchParams(searchParams);
|
|
67
|
+
nextParams.set('tab', nextTab);
|
|
68
|
+
setSearchParams(nextParams);
|
|
69
|
+
}, [searchParams, setSearchParams]);
|
|
70
|
+
const documentation = useMemo(() => i18n.language === 'en'
|
|
71
|
+
? {
|
|
72
|
+
overview: OVERVIEW_EN,
|
|
73
|
+
query: QUERY_EN,
|
|
74
|
+
leads: LEADS_EN,
|
|
75
|
+
pivots: PIVOTS_EN,
|
|
76
|
+
usage: USAGE_EN
|
|
77
|
+
}
|
|
78
|
+
: {
|
|
79
|
+
overview: OVERVIEW_FR,
|
|
80
|
+
query: QUERY_FR,
|
|
81
|
+
leads: LEADS_FR,
|
|
82
|
+
pivots: PIVOTS_FR,
|
|
83
|
+
usage: USAGE_FR
|
|
84
|
+
}, [i18n.language]);
|
|
85
|
+
const documentationComponents = {
|
|
86
|
+
dossier_delivery: _jsx(DossierDeliveryPreview, {}),
|
|
87
|
+
dossier_scope: _jsx(DossierScopePreview, {}),
|
|
88
|
+
dossier_query: _jsx(RecordQuery, { disabled: true, triggerSearch: () => { } }),
|
|
89
|
+
dossier_lead: _jsx(LeadRenderer, { lead: SAMPLE_LEAD }),
|
|
90
|
+
dossier_pivot: _jsx(PivotLink, { pivot: SAMPLE_PIVOT, dossier: SAMPLE_DOSSIER })
|
|
91
|
+
};
|
|
92
|
+
return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { sx: { flexDirection: useHorizontal ? 'column' : 'row', '& h1': { mt: 0 } }, children: [_jsx(HelpTabs, { value: tab, children: sections.map(section => (_jsx(Tab, { label: _jsx(Typography, { variant: "caption", children: t(`help.dossiers.${section}.title`) }), value: section, onClick: () => onChange(section) }, section))) }), _jsx(Box, { children: tab in documentation && _jsx(Markdown, { md: documentation[tab], components: documentationComponents }) })] }) }));
|
|
93
|
+
};
|
|
94
|
+
export default DossierDocumentation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
const mockUseMediaQuery = vi.hoisted(() => vi.fn(() => false));
|
|
7
|
+
const mockSetSearchParams = vi.hoisted(() => vi.fn());
|
|
8
|
+
const mockSearchParams = vi.hoisted(() => ({ value: new URLSearchParams() }));
|
|
9
|
+
const mockLanguage = vi.hoisted(() => ({ value: 'en' }));
|
|
10
|
+
vi.mock('@mui/material', async (importOriginal) => {
|
|
11
|
+
const actual = await importOriginal();
|
|
12
|
+
return {
|
|
13
|
+
...actual,
|
|
14
|
+
useMediaQuery: mockUseMediaQuery
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
vi.mock('@tui/core', () => ({
|
|
18
|
+
PageCenter: ({ children }) => _jsx("div", { children: children }),
|
|
19
|
+
useAppTheme: () => ({ isDark: false })
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('mermaid', () => ({
|
|
22
|
+
default: {
|
|
23
|
+
initialize: vi.fn(),
|
|
24
|
+
run: vi.fn()
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
vi.mock('components/elements/display/Notebook', () => ({
|
|
28
|
+
Notebook: () => null
|
|
29
|
+
}));
|
|
30
|
+
vi.mock('components/hooks/useScrollRestoration', () => ({
|
|
31
|
+
useScrollRestoration: vi.fn()
|
|
32
|
+
}));
|
|
33
|
+
vi.mock('react-i18next', () => ({
|
|
34
|
+
useTranslation: () => ({
|
|
35
|
+
i18n: { language: mockLanguage.value },
|
|
36
|
+
t: (key) => key === 'route.dossiers.manager.tabs.leads' ? (mockLanguage.value === 'fr' ? 'Pistes' : 'Leads') : key
|
|
37
|
+
})
|
|
38
|
+
}));
|
|
39
|
+
vi.mock('react-router', () => ({
|
|
40
|
+
Link: ({ children, to }) => _jsx("a", { href: to, children: children }),
|
|
41
|
+
useSearchParams: () => [mockSearchParams.value, mockSetSearchParams]
|
|
42
|
+
}));
|
|
43
|
+
vi.mock('./components/HelpTabs', () => ({
|
|
44
|
+
default: ({ children }) => _jsx("div", { children: children })
|
|
45
|
+
}));
|
|
46
|
+
vi.mock('../hits/search/RecordQuery', () => ({
|
|
47
|
+
default: () => _jsx("div", { id: "record-query-preview" })
|
|
48
|
+
}));
|
|
49
|
+
import DossierDocumentation from './DossierDocumentation';
|
|
50
|
+
describe('DossierDocumentation', () => {
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
mockLanguage.value = 'en';
|
|
53
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'usage', keep: 'value' });
|
|
54
|
+
mockSetSearchParams.mockClear();
|
|
55
|
+
});
|
|
56
|
+
it('renders the query-selected tab and updates the query string when navigating', async () => {
|
|
57
|
+
const user = userEvent.setup();
|
|
58
|
+
render(_jsx(DossierDocumentation, {}));
|
|
59
|
+
expect(screen.getByRole('heading', { name: 'Manage and use dossiers' })).toBeInTheDocument();
|
|
60
|
+
await user.click(screen.getByRole('tab', { name: 'help.dossiers.query.title' }));
|
|
61
|
+
expect(mockSetSearchParams).toHaveBeenCalledTimes(1);
|
|
62
|
+
const nextParams = mockSetSearchParams.mock.calls[0][0];
|
|
63
|
+
expect(nextParams.get('tab')).toBe('query');
|
|
64
|
+
expect(nextParams.get('keep')).toBe('value');
|
|
65
|
+
});
|
|
66
|
+
it('renders localized Markdown and translated preview components', () => {
|
|
67
|
+
mockLanguage.value = 'fr';
|
|
68
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'overview' });
|
|
69
|
+
render(_jsx(DossierDocumentation, {}));
|
|
70
|
+
expect(screen.getByRole('heading', { name: "Vue d'ensemble des dossiers" })).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByRole('tab', { name: "Guide d'investigation" })).toBeInTheDocument();
|
|
72
|
+
expect(screen.getByRole('group')).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
it('uses the dossier query control from the search route', () => {
|
|
75
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'query' });
|
|
76
|
+
render(_jsx(DossierDocumentation, {}));
|
|
77
|
+
expect(screen.getByRole('heading', { name: 'Define the matching query' })).toBeInTheDocument();
|
|
78
|
+
expect(document.getElementById('record-query-preview')).toBeInTheDocument();
|
|
79
|
+
});
|
|
80
|
+
it.each([
|
|
81
|
+
{ language: 'en', heading: 'Organize pivot groups' },
|
|
82
|
+
{ language: 'fr', heading: 'Organiser les groupes de pivots' }
|
|
83
|
+
])('renders the pivot grouping guide in $language', ({ language, heading }) => {
|
|
84
|
+
mockLanguage.value = language;
|
|
85
|
+
mockSearchParams.value = new URLSearchParams({ tab: 'pivots' });
|
|
86
|
+
render(_jsx(DossierDocumentation, {}));
|
|
87
|
+
expect(screen.getByRole('heading', { name: heading })).toBeInTheDocument();
|
|
88
|
+
expect(screen.getByText('SIEM/Hosts', { selector: 'code' })).toBeInTheDocument();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -15,11 +15,14 @@ const HelpDashboard = () => {
|
|
|
15
15
|
const pluginStore = usePluginStore();
|
|
16
16
|
useScrollRestoration();
|
|
17
17
|
const tabs = useMemo(() => ({
|
|
18
|
+
'help.advanced': ['overview', 'languages', 'lucene', 'results'],
|
|
19
|
+
'help.cases': ['overview', 'sidebar', 'summary', 'folders', 'records', 'items', 'investigation', 'rules'],
|
|
20
|
+
'help.dossiers': ['overview', 'query', 'leads', 'pivots', 'usage'],
|
|
18
21
|
'help.hit': ['schema', 'header', 'bundle', 'links'],
|
|
19
22
|
'help.actions': ['introduction', ...howlerPluginStore.operations]
|
|
20
23
|
}), []);
|
|
21
24
|
const links = (leftnav?.menus?.find(menu => menu.id === 'help')?.items?.filter(_item => _item.id !== 'help.main') ??
|
|
22
25
|
[]);
|
|
23
|
-
return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { spacing: 1, children: [_jsxs(Typography, { variant: "h3", sx: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx(HelpCenter, { fontSize: "inherit", sx: { mr: 1 } }), _jsx("span", { children: t('page.help.title') })] }), _jsx(Divider, { sx: theme => ({ marginLeft: `${theme.spacing(1)} !important` }) }), _jsx(Grid, { container: true, spacing: 1, sx: { pr: 1 }, children: links.map(link => (_jsx(Grid, { size: { xs: 12, md: 3 }, sx: { display: 'flex' }, children: _jsxs(Card, { sx: { flex: 1, display: 'flex', flexDirection: 'column' }, children: [_jsx(CardHeader, { title: _jsxs(Stack, { direction: "row", alignItems: "center", sx: { '& svg': { fontSize: 'inherit' }, '& > span': { ml: 1 } }, children: [link.icon, link.i18nKey && _jsx("span", { children: t(link.i18nKey) }), _jsx(IconButton, { component: Link, to: link.route, sx: { ml: 'auto' }, children: _jsx(OpenInNew, { color: "primary", fontSize: "inherit" }) })] }) }), _jsx(CardContent, { sx: { flex: 1 }, children: _jsx(Typography, { children: t(`helpMain:${link.i18nKey}.description`) }) }), tabs[link.id] && (_jsx(CardActions, { children: tabs[link.id].map((tab) => (_jsx(Button, { size: "small", component: Link, to: `${link.route}?tab=${tab}`, children: tab }, tab))) }))] }) }, link.id))) }), howlerPluginStore.plugins.map(plugin => pluginStore.executeFunction(`${plugin}.help`))] }) }));
|
|
26
|
+
return (_jsx(PageCenter, { margin: 4, width: "100%", maxWidth: "1750px", textAlign: "left", children: _jsxs(Stack, { spacing: 1, children: [_jsxs(Typography, { variant: "h3", sx: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx(HelpCenter, { fontSize: "inherit", sx: { mr: 1 } }), _jsx("span", { children: t('page.help.title') })] }), _jsx(Divider, { sx: theme => ({ marginLeft: `${theme.spacing(1)} !important` }) }), _jsx(Grid, { container: true, spacing: 1, sx: { pr: 1 }, children: links.map(link => (_jsx(Grid, { size: { xs: 12, md: 3 }, sx: { display: 'flex' }, children: _jsxs(Card, { sx: { flex: 1, display: 'flex', flexDirection: 'column' }, children: [_jsx(CardHeader, { title: _jsxs(Stack, { direction: "row", alignItems: "center", sx: { '& svg': { fontSize: 'inherit' }, '& > span': { ml: 1 } }, children: [link.icon, link.i18nKey && _jsx("span", { children: t(link.i18nKey) }), _jsx(IconButton, { component: Link, to: link.route, sx: { ml: 'auto' }, children: _jsx(OpenInNew, { color: "primary", fontSize: "inherit" }) })] }) }), _jsx(CardContent, { sx: { flex: 1 }, children: _jsx(Typography, { children: t(`helpMain:${link.i18nKey}.description`) }) }), tabs[link.id] && (_jsx(CardActions, { children: tabs[link.id].map((tab) => (_jsx(Button, { size: "small", component: Link, to: `${link.route}?tab=${tab}`, children: t(`${link.id}.${tab}.title`, { defaultValue: tab }) }, tab))) }))] }) }, link.id))) }), howlerPluginStore.plugins.map(plugin => pluginStore.executeFunction(`${plugin}.help`))] }) }));
|
|
24
27
|
};
|
|
25
28
|
export default HelpDashboard;
|
|
@@ -15,7 +15,10 @@ vi.mock('components/hooks/useMyPreferences', () => ({
|
|
|
15
15
|
items: [
|
|
16
16
|
{ id: 'help.main', i18nKey: 'help.main', route: '/help/main', icon: _jsx("span", { children: "skip" }) },
|
|
17
17
|
{ id: 'help.hit', i18nKey: 'help.hit', route: '/help/hit', icon: _jsx("span", { children: "hit" }) },
|
|
18
|
-
{ id: 'help.actions', i18nKey: 'help.actions', route: '/help/actions', icon: _jsx("span", { children: "action" }) }
|
|
18
|
+
{ id: 'help.actions', i18nKey: 'help.actions', route: '/help/actions', icon: _jsx("span", { children: "action" }) },
|
|
19
|
+
{ id: 'help.advanced', i18nKey: 'help.advanced', route: '/help/advanced', icon: _jsx("span", { children: "advanced" }) },
|
|
20
|
+
{ id: 'help.cases', i18nKey: 'help.cases', route: '/help/cases', icon: _jsx("span", { children: "cases" }) },
|
|
21
|
+
{ id: 'help.dossiers', i18nKey: 'help.dossiers', route: '/help/dossiers', icon: _jsx("span", { children: "dossiers" }) }
|
|
19
22
|
]
|
|
20
23
|
}
|
|
21
24
|
]
|
|
@@ -32,7 +35,16 @@ vi.mock('plugins/store', () => ({
|
|
|
32
35
|
}
|
|
33
36
|
}));
|
|
34
37
|
vi.mock('react-i18next', () => ({
|
|
35
|
-
useTranslation: () => ({
|
|
38
|
+
useTranslation: () => ({
|
|
39
|
+
t: (key, options) => {
|
|
40
|
+
const translations = {
|
|
41
|
+
'help.advanced.overview.title': "Vue d'ensemble",
|
|
42
|
+
'help.cases.overview.title': "Vue d'ensemble des cas",
|
|
43
|
+
'help.dossiers.query.title': 'Requête correspondante'
|
|
44
|
+
};
|
|
45
|
+
return translations[key] ?? options?.defaultValue ?? key;
|
|
46
|
+
}
|
|
47
|
+
})
|
|
36
48
|
}));
|
|
37
49
|
vi.mock('react-pluggable', () => ({
|
|
38
50
|
usePluginStore: () => ({ executeFunction: mockExecuteFunction })
|
|
@@ -51,6 +63,9 @@ describe('HelpDashboard', () => {
|
|
|
51
63
|
expect(screen.getByText('help.hit')).toBeInTheDocument();
|
|
52
64
|
expect(screen.getByText('help.actions')).toBeInTheDocument();
|
|
53
65
|
expect(screen.getByRole('link', { name: 'triage' })).toHaveAttribute('href', '/help/actions?tab=triage');
|
|
66
|
+
expect(screen.getByRole('link', { name: "Vue d'ensemble" })).toHaveAttribute('href', '/help/advanced?tab=overview');
|
|
67
|
+
expect(screen.getByRole('link', { name: "Vue d'ensemble des cas" })).toHaveAttribute('href', '/help/cases?tab=overview');
|
|
68
|
+
expect(screen.getByRole('link', { name: 'Requête correspondante' })).toHaveAttribute('href', '/help/dossiers?tab=query');
|
|
54
69
|
expect(screen.getByText('plugin help')).toBeInTheDocument();
|
|
55
70
|
expect(mockExecuteFunction).toHaveBeenCalledWith('sample-plugin.help');
|
|
56
71
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
export declare const CaseNavigationPreview: FC;
|
|
3
|
+
export declare const CaseInvestigationViewsPreview: FC;
|
|
4
|
+
export declare const CaseControlsPreview: FC;
|
|
5
|
+
export declare const CaseDetailsPreview: FC;
|
|
6
|
+
export declare const CaseDashboardPreview: FC;
|
|
7
|
+
export declare const CaseDashboardInsightsPreview: FC;
|
|
8
|
+
export declare const CaseFolderTreePreview: FC;
|
|
9
|
+
export declare const AddRecordsPreview: FC;
|
|
10
|
+
export declare const CaseTasksPreview: FC;
|
|
11
|
+
export declare const CorrelationRulePreview: FC;
|
|
12
|
+
export declare const CaseItemTypesPreview: FC;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Add, Circle, People } from '@mui/icons-material';
|
|
3
|
+
import { Box, Button, Card, CardContent, Chip, Divider, Grid, Paper, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography, useTheme } from '@mui/material';
|
|
4
|
+
import { useAppUser } from '@tui/core';
|
|
5
|
+
import UserList from '@cccsaurora/howler-ui/components/elements/UserList';
|
|
6
|
+
import { ESCALATION_COLOR_MAP } from '@cccsaurora/howler-ui/components/routes/cases/constants';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
import CaseAggregate from '../../cases/detail/aggregates/CaseAggregate';
|
|
11
|
+
import { CaseEscalationControl, CaseStatusControl } from '../../cases/detail/CaseDetailControls';
|
|
12
|
+
import CaseOverview from '../../cases/detail/CaseOverview';
|
|
13
|
+
import CaseRuleRow from '../../cases/detail/CaseRuleRow';
|
|
14
|
+
import CaseSidebarActions from '../../cases/detail/CaseSidebarActions';
|
|
15
|
+
import CaseSidebarNavigation from '../../cases/detail/CaseSidebarNavigation';
|
|
16
|
+
import CaseTask from '../../cases/detail/CaseTask';
|
|
17
|
+
import FolderEntry from '../../cases/detail/sidebar/FolderEntry';
|
|
18
|
+
import CaseItemTypeSelect, { CASE_ITEM_TYPES } from '../../cases/modals/CaseItemTypeSelect';
|
|
19
|
+
import CaseRecordRow from '../../cases/modals/CaseRecordRow';
|
|
20
|
+
import CaseSelector from '../../cases/modals/CaseSelector';
|
|
21
|
+
const EXAMPLE_CASE = {
|
|
22
|
+
__index: 'case',
|
|
23
|
+
case_id: 'example-case',
|
|
24
|
+
created: '2025-01-01T12:00:00Z',
|
|
25
|
+
updated: '2025-01-01T12:00:00Z',
|
|
26
|
+
start: '2025-01-01T12:00:00Z',
|
|
27
|
+
end: '2025-01-01T13:24:00Z',
|
|
28
|
+
title: 'VPN investigation',
|
|
29
|
+
summary: 'Review the unusual VPN connection and related activity.',
|
|
30
|
+
overview: '## Investigation notes\n\nCollect relevant evidence and document findings here.',
|
|
31
|
+
status: 'in-progress',
|
|
32
|
+
escalation: 'focus',
|
|
33
|
+
items: [
|
|
34
|
+
{ id: 'folder-investigation', type: 'folder', name: 'Investigation', value: 'Investigation' },
|
|
35
|
+
{ id: 'hit-vpn', type: 'hit', name: 'VPN Monitor', value: 'hit-vpn' }
|
|
36
|
+
],
|
|
37
|
+
tasks: [{ id: 'task-review', summary: 'Review the VPN activity', complete: false }]
|
|
38
|
+
};
|
|
39
|
+
const EXAMPLE_EVENT = {
|
|
40
|
+
__index: 'event',
|
|
41
|
+
timestamp: '2025-01-01T12:00:00Z',
|
|
42
|
+
message: 'Manual evidence from VPN investigation',
|
|
43
|
+
howler: { id: 'event-vpn-001', hash: 'example-hash', analytic: 'VPN Monitor' },
|
|
44
|
+
event: { kind: 'event' }
|
|
45
|
+
};
|
|
46
|
+
const EXAMPLE_AGGREGATE_HIT = {
|
|
47
|
+
howler: {
|
|
48
|
+
analytic: 'VPN Monitor',
|
|
49
|
+
assignment: 'documentation-analyst',
|
|
50
|
+
hash: 'example-hit-hash',
|
|
51
|
+
id: 'hit-vpn-001',
|
|
52
|
+
outline: {
|
|
53
|
+
threat: 'Credential access',
|
|
54
|
+
target: 'VPN gateway',
|
|
55
|
+
indicators: ['192.0.2.24']
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const EXAMPLE_RULE = {
|
|
60
|
+
rule_id: 'example-rule',
|
|
61
|
+
destination: 'alerts/{{howler.analytic}}',
|
|
62
|
+
query: 'howler.analytic:Suspicious*',
|
|
63
|
+
author: 'analyst',
|
|
64
|
+
enabled: true,
|
|
65
|
+
indexes: ['hit', 'event'],
|
|
66
|
+
timeframe: 30
|
|
67
|
+
};
|
|
68
|
+
const NOOP_ASYNC = async () => { };
|
|
69
|
+
export const CaseNavigationPreview = () => {
|
|
70
|
+
const { t } = useTranslation();
|
|
71
|
+
return (_jsxs(Stack, { sx: { width: 350 }, children: [_jsxs(Card, { sx: { borderRadius: 0, px: 2, py: 1 }, children: [_jsx(Typography, { variant: "body1", children: EXAMPLE_CASE.title }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", divider: _jsx(Circle, { color: "disabled", sx: { fontSize: '8px' } }), children: [_jsxs(Typography, { variant: "caption", color: "textSecondary", children: [t('started'), ": ", dayjs(EXAMPLE_CASE.created).toString()] }), _jsx(Chip, { color: ESCALATION_COLOR_MAP[EXAMPLE_CASE.escalation], label: t(EXAMPLE_CASE.escalation) })] })] }), _jsx(CaseSidebarNavigation, {})] }));
|
|
72
|
+
};
|
|
73
|
+
export const CaseInvestigationViewsPreview = () => (_jsx(Box, { sx: { width: 350 }, children: _jsx(CaseSidebarNavigation, { sections: ['search', 'observables', 'timeline'] }) }));
|
|
74
|
+
export const CaseControlsPreview = () => (_jsx(Box, { width: 350, children: _jsx(CaseSidebarActions, { onAddEvent: () => { }, onAddItem: () => { }, onAddFolder: () => { }, onRefresh: () => { }, onCollapseAll: () => { } }) }));
|
|
75
|
+
export const CaseDetailsPreview = () => {
|
|
76
|
+
const { t } = useTranslation();
|
|
77
|
+
const [status, setStatus] = useState('in-progress');
|
|
78
|
+
const [escalation, setEscalation] = useState('focus');
|
|
79
|
+
const { user } = useAppUser();
|
|
80
|
+
return (_jsx(Card, { sx: { p: 1, width: '300px' }, children: _jsxs(Stack, { spacing: 2, children: [_jsxs(Stack, { spacing: 1, children: [_jsx(CaseStatusControl, { value: status, options: ['open', 'in-progress', 'on-hold', 'resolved'], onChange: setStatus }), _jsx(CaseEscalationControl, { value: escalation, options: ['normal', 'focus', 'crisis'], onChange: setEscalation })] }), _jsx(Divider, {}), _jsxs(Stack, { spacing: 1, children: [_jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(People, {}), _jsx(Typography, { variant: "body1", children: t('page.cases.detail.participants') })] }), _jsx(UserList, { multiple: true, i18nLabel: "page.cases.detail.assignment", userIds: [user.username], onChange: () => { } })] })] }) }));
|
|
81
|
+
};
|
|
82
|
+
export const CaseDashboardPreview = () => _jsx(CaseOverview, { case: EXAMPLE_CASE, updateCase: NOOP_ASYNC });
|
|
83
|
+
export const CaseDashboardInsightsPreview = () => {
|
|
84
|
+
const { t } = useTranslation();
|
|
85
|
+
const theme = useTheme();
|
|
86
|
+
return (_jsxs(Grid, { container: true, spacing: 2, sx: { maxWidth: '100%' }, children: [_jsx(Grid, { size: { xs: 12, md: 6, xl: 3 }, children: _jsx(CaseAggregate, { icon: "material-symbols:warning-rounded", iconColor: theme.palette.warning.main, field: "howler.outline.threat", records: [EXAMPLE_AGGREGATE_HIT], subtitle: t('page.cases.dashboard.threat') }) }), _jsx(Grid, { size: { xs: 12, md: 6, xl: 3 }, children: _jsx(CaseAggregate, { icon: "material-symbols:group", iconColor: theme.palette.primary.main, field: "howler.outline.target", records: [EXAMPLE_AGGREGATE_HIT], subtitle: t('page.cases.dashboard.target') }) }), _jsx(Grid, { size: { xs: 12, md: 6, xl: 3 }, children: _jsx(CaseAggregate, { icon: "fluent:number-symbol-24-filled", field: "howler.outline.indicators", records: [EXAMPLE_AGGREGATE_HIT], subtitle: t('page.cases.dashboard.indicators') }) }), _jsx(Grid, { size: { xs: 12, md: 6, xl: 3 }, children: _jsx(CaseAggregate, { icon: "mingcute:heartbeat-line", iconColor: theme.palette.error.light, title: "01h 24m", subtitle: t('page.cases.dashboard.duration') }) })] }));
|
|
87
|
+
};
|
|
88
|
+
export const CaseFolderTreePreview = () => {
|
|
89
|
+
const folder = EXAMPLE_CASE.items?.[0];
|
|
90
|
+
const hit = EXAMPLE_CASE.items?.[1];
|
|
91
|
+
return (_jsxs(Paper, { variant: "outlined", sx: { py: 0.5, maxWidth: 350 }, children: [_jsx(FolderEntry, { label: "Investigation", indent: 0, entry: folder, chevronOpen: true }), _jsx(FolderEntry, { label: "VPN Monitor", indent: 1.5, entry: hit }), _jsx(FolderEntry, { label: "Analyst notes", indent: 1.5, entry: { id: 'notes', type: 'markdown', name: 'Analyst notes' } })] }));
|
|
92
|
+
};
|
|
93
|
+
export const AddRecordsPreview = () => {
|
|
94
|
+
const { t } = useTranslation();
|
|
95
|
+
const [selectedCase, setSelectedCase] = useState(EXAMPLE_CASE);
|
|
96
|
+
const [name, setName] = useState('VPN connection evidence');
|
|
97
|
+
const entry = { record: EXAMPLE_EVENT, name };
|
|
98
|
+
const caseOptions = [EXAMPLE_CASE, { ...EXAMPLE_CASE, case_id: 'example-case-2', title: 'Related investigation' }];
|
|
99
|
+
return (_jsx(Box, { display: "flex", children: _jsx(Card, { sx: { minWidth: '400px' }, children: _jsx(CardContent, { children: _jsxs(Stack, { spacing: 1, sx: { minWidth: 'min(800px, 60vw)' }, children: [_jsx(Typography, { variant: "h4", children: t('modal.cases.add_to_case') }), _jsx(CaseSelector, { options: caseOptions, value: selectedCase, onChange: setSelectedCase }), _jsx(CaseRecordRow, { entry: entry, onNameChange: setName, onParentChange: () => { } }), _jsxs(Stack, { direction: "row", spacing: 1, alignSelf: "end", children: [_jsx(Button, { variant: "outlined", color: "error", children: t('cancel') }), _jsx(Button, { variant: "outlined", color: "success", children: t('confirm') })] })] }) }) }) }));
|
|
100
|
+
};
|
|
101
|
+
export const CaseTasksPreview = () => {
|
|
102
|
+
const { t } = useTranslation();
|
|
103
|
+
return (_jsxs(Stack, { spacing: 1, sx: { maxWidth: '100%' }, children: [_jsx(Typography, { variant: "h4", children: t('page.cases.dashboard.tasks') }), _jsx(Divider, {}), _jsx(CaseTask, { case: EXAMPLE_CASE, task: EXAMPLE_CASE.tasks?.[0], onEdit: NOOP_ASYNC, onDelete: NOOP_ASYNC }), _jsxs(Stack, { onClick: () => { }, direction: "row", spacing: 2, sx: theme => ({
|
|
104
|
+
borderStyle: 'dashed',
|
|
105
|
+
borderColor: theme.palette.text.secondary,
|
|
106
|
+
borderWidth: '0.15rem',
|
|
107
|
+
borderRadius: '0.15rem',
|
|
108
|
+
opacity: 0.3,
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
padding: 1,
|
|
112
|
+
transition: theme.transitions.create('opacity'),
|
|
113
|
+
'&:hover': {
|
|
114
|
+
opacity: 1,
|
|
115
|
+
cursor: 'pointer'
|
|
116
|
+
}
|
|
117
|
+
}), children: [_jsx(Add, {}), _jsx(Typography, { children: t('page.cases.dashboard.tasks.add') })] })] }));
|
|
118
|
+
};
|
|
119
|
+
export const CorrelationRulePreview = () => {
|
|
120
|
+
const { t } = useTranslation();
|
|
121
|
+
return (_jsx(Card, { children: _jsx(TableContainer, { children: _jsxs(Table, { size: "small", children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: t('page.cases.rules.destination') }), _jsx(TableCell, { children: t('page.cases.rules.query') }), _jsx(TableCell, { children: t('hit.search.index') }), _jsx(TableCell, { children: t('page.cases.rules.timeframe') }), _jsx(TableCell, { children: t('page.cases.rules.author') }), _jsx(TableCell, { align: "center", children: t('enabled') }), _jsx(TableCell, { align: "right" })] }) }), _jsx(TableBody, { children: _jsx(CaseRuleRow, { rule: EXAMPLE_RULE, onToggleEnabled: () => { }, onBackfill: () => { }, onDelete: () => { } }) })] }) }) }));
|
|
122
|
+
};
|
|
123
|
+
export const CaseItemTypesPreview = () => {
|
|
124
|
+
const { t } = useTranslation();
|
|
125
|
+
const [itemType, setItemType] = useState(CASE_ITEM_TYPES[0]);
|
|
126
|
+
return (_jsxs(Stack, { direction: "row", spacing: 1, sx: { maxWidth: 600 }, children: [_jsx(CaseItemTypeSelect, { value: itemType, onChange: setItemType }), _jsx(TextField, { size: "small", label: t('modal.cases.add_item.title'), fullWidth: true })] }));
|
|
127
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "# Choose a query language\n\nThe **Query Type** control changes the editor language and endpoint used to search hits. Selecting a different language replaces the editor contents with an example suited to that syntax and clears the current response, so copy your query first if you need to keep it.\n\n`advanced_languages`\n\n## Lucene Query\n\nUse **Lucene Query** for the same field-oriented syntax used by Howler's regular hit search. It is the only query language that offers Default, Facet, Group By, and Explain execution modes. Multiline input is normalized before it is sent to the hit-search APIs.\n\n## EQL Query\n\nUse **EQL** (Event Query Language) for event-based sequences and time-series-style queries. EQL has its own syntax and response structure, so inspect the JSON result rather than expecting a regular hit list. Switching from Lucene to EQL or Sigma resets the Lucene-only execution mode to Default.\n\n## Sigma Rule\n\nUse **Sigma Rule** for a complete Sigma rule written in YAML. Howler submits the YAML as a Sigma search, including the rule metadata and detection section. Validate the rule with a small result count first, then refine its field selections or condition before expanding the query.\n"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "# Use Lucene execution modes\n\nWhen **Lucene Query** is selected, the **Query Method** control determines how Howler executes the query.\n\n`advanced_modes`\n\n## Default\n\n**Default** runs a normal hit search. Use it to inspect matching records, test filters, and then move a successful query into the Search page or a saved view.\n\n## Facet\n\n**Facet** counts values for the fields you select. It is useful for answering questions such as which analytics, sources, or statuses occur in a matching set. For array fields, each distinct value contributes once per matching hit.\n\nThe row-count slider limits the number of value buckets returned for each selected field, not the number of matching hits that contribute to the counts. The initial setting returns up to five buckets per field. If there are more distinct values than the selected limit, some values are omitted; an omitted value does not mean it is absent from the matching data.\n\n## Group By\n\n**Group By** groups matching results by one selected hit field. Select the group field before execution; Howler disables **Execute** until one is chosen. Use it to compare groups without manually sorting a large hit list.\n\nEach returned group includes its value, a matching-hit total, and one representative hit by default. The row-count slider increases the number of groups returned, not the number of hits shown within each group. The response's top-level `total` counts matching hits, not distinct groups.\n\n## Explain\n\n**Explain** uses Elasticsearch's Validate Query API to return query validity and its parsed representation of a Lucene query instead of matching records. Use it to debug query syntax and interpretation. It does not show Howler's complete search request or explain an individual hit's relevance score. The row limit and selected-field controls do not apply in Explain mode.\n\nA response has a structure such as:\n\n```json\n{\n \"valid\": true,\n \"explanations\": [\n {\n \"valid\": true,\n \"explanation\": \"ConstantScore(FieldExistsQuery [field=howler.id])\"\n }\n ]\n}\n```\n"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default "# Advanced Search overview\n\nAdvanced Search is a hit-query workbench for testing a query, inspecting its raw response, and choosing a query language or Lucene execution mode. Use it when the regular Search page is not enough for investigating field values, grouped data, EQL sequences, Sigma rules, or Elasticsearch's parsed representation of a Lucene query.\n\n`advanced_languages`\n\n## Run a query\n\nWrite or paste the query into the left editor, configure the controls above it, then select **Execute**. You can also use **Ctrl+Enter** on Windows and Linux or **Cmd+Enter** on macOS while the editor is focused.\n\nThe editor provides language-aware suggestions. Press **Ctrl+Space** if they do not appear automatically.\n\n`advanced_execute`\n\nThe response appears as JSON in the right panel. Errors are shown below the editor, so correct the syntax or query configuration before running it again. Drag the divider between the editor and result to give either side more space.\n\nThe built-in examples are starting points only. Replace them with a query that is appropriate for the classifications and retention policies of the data you are investigating.\n"
|