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
61bcc936
Commit
61bcc936
authored
May 26, 2020
by
Jose Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create constants for the tracking labels
parent
b4db572c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
13 deletions
+25
-13
app/assets/javascripts/logs/constants.js
app/assets/javascripts/logs/constants.js
+7
-0
app/assets/javascripts/logs/logs_tracking_helper.js
app/assets/javascripts/logs/logs_tracking_helper.js
+10
-2
app/assets/javascripts/logs/stores/actions.js
app/assets/javascripts/logs/stores/actions.js
+8
-11
No files found.
app/assets/javascripts/logs/constants.js
View file @
61bcc936
export
const
dateFormatMask
=
'
mmm dd HH:MM:ss.l
'
;
export
const
TOKEN_TYPE_POD_NAME
=
'
TOKEN_TYPE_POD_NAME
'
;
export
const
tracking
=
{
USED_SEARCH_BAR
:
'
used_search_bar
'
,
POD_LOG_CHANGED
:
'
pod_log_changed
'
,
TIME_RANGE_SET
:
'
time_range_set
'
,
ENVIRONMENT_SELECTED
:
'
environment_selected
'
,
};
app/assets/javascripts/logs/logs_tracking_helper.js
View file @
61bcc936
import
Tracking
from
'
~/tracking
'
;
const
trackLogs
=
({
label
,
value
})
=>
/**
* The value of 1 in count, means there was one action performed
* related to the tracked action, in either of the following categories
* 1. Refreshing the logs
* 2. Select an environment
* 3. Change the time range
* 4. Use the search bar
*/
const
trackLogs
=
label
=>
Tracking
.
event
(
document
.
body
.
dataset
.
page
,
'
logs_view
'
,
{
label
,
property
:
'
count
'
,
value
,
value
:
1
,
});
export
default
trackLogs
;
app/assets/javascripts/logs/stores/actions.js
View file @
61bcc936
...
...
@@ -2,7 +2,7 @@ import { backOff } from '~/lib/utils/common_utils';
import
httpStatusCodes
from
'
~/lib/utils/http_status
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
convertToFixedRange
}
from
'
~/lib/utils/datetime_range
'
;
import
{
TOKEN_TYPE_POD_NAME
}
from
'
../constants
'
;
import
{
TOKEN_TYPE_POD_NAME
,
tracking
}
from
'
../constants
'
;
import
trackLogs
from
'
../logs_tracking_helper
'
;
import
*
as
types
from
'
./mutation_types
'
;
...
...
@@ -82,22 +82,22 @@ export const showFilteredLogs = ({ dispatch, commit }, filters = []) => {
commit
(
types
.
SET_CURRENT_POD_NAME
,
podName
);
commit
(
types
.
SET_SEARCH
,
search
);
dispatch
(
'
fetchLogs
'
,
'
used_search_bar
'
);
dispatch
(
'
fetchLogs
'
,
tracking
.
USED_SEARCH_BAR
);
};
export
const
showPodLogs
=
({
dispatch
,
commit
},
podName
)
=>
{
commit
(
types
.
SET_CURRENT_POD_NAME
,
podName
);
dispatch
(
'
fetchLogs
'
,
'
pod_log_changed
'
);
dispatch
(
'
fetchLogs
'
,
tracking
.
POD_LOG_CHANGED
);
};
export
const
setTimeRange
=
({
dispatch
,
commit
},
timeRange
)
=>
{
commit
(
types
.
SET_TIME_RANGE
,
timeRange
);
dispatch
(
'
fetchLogs
'
,
'
time_range_set
'
);
dispatch
(
'
fetchLogs
'
,
tracking
.
TIME_RANGE_SET
);
};
export
const
showEnvironment
=
({
dispatch
,
commit
},
environmentName
)
=>
{
commit
(
types
.
SET_PROJECT_ENVIRONMENT
,
environmentName
);
dispatch
(
'
fetchLogs
'
,
'
enviroment_selected
'
);
dispatch
(
'
fetchLogs
'
,
tracking
.
ENVIRONMENT_SELECTED
);
};
/**
...
...
@@ -112,24 +112,21 @@ export const fetchEnvironments = ({ commit, dispatch }, environmentsPath) => {
.
get
(
environmentsPath
)
.
then
(({
data
})
=>
{
commit
(
types
.
RECEIVE_ENVIRONMENTS_DATA_SUCCESS
,
data
.
environments
);
dispatch
(
'
fetchLogs
'
,
'
environment_selected
'
);
dispatch
(
'
fetchLogs
'
,
tracking
.
ENVIRONMENT_SELECTED
);
})
.
catch
(()
=>
{
commit
(
types
.
RECEIVE_ENVIRONMENTS_DATA_ERROR
);
});
};
export
const
fetchLogs
=
({
commit
,
state
},
l
abel
)
=>
{
export
const
fetchLogs
=
({
commit
,
state
},
trackingL
abel
)
=>
{
commit
(
types
.
REQUEST_LOGS_DATA
);
return
requestLogsUntilData
({
commit
,
state
})
.
then
(({
data
})
=>
{
const
{
pod_name
,
pods
,
logs
,
cursor
}
=
data
;
if
(
logs
&&
logs
.
length
>
0
)
{
trackLogs
({
label
,
value
:
1
,
});
trackLogs
(
trackingLabel
);
}
commit
(
types
.
RECEIVE_LOGS_DATA_SUCCESS
,
{
logs
,
cursor
});
commit
(
types
.
SET_CURRENT_POD_NAME
,
pod_name
);
...
...
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