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
9e44c75c
Commit
9e44c75c
authored
May 20, 2020
by
Jan Provaznik
Committed by
Sean McGivern
May 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add confidential epics count to usage data
Track number of confidential epics
parent
454c8f25
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
8 deletions
+40
-8
db/migrate/20200519115908_add_epics_confidential_index.rb
db/migrate/20200519115908_add_epics_confidential_index.rb
+17
-0
db/structure.sql
db/structure.sql
+3
-0
ee/app/models/ee/epic.rb
ee/app/models/ee/epic.rb
+3
-2
ee/changelogs/unreleased/confidential-epics-usage.yml
ee/changelogs/unreleased/confidential-epics-usage.yml
+5
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-0
ee/spec/lib/ee/gitlab/usage_data_spec.rb
ee/spec/lib/ee/gitlab/usage_data_spec.rb
+1
-0
ee/spec/models/epic_spec.rb
ee/spec/models/epic_spec.rb
+10
-6
No files found.
db/migrate/20200519115908_add_epics_confidential_index.rb
0 → 100644
View file @
9e44c75c
# frozen_string_literal: true
class
AddEpicsConfidentialIndex
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:epics
,
:confidential
end
def
down
remove_concurrent_index
:epics
,
:confidential
end
end
db/structure.sql
View file @
9e44c75c
...
...
@@ -9582,6 +9582,8 @@ CREATE INDEX index_epics_on_author_id ON public.epics USING btree (author_id);
CREATE
INDEX
index_epics_on_closed_by_id
ON
public
.
epics
USING
btree
(
closed_by_id
);
CREATE
INDEX
index_epics_on_confidential
ON
public
.
epics
USING
btree
(
confidential
);
CREATE
INDEX
index_epics_on_due_date_sourcing_epic_id
ON
public
.
epics
USING
btree
(
due_date_sourcing_epic_id
)
WHERE
(
due_date_sourcing_epic_id
IS
NOT
NULL
);
CREATE
INDEX
index_epics_on_due_date_sourcing_milestone_id
ON
public
.
epics
USING
btree
(
due_date_sourcing_milestone_id
);
...
...
@@ -13867,5 +13869,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200514000132
20200514000340
20200515155620
20200519115908
\
.
ee/app/models/ee/epic.rb
View file @
9e44c75c
...
...
@@ -69,7 +69,6 @@ module EE
scope
:in_issues
,
->
(
issues
)
{
joins
(
:epic_issues
).
where
(
epic_issues:
{
issue_id:
issues
}).
distinct
}
scope
:has_parent
,
->
{
where
.
not
(
parent_id:
nil
)
}
scope
:iid_starts_with
,
->
(
query
)
{
where
(
"CAST(iid AS VARCHAR) LIKE ?"
,
"
#{
sanitize_sql_like
(
query
)
}
%"
)
}
scope
:public_only
,
->
{
where
(
confidential:
false
)
}
scope
:within_timeframe
,
->
(
start_date
,
end_date
)
do
where
(
'start_date is not NULL or end_date is not NULL'
)
...
...
@@ -107,8 +106,10 @@ module EE
scope
:counts_by_state
,
->
{
group
(
:state_id
).
count
}
scope
:public_only
,
->
{
where
(
confidential:
false
)
}
scope
:confidential
,
->
{
where
(
confidential:
true
)
}
scope
:not_confidential_or_in_groups
,
->
(
groups
)
do
where
.
not
(
confidential:
true
)
.
or
(
where
(
confidential:
true
,
group_id:
groups
))
public_only
.
or
(
where
(
confidential:
true
,
group_id:
groups
))
end
MAX_HIERARCHY_DEPTH
=
5
...
...
ee/changelogs/unreleased/confidential-epics-usage.yml
0 → 100644
View file @
9e44c75c
---
title
:
Added DB index on confidential epics column.
merge_request
:
32443
author
:
type
:
other
ee/lib/ee/gitlab/usage_data.rb
View file @
9e44c75c
...
...
@@ -156,6 +156,7 @@ module EE
super
.
tap
do
|
usage_data
|
usage_data
[
:counts
].
merge!
(
{
confidential_epics:
count
(
::
Epic
.
confidential
),
dependency_list_usages_total:
redis_usage_data
{
::
Gitlab
::
UsageCounters
::
DependencyList
.
usage_totals
[
:total
]
},
epics:
count
(
::
Epic
),
feature_flags:
count
(
Operations
::
FeatureFlag
),
...
...
ee/spec/lib/ee/gitlab/usage_data_spec.rb
View file @
9e44c75c
...
...
@@ -79,6 +79,7 @@ describe Gitlab::UsageData do
expect
(
count_data
[
:projects
]).
to
eq
(
3
)
expect
(
count_data
.
keys
).
to
include
(
*
%i(
confidential_epics
container_scanning_jobs
dast_jobs
dependency_list_usages_total
...
...
ee/spec/models/epic_spec.rb
View file @
9e44c75c
...
...
@@ -20,22 +20,26 @@ describe Epic do
end
describe
'scopes'
do
let_it_be
(
:confidential_epic
)
{
create
(
:epic
,
confidential:
true
,
group:
group
)
}
let_it_be
(
:public_epic
)
{
create
(
:epic
,
group:
group
)
}
describe
'.public_only'
do
it
'only returns public epics'
do
public_epic
=
create
(
:epic
)
create
(
:epic
,
confidential:
true
)
expect
(
described_class
.
public_only
).
to
eq
([
public_epic
])
end
end
describe
'.confidential'
do
it
'only returns confidential epics'
do
expect
(
described_class
.
confidential
).
to
eq
([
confidential_epic
])
end
end
describe
'.not_confidential_or_in_groups'
do
it
'returns only epics which are either not confidential or in the group'
do
confidential_epic
=
create
(
:epic
,
confidential:
true
,
group:
group
)
group_epic
=
create
(
:epic
,
group:
group
)
create
(
:epic
,
confidential:
true
)
expect
(
described_class
.
not_confidential_or_in_groups
(
group
)).
to
match_array
([
confidential_epic
,
group
_epic
])
expect
(
described_class
.
not_confidential_or_in_groups
(
group
)).
to
match_array
([
confidential_epic
,
public
_epic
])
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