mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-05 17:05:46 +01:00
Merge pull request #3012 from ccrvlh/feat/url-pattern
feat: allow for URL pattern matching on funnels
This commit is contained in:
commit
ffd27ab202
@ -31,7 +31,10 @@ const schema = {
|
|||||||
.of(
|
.of(
|
||||||
yup.object().shape({
|
yup.object().shape({
|
||||||
type: yup.string().required(),
|
type: yup.string().required(),
|
||||||
value: yup.string().required(),
|
value: yup
|
||||||
|
.string()
|
||||||
|
.matches(/^[a-zA-Z0-9/*-_]+$/, 'Invalid URL pattern')
|
||||||
|
.required(),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.min(2)
|
.min(2)
|
||||||
|
@ -70,9 +70,19 @@ async function relationalQuery(
|
|||||||
(pv, cv, i) => {
|
(pv, cv, i) => {
|
||||||
const levelNumber = i + 1;
|
const levelNumber = i + 1;
|
||||||
const startSum = i > 0 ? 'union ' : '';
|
const startSum = i > 0 ? 'union ' : '';
|
||||||
const operator = cv.type === 'url' && cv.value.endsWith('*') ? 'like' : '=';
|
const isURL = cv.type === 'url';
|
||||||
const column = cv.type === 'url' ? 'url_path' : 'event_name';
|
const column = isURL ? 'url_path' : 'event_name';
|
||||||
const paramValue = cv.value.endsWith('*') ? cv.value.replace('*', '%') : cv.value;
|
|
||||||
|
let operator = '=';
|
||||||
|
let paramValue = cv.value;
|
||||||
|
|
||||||
|
if (isURL && cv.value.includes('*')) {
|
||||||
|
operator = '~';
|
||||||
|
paramValue = cv.value.replace(/\*/g, '.*');
|
||||||
|
} else if (isURL && cv.value.endsWith('*')) {
|
||||||
|
operator = 'like';
|
||||||
|
paramValue = cv.value.replace('*', '%');
|
||||||
|
}
|
||||||
|
|
||||||
if (levelNumber === 1) {
|
if (levelNumber === 1) {
|
||||||
pv.levelOneQuery = `
|
pv.levelOneQuery = `
|
||||||
@ -167,9 +177,26 @@ async function clickhouseQuery(
|
|||||||
const levelNumber = i + 1;
|
const levelNumber = i + 1;
|
||||||
const startSum = i > 0 ? 'union all ' : '';
|
const startSum = i > 0 ? 'union all ' : '';
|
||||||
const startFilter = i > 0 ? 'or' : '';
|
const startFilter = i > 0 ? 'or' : '';
|
||||||
const operator = cv.type === 'url' && cv.value.endsWith('*') ? 'like' : '=';
|
|
||||||
const column = cv.type === 'url' ? 'url_path' : 'event_name';
|
const column = cv.type === 'url' ? 'url_path' : 'event_name';
|
||||||
const paramValue = cv.value.endsWith('*') ? cv.value.replace('*', '%') : cv.value;
|
|
||||||
|
let operator: string;
|
||||||
|
let paramValue: string;
|
||||||
|
|
||||||
|
if (cv.type === 'url') {
|
||||||
|
if (cv.value.includes('*')) {
|
||||||
|
operator = 'match';
|
||||||
|
paramValue = cv.value.replace(/\*/g, '.*');
|
||||||
|
} else if (cv.value.endsWith('*')) {
|
||||||
|
operator = 'like';
|
||||||
|
paramValue = cv.value.replace('*', '%');
|
||||||
|
} else {
|
||||||
|
operator = '=';
|
||||||
|
paramValue = cv.value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
operator = '=';
|
||||||
|
paramValue = cv.value;
|
||||||
|
}
|
||||||
|
|
||||||
if (levelNumber === 1) {
|
if (levelNumber === 1) {
|
||||||
pv.levelOneQuery = `\n
|
pv.levelOneQuery = `\n
|
||||||
|
Loading…
Reference in New Issue
Block a user