mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
[Guided onboarding] Add guided onboarding to the home page
This commit is contained in:
parent
ffc8fb90fd
commit
b36e80bbfa
6 changed files with 53 additions and 4 deletions
|
@ -30,6 +30,7 @@ exports[`home change home route should render a link to change the default route
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
@ -84,6 +85,7 @@ exports[`home directories should not render directory entry when showOnHomePage
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
@ -138,6 +140,7 @@ exports[`home directories should render ADMIN directory entry in "Manage your da
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
@ -239,6 +242,7 @@ exports[`home directories should render solutions in the "solution section" 1`]
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
@ -293,6 +297,7 @@ exports[`home isNewKibanaInstance should safely handle exceptions 1`] = `
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
@ -347,6 +352,7 @@ exports[`home isNewKibanaInstance should set isNewKibanaInstance to false when t
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
@ -408,6 +414,7 @@ exports[`home should render home component 1`] = `
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCloudEnabled={false}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
/>
|
/>
|
||||||
<ManageData
|
<ManageData
|
||||||
|
|
|
@ -40,6 +40,7 @@ describe('AddData', () => {
|
||||||
addBasePath={addBasePathMock}
|
addBasePath={addBasePathMock}
|
||||||
application={applicationStartMock}
|
application={applicationStartMock}
|
||||||
isDarkMode={false}
|
isDarkMode={false}
|
||||||
|
isCloudEnabled={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
expect(component).toMatchSnapshot();
|
expect(component).toMatchSnapshot();
|
||||||
|
|
|
@ -29,9 +29,10 @@ interface Props {
|
||||||
addBasePath: (path: string) => string;
|
addBasePath: (path: string) => string;
|
||||||
application: ApplicationStart;
|
application: ApplicationStart;
|
||||||
isDarkMode: boolean;
|
isDarkMode: boolean;
|
||||||
|
isCloudEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AddData: FC<Props> = ({ addBasePath, application, isDarkMode }) => {
|
export const AddData: FC<Props> = ({ addBasePath, application, isDarkMode, isCloudEnabled }) => {
|
||||||
const { trackUiMetric } = getServices();
|
const { trackUiMetric } = getServices();
|
||||||
const canAccessIntegrations = application.capabilities.navLinks.integrations;
|
const canAccessIntegrations = application.capabilities.navLinks.integrations;
|
||||||
if (canAccessIntegrations) {
|
if (canAccessIntegrations) {
|
||||||
|
@ -67,12 +68,30 @@ export const AddData: FC<Props> = ({ addBasePath, application, isDarkMode }) =>
|
||||||
<EuiSpacer />
|
<EuiSpacer />
|
||||||
|
|
||||||
<EuiFlexGroup gutterSize="m" responsive={false} wrap>
|
<EuiFlexGroup gutterSize="m" responsive={false} wrap>
|
||||||
|
{isCloudEnabled && (
|
||||||
|
<EuiFlexItem grow={false}>
|
||||||
|
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
|
||||||
|
<EuiButton
|
||||||
|
data-test-subj="guidedOnboardingLink"
|
||||||
|
fill
|
||||||
|
href={addBasePath('#/getting_started')}
|
||||||
|
onClick={(event: MouseEvent) => {
|
||||||
|
trackUiMetric(METRIC_TYPE.CLICK, 'guided_onboarding_link');
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FormattedMessage
|
||||||
|
id="home.addData.guidedOnboardingLinkLabel"
|
||||||
|
defaultMessage="Launch Guided setup"
|
||||||
|
/>
|
||||||
|
</EuiButton>
|
||||||
|
</EuiFlexItem>
|
||||||
|
)}
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
<RedirectAppLinks application={application}>
|
<RedirectAppLinks application={application}>
|
||||||
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
|
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
|
||||||
<EuiButton
|
<EuiButton
|
||||||
data-test-subj="homeAddData"
|
data-test-subj="homeAddData"
|
||||||
fill
|
fill={!isCloudEnabled}
|
||||||
href={addBasePath('/app/integrations/browse')}
|
href={addBasePath('/app/integrations/browse')}
|
||||||
iconType="plusInCircle"
|
iconType="plusInCircle"
|
||||||
onClick={(event: MouseEvent) => {
|
onClick={(event: MouseEvent) => {
|
||||||
|
|
|
@ -59,6 +59,7 @@ describe('home', () => {
|
||||||
return `base_path/${url}`;
|
return `base_path/${url}`;
|
||||||
},
|
},
|
||||||
hasUserDataView: jest.fn(async () => true),
|
hasUserDataView: jest.fn(async () => true),
|
||||||
|
isCloudEnabled: false,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -230,6 +231,14 @@ describe('home', () => {
|
||||||
|
|
||||||
expect(component.find(Welcome).exists()).toBe(false);
|
expect(component.find(Welcome).exists()).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should redirect to guided onboarding on Cloud instead of welcome screen', async () => {
|
||||||
|
defaultProps.isCloudEnabled = true;
|
||||||
|
|
||||||
|
const component = await renderHome();
|
||||||
|
|
||||||
|
expect(component.find(Welcome).exists()).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isNewKibanaInstance', () => {
|
describe('isNewKibanaInstance', () => {
|
||||||
|
|
|
@ -33,6 +33,7 @@ export interface HomeProps {
|
||||||
localStorage: Storage;
|
localStorage: Storage;
|
||||||
urlBasePath: string;
|
urlBasePath: string;
|
||||||
hasUserDataView: () => Promise<boolean>;
|
hasUserDataView: () => Promise<boolean>;
|
||||||
|
isCloudEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
@ -126,7 +127,7 @@ export class Home extends Component<HomeProps, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderNormal() {
|
private renderNormal() {
|
||||||
const { addBasePath, solutions } = this.props;
|
const { addBasePath, solutions, isCloudEnabled } = this.props;
|
||||||
const { application, trackUiMetric } = getServices();
|
const { application, trackUiMetric } = getServices();
|
||||||
const isDarkMode = getServices().uiSettings?.get('theme:darkMode') || false;
|
const isDarkMode = getServices().uiSettings?.get('theme:darkMode') || false;
|
||||||
const devTools = this.findDirectoryById('console');
|
const devTools = this.findDirectoryById('console');
|
||||||
|
@ -148,7 +149,12 @@ export class Home extends Component<HomeProps, State> {
|
||||||
>
|
>
|
||||||
<SolutionsSection addBasePath={addBasePath} solutions={solutions} />
|
<SolutionsSection addBasePath={addBasePath} solutions={solutions} />
|
||||||
|
|
||||||
<AddData addBasePath={addBasePath} application={application} isDarkMode={isDarkMode} />
|
<AddData
|
||||||
|
addBasePath={addBasePath}
|
||||||
|
application={application}
|
||||||
|
isDarkMode={isDarkMode}
|
||||||
|
isCloudEnabled={isCloudEnabled}
|
||||||
|
/>
|
||||||
|
|
||||||
<ManageData
|
<ManageData
|
||||||
addBasePath={addBasePath}
|
addBasePath={addBasePath}
|
||||||
|
@ -182,12 +188,18 @@ export class Home extends Component<HomeProps, State> {
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const { isLoading, isWelcomeEnabled, isNewKibanaInstance } = this.state;
|
const { isLoading, isWelcomeEnabled, isNewKibanaInstance } = this.state;
|
||||||
|
const { isCloudEnabled } = this.props;
|
||||||
|
const { application } = getServices();
|
||||||
|
|
||||||
if (isWelcomeEnabled) {
|
if (isWelcomeEnabled) {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return this.renderLoading();
|
return this.renderLoading();
|
||||||
}
|
}
|
||||||
if (isNewKibanaInstance) {
|
if (isNewKibanaInstance) {
|
||||||
|
if (isCloudEnabled) {
|
||||||
|
application.navigateToUrl('./home#/getting_started');
|
||||||
|
return;
|
||||||
|
}
|
||||||
return this.renderWelcome();
|
return this.renderWelcome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ export function HomeApp({ directories, solutions }) {
|
||||||
localStorage={localStorage}
|
localStorage={localStorage}
|
||||||
urlBasePath={getBasePath()}
|
urlBasePath={getBasePath()}
|
||||||
hasUserDataView={() => dataViewsService.hasUserDataView()}
|
hasUserDataView={() => dataViewsService.hasUserDataView()}
|
||||||
|
isCloudEnabled={isCloudEnabled}
|
||||||
/>
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
<Redirect to="/" />
|
<Redirect to="/" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue