mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Fix save session UI appears in report (#115746)
This commit is contained in:
parent
c6fcde9a8b
commit
a7a1e5436b
6 changed files with 75 additions and 1 deletions
|
@ -8,7 +8,15 @@
|
|||
"githubTeam": "kibana-app-services"
|
||||
},
|
||||
"configPath": ["xpack", "data_enhanced"],
|
||||
"requiredPlugins": ["bfetch", "data", "features", "management", "share", "taskManager"],
|
||||
"requiredPlugins": [
|
||||
"bfetch",
|
||||
"data",
|
||||
"features",
|
||||
"management",
|
||||
"share",
|
||||
"taskManager",
|
||||
"screenshotMode"
|
||||
],
|
||||
"optionalPlugins": ["kibanaUtils", "usageCollection", "security"],
|
||||
"server": true,
|
||||
"ui": true,
|
||||
|
|
|
@ -22,6 +22,7 @@ import { toMountPoint } from '../../../../src/plugins/kibana_react/public';
|
|||
import { createConnectedSearchSessionIndicator } from './search';
|
||||
import { ConfigSchema } from '../config';
|
||||
import { Storage } from '../../../../src/plugins/kibana_utils/public';
|
||||
import { ScreenshotModePluginStart } from '../../../../src/plugins/screenshot_mode/public';
|
||||
|
||||
export interface DataEnhancedSetupDependencies {
|
||||
bfetch: BfetchPublicSetup;
|
||||
|
@ -31,6 +32,7 @@ export interface DataEnhancedSetupDependencies {
|
|||
export interface DataEnhancedStartDependencies {
|
||||
data: DataPublicPluginStart;
|
||||
share: SharePluginStart;
|
||||
screenshotMode: ScreenshotModePluginStart;
|
||||
}
|
||||
|
||||
export type DataEnhancedSetup = ReturnType<DataEnhancedPlugin['setup']>;
|
||||
|
@ -77,6 +79,7 @@ export class DataEnhancedPlugin
|
|||
.duration(this.config.search.sessions.notTouchedTimeout)
|
||||
.asMilliseconds(),
|
||||
usageCollector: this.usageCollector,
|
||||
tourDisabled: plugins.screenshotMode.isScreenshotMode(),
|
||||
})
|
||||
)
|
||||
),
|
||||
|
|
|
@ -39,6 +39,7 @@ timeFilter.getRefreshIntervalUpdate$.mockImplementation(() => refreshInterval$);
|
|||
timeFilter.getRefreshInterval.mockImplementation(() => refreshInterval$.getValue());
|
||||
|
||||
const disableSaveAfterSessionCompletesTimeout = 5 * 60 * 1000;
|
||||
const tourDisabled = false;
|
||||
|
||||
function Container({ children }: { children?: ReactNode }) {
|
||||
return <IntlProvider locale="en">{children}</IntlProvider>;
|
||||
|
@ -64,6 +65,7 @@ test("shouldn't show indicator in case no active search session", async () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const { getByTestId, container } = render(
|
||||
<Container>
|
||||
|
@ -92,6 +94,7 @@ test("shouldn't show indicator in case app hasn't opt-in", async () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const { getByTestId, container } = render(
|
||||
<Container>
|
||||
|
@ -122,6 +125,7 @@ test('should show indicator in case there is an active search session', async ()
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const { getByTestId } = render(
|
||||
<Container>
|
||||
|
@ -147,6 +151,7 @@ test('should be disabled in case uiConfig says so ', async () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
|
||||
render(
|
||||
|
@ -170,6 +175,7 @@ test('should be disabled in case not enough permissions', async () => {
|
|||
storage,
|
||||
disableSaveAfterSessionCompletesTimeout,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
|
||||
render(
|
||||
|
@ -203,6 +209,7 @@ describe('Completed inactivity', () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
|
||||
render(
|
||||
|
@ -264,6 +271,7 @@ describe('tour steps', () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const rendered = render(
|
||||
<Container>
|
||||
|
@ -305,6 +313,7 @@ describe('tour steps', () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const rendered = render(
|
||||
<Container>
|
||||
|
@ -329,6 +338,51 @@ describe('tour steps', () => {
|
|||
expect(usageCollector.trackSessionIndicatorTourLoading).toHaveBeenCalledTimes(0);
|
||||
expect(usageCollector.trackSessionIndicatorTourRestored).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
test("doesn't show tour step on slow loading when tour is disabled", async () => {
|
||||
const state$ = new BehaviorSubject(SearchSessionState.Loading);
|
||||
const SearchSessionIndicator = createConnectedSearchSessionIndicator({
|
||||
sessionService: { ...sessionService, state$ },
|
||||
application,
|
||||
storage,
|
||||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled: true,
|
||||
});
|
||||
const rendered = render(
|
||||
<Container>
|
||||
<SearchSessionIndicator />
|
||||
</Container>
|
||||
);
|
||||
|
||||
await waitFor(() => rendered.getByTestId('searchSessionIndicator'));
|
||||
|
||||
expect(() => screen.getByTestId('searchSessionIndicatorPopoverContainer')).toThrow();
|
||||
|
||||
act(() => {
|
||||
jest.advanceTimersByTime(10001);
|
||||
});
|
||||
|
||||
expect(
|
||||
screen.queryByTestId('searchSessionIndicatorPopoverContainer')
|
||||
).not.toBeInTheDocument();
|
||||
|
||||
act(() => {
|
||||
jest.advanceTimersByTime(5000);
|
||||
state$.next(SearchSessionState.Completed);
|
||||
});
|
||||
|
||||
expect(
|
||||
screen.queryByTestId('searchSessionIndicatorPopoverContainer')
|
||||
).not.toBeInTheDocument();
|
||||
|
||||
expect(storage.get(TOUR_RESTORE_STEP_KEY)).toBeFalsy();
|
||||
expect(storage.get(TOUR_TAKING_TOO_LONG_STEP_KEY)).toBeFalsy();
|
||||
|
||||
expect(usageCollector.trackSessionIndicatorTourLoading).toHaveBeenCalledTimes(0);
|
||||
expect(usageCollector.trackSessionIndicatorTourRestored).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
test('shows tour step for restored', async () => {
|
||||
|
@ -340,6 +394,7 @@ describe('tour steps', () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const rendered = render(
|
||||
<Container>
|
||||
|
@ -367,6 +422,7 @@ describe('tour steps', () => {
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
});
|
||||
const rendered = render(
|
||||
<Container>
|
||||
|
|
|
@ -31,6 +31,7 @@ export interface SearchSessionIndicatorDeps {
|
|||
* after the last search in the session has completed
|
||||
*/
|
||||
disableSaveAfterSessionCompletesTimeout: number;
|
||||
tourDisabled: boolean;
|
||||
usageCollector?: SearchUsageCollector;
|
||||
}
|
||||
|
||||
|
@ -41,6 +42,7 @@ export const createConnectedSearchSessionIndicator = ({
|
|||
disableSaveAfterSessionCompletesTimeout,
|
||||
usageCollector,
|
||||
basePath,
|
||||
tourDisabled,
|
||||
}: SearchSessionIndicatorDeps): React.FC => {
|
||||
const searchSessionsManagementUrl = basePath.prepend('/app/management/kibana/search_sessions');
|
||||
|
||||
|
@ -113,6 +115,7 @@ export const createConnectedSearchSessionIndicator = ({
|
|||
searchSessionIndicator,
|
||||
state,
|
||||
saveDisabled,
|
||||
tourDisabled,
|
||||
usageCollector
|
||||
);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ export function useSearchSessionTour(
|
|||
searchSessionIndicatorRef: SearchSessionIndicatorRef | null,
|
||||
state: SearchSessionState,
|
||||
searchSessionsDisabled: boolean,
|
||||
disableSearchSessionsTour: boolean,
|
||||
usageCollector?: SearchUsageCollector
|
||||
) {
|
||||
const markOpenedDone = useCallback(() => {
|
||||
|
@ -55,6 +56,7 @@ export function useSearchSessionTour(
|
|||
|
||||
useEffect(() => {
|
||||
if (searchSessionsDisabled) return;
|
||||
if (disableSearchSessionsTour) return;
|
||||
if (!searchSessionIndicatorRef) return;
|
||||
let timeoutHandle: number;
|
||||
|
||||
|
@ -82,6 +84,7 @@ export function useSearchSessionTour(
|
|||
searchSessionIndicatorRef,
|
||||
state,
|
||||
searchSessionsDisabled,
|
||||
disableSearchSessionsTour,
|
||||
markOpenedDone,
|
||||
markRestoredDone,
|
||||
usageCollector,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
{ "path": "../../../src/plugins/kibana_utils/tsconfig.json" },
|
||||
{ "path": "../../../src/plugins/usage_collection/tsconfig.json" },
|
||||
{ "path": "../../../src/plugins/management/tsconfig.json" },
|
||||
{ "path": "../../../src/plugins/screenshot_mode/tsconfig.json"},
|
||||
{ "path": "../security/tsconfig.json" },
|
||||
{ "path": "../task_manager/tsconfig.json" },
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue