Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Guided onboarding] Added Guided onboarding to the Fleet plugin #142185

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export const securityConfig: GuideConfig = {
'Nullam ligula enim, malesuada a finibus vel, cursus sed risus.',
'Vivamus pretium, elit dictum lacinia aliquet, libero nibh dictum enim, a rhoncus leo magna in sapien.',
],
integration: 'endpoint',
location: {
appID: 'integrations',
path: '/browse/security',
},
},
{
id: 'rules',
Expand Down
31 changes: 31 additions & 0 deletions src/plugins/guided_onboarding/public/mocks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for adding this mock!

* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { BehaviorSubject } from 'rxjs';
import { GuidedOnboardingPluginStart } from '.';

const apiServiceMock: jest.Mocked<GuidedOnboardingPluginStart> = {
guidedOnboardingApi: {
setup: jest.fn(),
fetchActiveGuideState$: () => new BehaviorSubject(undefined),
fetchAllGuidesState: jest.fn(),
updateGuideState: jest.fn(),
activateGuide: jest.fn(),
completeGuide: jest.fn(),
isGuideStepActive$: () => new BehaviorSubject(false),
startGuideStep: jest.fn(),
completeGuideStep: jest.fn(),
isGuidedOnboardingActiveForIntegration$: () => new BehaviorSubject(false),
completeGuidedOnboardingForIntegration: jest.fn(),
},
};

export const guidedOnboardingMock = {
createSetup: () => {},
createStart: () => apiServiceMock,
};
97 changes: 97 additions & 0 deletions src/plugins/guided_onboarding/public/services/api.mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { GuideState } from '../../common/types';

export const searchAddDataActiveState: GuideState = {
guideId: 'search',
isActive: true,
status: 'in_progress',
steps: [
{
id: 'add_data',
status: 'active',
},
{
id: 'browse_docs',
status: 'inactive',
},
{
id: 'search_experience',
status: 'inactive',
},
],
};

export const searchAddDataInProgressState: GuideState = {
isActive: true,
status: 'in_progress',
steps: [
{
id: 'add_data',
status: 'in_progress',
},
{
id: 'browse_docs',
status: 'inactive',
},
{
id: 'search_experience',
status: 'inactive',
},
],
guideId: 'search',
};

export const securityAddDataInProgressState: GuideState = {
guideId: 'security',
status: 'in_progress',
isActive: true,
steps: [
{
id: 'add_data',
status: 'in_progress',
},
{
id: 'rules',
status: 'inactive',
},
],
};

export const securityRulesActivesState: GuideState = {
guideId: 'security',
isActive: true,
status: 'in_progress',
steps: [
{
id: 'add_data',
status: 'complete',
},
{
id: 'rules',
status: 'active',
},
],
};

export const noGuideActiveState: GuideState = {
guideId: 'security',
status: 'in_progress',
isActive: false,
steps: [
{
id: 'add_data',
status: 'in_progress',
},
{
id: 'rules',
status: 'inactive',
},
],
};
Loading