Skip to content

Commit

Permalink
[8.x] [Fleet] added tour component, removed search (#203741) (#203994)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] added tour component, removed search
(#203741)](#203741)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-12T10:39:32Z","message":"[Fleet]
added tour component, removed search (#203741)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/ingest-dev/issues/4324\r\n\r\n- Added tour
component for Export CSV feature, it goes away on`Close\r\ntour`\r\n-
Removed search in column selection\r\n- Tried a few ways to fix the
search not to remove the existing\r\nselection (see in
#203103), but\r\ndoesn't seem
possible with EuiTable. Removed for now as there aren't\r\nthat many
columns, and don't want to leave it in as is.\r\n\r\n<img width=\"1772\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/464f8247-bc2d-45d5-8fd4-96d790a40833\">\r\n
\r\n<img width=\"860\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/5d3058f0-2e52-4248-af34-0dfa1c149417\">","sha":"96573a40c1d9b2429dafd1f88abda3a9a9c0171a","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor"],"title":"[Fleet]
added tour component, removed
search","number":203741,"url":"https://github.com/elastic/kibana/pull/203741","mergeCommit":{"message":"[Fleet]
added tour component, removed search (#203741)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/ingest-dev/issues/4324\r\n\r\n- Added tour
component for Export CSV feature, it goes away on`Close\r\ntour`\r\n-
Removed search in column selection\r\n- Tried a few ways to fix the
search not to remove the existing\r\nselection (see in
#203103), but\r\ndoesn't seem
possible with EuiTable. Removed for now as there aren't\r\nthat many
columns, and don't want to leave it in as is.\r\n\r\n<img width=\"1772\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/464f8247-bc2d-45d5-8fd4-96d790a40833\">\r\n
\r\n<img width=\"860\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/5d3058f0-2e52-4248-af34-0dfa1c149417\">","sha":"96573a40c1d9b2429dafd1f88abda3a9a9c0171a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203741","number":203741,"mergeCommit":{"message":"[Fleet]
added tour component, removed search (#203741)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/ingest-dev/issues/4324\r\n\r\n- Added tour
component for Export CSV feature, it goes away on`Close\r\ntour`\r\n-
Removed search in column selection\r\n- Tried a few ways to fix the
search not to remove the existing\r\nselection (see in
#203103), but\r\ndoesn't seem
possible with EuiTable. Removed for now as there aren't\r\nthat many
columns, and don't want to leave it in as is.\r\n\r\n<img width=\"1772\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/464f8247-bc2d-45d5-8fd4-96d790a40833\">\r\n
\r\n<img width=\"860\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/5d3058f0-2e52-4248-af34-0dfa1c149417\">","sha":"96573a40c1d9b2429dafd1f88abda3a9a9c0171a"}}]}]
BACKPORT-->

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
  • Loading branch information
kibanamachine and juliaElastic authored Dec 12, 2024
1 parent 3cd88c8 commit 3b2de11
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { EuiText, EuiTourStep } from '@elastic/eui';
import React, { useState } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';

import type { TOUR_STORAGE_CONFIG } from '../../../../constants';
import { TOUR_STORAGE_KEYS } from '../../../../constants';
import { useStartServices } from '../../../../hooks';

export const AgentExportCSVTour: React.FC<{}> = () => {
const { storage, uiSettings } = useStartServices();

const [tourState, setTourState] = useState({ isOpen: true });

const isTourHidden =
uiSettings.get('hideAnnouncements', false) ||
(
storage.get(TOUR_STORAGE_KEYS.AGENT_EXPORT_CSV) as
| TOUR_STORAGE_CONFIG['AGENT_EXPORT_CSV']
| undefined
)?.active === false;

const setTourAsHidden = () => {
storage.set(TOUR_STORAGE_KEYS.AGENT_EXPORT_CSV, {
active: false,
} as TOUR_STORAGE_CONFIG['AGENT_EXPORT_CSV']);
};

const onFinish = () => {
setTourState({ isOpen: false });
setTourAsHidden();
};

return (
<>
<EuiTourStep
content={
<EuiText>
<FormattedMessage
id="xpack.fleet.agentExportCSVTour.tourContent"
defaultMessage="Once you have selected the agents, click the action menu to download the CSV file."
/>
</EuiText>
}
isStepOpen={!isTourHidden && tourState.isOpen}
onFinish={onFinish}
minWidth={360}
maxWidth={360}
step={1}
stepsTotal={1}
title={
<FormattedMessage
id="xpack.fleet.agentExportCSVTour.tourTitle"
defaultMessage="Download CSV file"
/>
}
anchorPosition="upLeft"
anchor="#agentListSelectionText"
/>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { SO_SEARCH_LIMIT } from '../../../../constants';
import type { Agent } from '../../../../types';

import type { SelectionMode } from './types';
import { AgentExportCSVTour } from './agent_export_csv_tour';

const Divider = styled.div`
width: 0;
Expand Down Expand Up @@ -62,7 +63,7 @@ export const AgentsSelectionStatus: React.FunctionComponent<{
<>
<EuiFlexGroup gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiText size="xs" color="subdued">
<EuiText size="xs" color="subdued" id="agentListSelectionText">
{totalAgents > SO_SEARCH_LIMIT ? (
<FormattedMessage
id="xpack.fleet.agentBulkActions.totalAgentsWithLimit"
Expand Down Expand Up @@ -97,6 +98,7 @@ export const AgentsSelectionStatus: React.FunctionComponent<{
</>
)}
</EuiText>
<AgentExportCSVTour />
</EuiFlexItem>
{showSelectionInfoAndOptions ? (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ jest.mock('../../../hooks', () => ({
cloud: {},
data: { dataViews: { getFieldsForWildcard: jest.fn() } },
docLinks: { links: { kibana: { secureSavedObject: 'my-link' } } },
uiSettings: {
get: jest.fn(),
},
storage: {
get: jest.fn(),
},
}),
useBreadcrumbs: jest.fn(),
useLink: jest.fn().mockReturnValue({ getHref: jest.fn() }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React, { useState } from 'react';
import type { EuiBasicTableColumn, EuiSearchBarProps, EuiTableSelectionType } from '@elastic/eui';
import type { EuiBasicTableColumn, EuiTableSelectionType } from '@elastic/eui';
import {
EuiConfirmModal,
EuiFlexGroup,
Expand Down Expand Up @@ -67,12 +67,6 @@ export const AgentExportCSVModal: React.FunctionComponent<Props> = ({
initialSelected: INITIAL_AGENT_FIELDS_TO_EXPORT,
};

const search: EuiSearchBarProps = {
box: {
incremental: true,
},
};

return (
<EuiConfirmModal
data-test-subj="agentExportCSVModal"
Expand Down Expand Up @@ -129,7 +123,6 @@ export const AgentExportCSVModal: React.FunctionComponent<Props> = ({
items={items}
itemId="field"
columns={columns}
search={search}
selection={selectionValue}
/>
</EuiFlexItem>
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/public/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const TOUR_STORAGE_KEYS = {
ADD_AGENT_POPOVER: 'fleet.addAgentPopoverTour',
INACTIVE_AGENTS: 'fleet.inactiveAgentsTour',
GRANULAR_PRIVILEGES: 'fleet.granularPrivileges',
AGENT_EXPORT_CSV: 'fleet.agentExportCSVTour',
};

export interface TourConfig {
Expand Down

0 comments on commit 3b2de11

Please sign in to comment.