[Guided onboarding] Add guide config route (#146149)

## Summary
Fixes https://github.com/elastic/kibana/issues/145871
Fixes https://github.com/elastic/kibana/issues/145875
This PR adds an internal API endpoint that returns all existing config
guides. The client side code (api service) is updated to use the
endpoint instead of a guide configs file.

Note: This PR deletes the docs link for the kube-state-metrics from the
"Add data" step in the Kubernetes guide. I opened
https://github.com/elastic/kibana/issues/146404 to follow up on this.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Yulia Čech 2022-12-01 09:44:20 +01:00 committed by GitHub
parent 9e6f24a331
commit e7da574c5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 723 additions and 206 deletions

View file

@ -27,7 +27,6 @@ import {
} from '@elastic/eui';
import type { GuideState, GuideStepIds, GuideId, GuideStep } from '@kbn/guided-onboarding';
import type { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import { guidesConfig } from '@kbn/guided-onboarding-plugin/public';
interface MainProps {
guidedOnboarding: GuidedOnboardingPluginStart;
@ -75,7 +74,15 @@ export const Main = (props: MainProps) => {
};
const updateGuideState = async () => {
const selectedGuideConfig = guidesConfig[selectedGuide!];
if (!selectedGuide) {
return;
}
const selectedGuideConfig = await guidedOnboardingApi?.getGuideConfig(selectedGuide);
if (!selectedGuideConfig) {
return;
}
const selectedStepIndex = selectedGuideConfig.steps.findIndex(
(step) => step.id === selectedStep!
);
@ -199,7 +206,7 @@ export const Main = (props: MainProps) => {
</EuiText>
<EuiSpacer />
<EuiFlexGroup>
{(Object.keys(guidesConfig) as GuideId[]).map((guideId) => {
{(['search', 'security', 'observability', 'testGuide'] as GuideId[]).map((guideId) => {
const guideState = guidesState?.find((guide) => guide.guideId === guideId);
return (
<EuiFlexItem>