mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.8`: - [[Guided onboarding] Fix Kibana crashing on Safari (#158825)](https://github.com/elastic/kibana/pull/158825) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Yulia Čech","email":"6585477+yuliacech@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-06-02T16:50:27Z","message":"[Guided onboarding] Fix Kibana crashing on Safari (#158825)","sha":"e2e03cac3b52fc590a93c3abb346d71af0b5eb6d","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","backport:prev-minor","Team:Journey/Onboarding","v8.9.0","v8.8.1"],"number":158825,"url":"https://github.com/elastic/kibana/pull/158825","mergeCommit":{"message":"[Guided onboarding] Fix Kibana crashing on Safari (#158825)","sha":"e2e03cac3b52fc590a93c3abb346d71af0b5eb6d"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/158825","number":158825,"mergeCommit":{"message":"[Guided onboarding] Fix Kibana crashing on Safari (#158825)","sha":"e2e03cac3b52fc590a93c3abb346d71af0b5eb6d"}},{"branch":"8.8","label":"v8.8.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com>
This commit is contained in:
parent
cb3763e935
commit
17559fa778
1 changed files with 10 additions and 4 deletions
|
@ -9,15 +9,21 @@
|
|||
import { PluginState } from '../../common';
|
||||
|
||||
// regex matches everything between an opening and a closing curly braces
|
||||
// without matching the braces themselves
|
||||
const paramsBetweenCurlyBraces = /(?<=\{)[^\{\}]+(?=\})/g;
|
||||
// and the braces themselves
|
||||
const paramsWithBraces = /\{(.*?)\}/g;
|
||||
// regex matches both curly braces
|
||||
const curlyBraces = /[\{\}]/g;
|
||||
export const getStepLocationPath = (path: string, pluginState: PluginState): string | undefined => {
|
||||
if (pluginState.activeGuide?.params) {
|
||||
let dynamicPath = path;
|
||||
const matchedParams = path.match(paramsBetweenCurlyBraces);
|
||||
const matchedParams = path.match(paramsWithBraces);
|
||||
if (matchedParams) {
|
||||
for (const param of matchedParams) {
|
||||
dynamicPath = dynamicPath.replace(`{${param}}`, pluginState.activeGuide?.params[param]);
|
||||
const paramWithoutBraces = param.replace(curlyBraces, '');
|
||||
dynamicPath = dynamicPath.replace(
|
||||
`${param}`,
|
||||
pluginState.activeGuide?.params[paramWithoutBraces]
|
||||
);
|
||||
}
|
||||
return dynamicPath;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue