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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
74563593
Commit
74563593
authored
Jul 31, 2019
by
Sarah Yasonik
Committed by
James Lopez
Jul 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure default metrics embed is cached
parent
af9b1ffa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
app/services/metrics/dashboard/default_embed_service.rb
app/services/metrics/dashboard/default_embed_service.rb
+1
-1
spec/services/metrics/dashboard/default_embed_service_spec.rb
.../services/metrics/dashboard/default_embed_service_spec.rb
+4
-2
No files found.
app/services/metrics/dashboard/default_embed_service.rb
View file @
74563593
...
...
@@ -23,7 +23,7 @@ module Metrics
# Returns a new dashboard with only the matching
# metrics from the system dashboard, stripped of groups.
# @return [Hash]
def
raw_dashboard
def
get_
raw_dashboard
panels
=
panel_groups
.
each_with_object
([])
do
|
group
,
panels
|
matched_panels
=
group
[
'panels'
].
select
{
|
panel
|
matching_panel?
(
panel
)
}
...
...
spec/services/metrics/dashboard/default_embed_service_spec.rb
View file @
74563593
...
...
@@ -14,14 +14,16 @@ describe Metrics::Dashboard::DefaultEmbedService, :use_clean_rails_memory_store_
end
describe
'#get_dashboard'
do
let
(
:service_params
)
{
[
project
,
user
,
{
environment:
environment
,
dashboard_path:
nil
}]
}
let
(
:service_params
)
{
[
project
,
user
,
{
environment:
environment
}]
}
let
(
:service_call
)
{
described_class
.
new
(
*
service_params
).
get_dashboard
}
it_behaves_like
'valid embedded dashboard service response'
it_behaves_like
'raises error for users with insufficient permissions'
it
'caches the unprocessed dashboard for subsequent calls'
do
expect
(
YAML
).
to
receive
(
:safe_load
).
once
.
and_call_original
system_service
=
Metrics
::
Dashboard
::
SystemDashboardService
expect
(
system_service
).
to
receive
(
:new
).
once
.
and_call_original
described_class
.
new
(
*
service_params
).
get_dashboard
described_class
.
new
(
*
service_params
).
get_dashboard
...
...
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