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
ca6a745c
Commit
ca6a745c
authored
Nov 13, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the count method for counting grafana urls
parent
364d921a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
10 deletions
+4
-10
lib/gitlab/grafana_embed_usage_data.rb
lib/gitlab/grafana_embed_usage_data.rb
+2
-6
spec/lib/gitlab/grafana_embed_usage_data_spec.rb
spec/lib/gitlab/grafana_embed_usage_data_spec.rb
+2
-4
No files found.
lib/gitlab/grafana_embed_usage_data.rb
View file @
ca6a745c
...
@@ -4,13 +4,9 @@ module Gitlab
...
@@ -4,13 +4,9 @@ module Gitlab
class
GrafanaEmbedUsageData
class
GrafanaEmbedUsageData
class
<<
self
class
<<
self
def
issue_count
def
issue_count
count
=
0
Issue
.
with_project_grafana_integration
.
find_each
.
count
do
|
issue
|
has_grafana_url?
(
issue
)
Issue
.
with_project_grafana_integration
.
find_each
do
|
issue
|
count
+=
has_grafana_url?
(
issue
)
?
1
:
0
end
end
count
end
end
private
private
...
...
spec/lib/gitlab/grafana_embed_usage_data_spec.rb
View file @
ca6a745c
...
@@ -4,9 +4,7 @@ require 'spec_helper'
...
@@ -4,9 +4,7 @@ require 'spec_helper'
describe
Gitlab
::
GrafanaEmbedUsageData
do
describe
Gitlab
::
GrafanaEmbedUsageData
do
describe
'#issue_count'
,
:use_clean_rails_memory_store_caching
do
describe
'#issue_count'
,
:use_clean_rails_memory_store_caching
do
subject
do
subject
{
described_class
.
issue_count
}
described_class
.
issue_count
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:description_with_embed
)
{
"Some comment
\n\n
https://grafana.example.com/d/xvAk4q0Wk/go-processes?orgId=1&from=1573238522762&to=1573240322762&var-job=prometheus&var-interval=10m&panelId=1&fullscreen"
}
let
(
:description_with_embed
)
{
"Some comment
\n\n
https://grafana.example.com/d/xvAk4q0Wk/go-processes?orgId=1&from=1573238522762&to=1573240322762&var-job=prometheus&var-interval=10m&panelId=1&fullscreen"
}
...
@@ -20,7 +18,7 @@ describe Gitlab::GrafanaEmbedUsageData do
...
@@ -20,7 +18,7 @@ describe Gitlab::GrafanaEmbedUsageData do
context
'with project grafana integration enabled'
do
context
'with project grafana integration enabled'
do
before
do
before
do
create
(
:grafana_integration
,
project:
project
)
create
(
:grafana_integration
,
project:
project
,
enabled:
true
)
end
end
context
'with valid and invalid embeds'
do
context
'with valid and invalid embeds'
do
...
...
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