Move DurationInput to @probo/ui and scope pattern merge by category
Move the DurationInput component from the console app into @probo/ui for reuse, add duration formatting helpers to @probo/helpers, and update pattern merge to group by both category ID and prefix. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -120,6 +120,10 @@ func (h *patternAnalysisHandler) Process(ctx context.Context, task coredata.Cook
|
||||
if err := prefixPattern.LoadByBannerIDAndPattern(ctx, tx, scope, task.BannerID, key.prefix); err != nil {
|
||||
return fmt.Errorf("cannot load existing prefix pattern %q: %w", key.prefix, err)
|
||||
}
|
||||
|
||||
if prefixPattern.CookieCategoryID != key.categoryID || prefixPattern.MatchType != coredata.CookiePatternMatchTypePrefix {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
for _, exactPattern := range group {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
"go.probo.inc/probo/pkg/gid"
|
||||
)
|
||||
|
||||
func TestSeparatorPrefixes(t *testing.T) {
|
||||
@@ -108,7 +109,7 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 1)
|
||||
|
||||
group, ok := groups["ph_phc_"]
|
||||
group, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "ph_phc_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, group, 3)
|
||||
},
|
||||
@@ -128,7 +129,7 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 1)
|
||||
|
||||
group, ok := groups["_ga_"]
|
||||
group, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "_ga_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, group, 3)
|
||||
},
|
||||
@@ -148,7 +149,7 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 1)
|
||||
|
||||
group, ok := groups["auth0_session_"]
|
||||
group, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "auth0_session_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, group, 3)
|
||||
},
|
||||
@@ -186,11 +187,11 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 2)
|
||||
|
||||
barGroup, ok := groups["foo_bar_"]
|
||||
barGroup, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "foo_bar_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, barGroup, 3)
|
||||
|
||||
bazGroup, ok := groups["foo_baz_"]
|
||||
bazGroup, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "foo_baz_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, bazGroup, 3)
|
||||
},
|
||||
@@ -211,7 +212,7 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 1)
|
||||
|
||||
group, ok := groups["ph_phc_"]
|
||||
group, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "ph_phc_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, group, 3)
|
||||
},
|
||||
@@ -235,7 +236,7 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 1)
|
||||
|
||||
group := groups["ph_phc_"]
|
||||
group := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "ph_phc_"}]
|
||||
assert.Len(t, group, 3)
|
||||
},
|
||||
)
|
||||
@@ -257,11 +258,11 @@ func TestFindMergeGroups(t *testing.T) {
|
||||
groups := findMergeGroups(patterns, 3)
|
||||
require.Len(t, groups, 2)
|
||||
|
||||
phcGroup, ok := groups["ph_phc_"]
|
||||
phcGroup, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "ph_phc_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, phcGroup, 3)
|
||||
|
||||
sessionGroup, ok := groups["ph_session_"]
|
||||
sessionGroup, ok := groups[mergeGroupKey{categoryID: gid.Nil, prefix: "ph_session_"}]
|
||||
require.True(t, ok)
|
||||
assert.Len(t, sessionGroup, 3)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user