Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bb42f323
Commit
bb42f323
authored
Dec 01, 2021
by
anna_vovchenko
Committed by
Anna Vovchenko
Dec 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the tracking event to contain invalid character
parent
6b3867a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
app/assets/javascripts/ci_variable_list/components/ci_variable_modal.vue
...scripts/ci_variable_list/components/ci_variable_modal.vue
+16
-19
spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js
...end/ci_variable_list/components/ci_variable_modal_spec.js
+4
-3
No files found.
app/assets/javascripts/ci_variable_list/components/ci_variable_modal.vue
View file @
bb42f323
...
@@ -60,10 +60,7 @@ export default {
...
@@ -60,10 +60,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
isTipDismissed
:
Cookies
.
get
(
AWS_TIP_DISMISSED_COOKIE_NAME
)
===
'
true
'
,
isTipDismissed
:
Cookies
.
get
(
AWS_TIP_DISMISSED_COOKIE_NAME
)
===
'
true
'
,
isValidationErrorEventSent
:
{
validationErrorEventProperty
:
''
,
displaysMaskedError
:
false
,
displaysVariableReferenceError
:
false
,
},
};
};
},
},
computed
:
{
computed
:
{
...
@@ -162,7 +159,6 @@ export default {
...
@@ -162,7 +159,6 @@ export default {
this
.
trackVariableValidationErrors
();
this
.
trackVariableValidationErrors
();
},
},
deep
:
true
,
deep
:
true
,
immediate
:
true
,
},
},
},
},
methods
:
{
methods
:
{
...
@@ -213,23 +209,24 @@ export default {
...
@@ -213,23 +209,24 @@ export default {
}
}
},
},
trackVariableValidationErrors
()
{
trackVariableValidationErrors
()
{
if
(
this
.
displayMaskedError
&&
!
this
.
isValidationErrorEventSent
.
displaysMaskedError
)
{
if
(
this
.
variable
.
secret_value
?.
length
&&
!
this
.
validationErrorEventProperty
)
{
this
.
track
(
EVENT_ACTION
,
{
property
:
'
displaysMaskedError
'
});
if
(
this
.
displayMaskedError
&&
this
.
maskableRegex
?.
length
)
{
this
.
isValidationErrorEventSent
.
displaysMaskedError
=
true
;
const
supportedChars
=
this
.
maskableRegex
.
replace
(
'
^
'
,
''
).
replace
(
/{
(\d
,
)
}
\$
/
,
''
);
const
regex
=
new
RegExp
(
supportedChars
,
'
g
'
);
const
error
=
this
.
variable
.
secret_value
.
replace
(
regex
,
''
);
this
.
track
(
EVENT_ACTION
,
{
property
:
error
});
this
.
validationErrorEventProperty
=
error
;
}
if
(
this
.
containsVariableReference
)
{
this
.
track
(
EVENT_ACTION
,
{
property
:
'
$
'
});
this
.
validationErrorEventProperty
=
'
$
'
;
}
}
if
(
this
.
containsVariableReference
&&
!
this
.
isValidationErrorEventSent
.
displaysVariableReferenceError
)
{
this
.
track
(
EVENT_ACTION
,
{
property
:
'
displaysVariableReferenceError
'
});
this
.
isValidationErrorEventSent
.
displaysVariableReferenceError
=
true
;
}
}
},
},
resetValidationErrorEvents
()
{
resetValidationErrorEvents
()
{
this
.
isValidationErrorEventSent
=
{
this
.
validationErrorEventProperty
=
''
;
displaysMaskedError
:
false
,
displaysVariableReferenceError
:
false
,
};
},
},
},
},
};
};
...
...
spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js
View file @
bb42f323
...
@@ -17,8 +17,10 @@ describe('Ci variable modal', () => {
...
@@ -17,8 +17,10 @@ describe('Ci variable modal', () => {
let
store
;
let
store
;
let
trackingSpy
;
let
trackingSpy
;
const
maskableRegex
=
'
^[a-zA-Z0-9_+=/@:.~-]{8,}$
'
;
const
createComponent
=
(
method
,
options
=
{})
=>
{
const
createComponent
=
(
method
,
options
=
{})
=>
{
store
=
createStore
({
isGroup
:
options
.
isGroup
});
store
=
createStore
({
maskableRegex
,
isGroup
:
options
.
isGroup
});
wrapper
=
method
(
CiVariableModal
,
{
wrapper
=
method
(
CiVariableModal
,
{
attachTo
:
document
.
body
,
attachTo
:
document
.
body
,
stubs
:
{
stubs
:
{
...
@@ -247,7 +249,7 @@ describe('Ci variable modal', () => {
...
@@ -247,7 +249,7 @@ describe('Ci variable modal', () => {
it
(
'
sends the correct tracking event
'
,
()
=>
{
it
(
'
sends the correct tracking event
'
,
()
=>
{
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
EVENT_ACTION
,
{
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
undefined
,
EVENT_ACTION
,
{
label
:
EVENT_LABEL
,
label
:
EVENT_LABEL
,
property
:
'
displaysMaskedError
'
,
property
:
'
;
'
,
});
});
});
});
});
});
...
@@ -264,7 +266,6 @@ describe('Ci variable modal', () => {
...
@@ -264,7 +266,6 @@ describe('Ci variable modal', () => {
};
};
createComponent
(
mount
);
createComponent
(
mount
);
store
.
state
.
variable
=
validMaskandKeyVariable
;
store
.
state
.
variable
=
validMaskandKeyVariable
;
store
.
state
.
maskableRegex
=
/^
[
a-zA-Z0-9_+=
/
@:.~-
]{8,}
$/
;
});
});
it
(
'
does not disable the submit button
'
,
()
=>
{
it
(
'
does not disable the submit button
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment