BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
84e1cc55
Commit
84e1cc55
authored
Feb 13, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/cycle-analytics-events-limit' into 'master'
Add limit to the number of events showed in cycle analytics See merge request !7743
parents
85349c96
dff411d7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
2 deletions
+63
-2
stage_plan_component.js.es6
...ts/cycle_analytics/components/stage_plan_component.js.es6
+6
-0
cycle_analytics.scss
app/assets/stylesheets/pages/cycle_analytics.scss
+5
-1
fix-cycle-analytics-events-limit.yml
changelogs/unreleased/fix-cycle-analytics-events-limit.yml
+4
-0
base_event_fetcher.rb
lib/gitlab/cycle_analytics/base_event_fetcher.rb
+3
-1
base_event_fetcher_spec.rb
spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb
+45
-0
No files found.
app/assets/javascripts/cycle_analytics/components/stage_plan_component.js.es6
View file @
84e1cc55
...
...
@@ -13,6 +13,12 @@
<div>
<div class="events-description">
{{ stage.description }}
<span v-if="items.length === 50" class="events-info pull-right">
<i class="fa fa-warning has-tooltip"
title="Limited to showing 50 events at most"
data-placement="top"></i>
Showing 50 events
</span>
</div>
<ul class="stage-event-list">
<li v-for="commit in items" class="stage-event-item">
...
...
app/assets/stylesheets/pages/cycle_analytics.scss
View file @
84e1cc55
...
...
@@ -284,7 +284,11 @@
.events-description
{
line-height
:
65px
;
padding-left
:
$gl-padding
;
padding
:
0
$gl-padding
;
}
.events-info
{
color
:
$gl-text-color-secondary
;
}
}
...
...
changelogs/unreleased/fix-cycle-analytics-events-limit.yml
0 → 100644
View file @
84e1cc55
---
title
:
Add limit to the number of events showed in cycle analytics
merge_request
:
author
:
lib/gitlab/cycle_analytics/base_event_fetcher.rb
View file @
84e1cc55
...
...
@@ -5,6 +5,8 @@ module Gitlab
attr_reader
:projections
,
:query
,
:stage
,
:order
MAX_EVENTS
=
50
def
initialize
(
project
:,
stage
:,
options
:)
@project
=
project
@stage
=
stage
...
...
@@ -38,7 +40,7 @@ module Gitlab
def
events_query
diff_fn
=
subtract_datetimes_diff
(
base_query
,
@options
[
:start_time_attrs
],
@options
[
:end_time_attrs
])
base_query
.
project
(
extract_diff_epoch
(
diff_fn
).
as
(
'total_time'
),
*
projections
).
order
(
order
.
desc
)
base_query
.
project
(
extract_diff_epoch
(
diff_fn
).
as
(
'total_time'
),
*
projections
).
order
(
order
.
desc
)
.
take
(
MAX_EVENTS
)
end
def
default_order
...
...
spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb
0 → 100644
View file @
84e1cc55
require
'spec_helper'
describe
Gitlab
::
CycleAnalytics
::
BaseEventFetcher
do
let
(
:max_events
)
{
2
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
let
(
:start_time_attrs
)
{
Issue
.
arel_table
[
:created_at
]
}
let
(
:end_time_attrs
)
{
[
Issue
::
Metrics
.
arel_table
[
:first_associated_with_milestone_at
]]
}
let
(
:options
)
do
{
start_time_attrs:
start_time_attrs
,
end_time_attrs:
end_time_attrs
,
from:
30
.
days
.
ago
}
end
subject
do
described_class
.
new
(
project:
project
,
stage: :issue
,
options:
options
).
fetch
end
before
do
allow_any_instance_of
(
Gitlab
::
ReferenceExtractor
).
to
receive
(
:issues
).
and_return
(
Issue
.
all
)
allow_any_instance_of
(
Gitlab
::
CycleAnalytics
::
BaseEventFetcher
).
to
receive
(
:serialize
)
do
|
event
|
event
end
stub_const
(
'Gitlab::CycleAnalytics::BaseEventFetcher::MAX_EVENTS'
,
max_events
)
setup_events
(
count:
3
)
end
it
'limits the rows to the max number'
do
expect
(
subject
.
count
).
to
eq
(
max_events
)
end
def
setup_events
(
count
:)
count
.
times
do
issue
=
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
milestone
=
create
(
:milestone
,
project:
project
)
issue
.
update
(
milestone:
milestone
)
create_merge_request_closing_issue
(
issue
)
end
end
end
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