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
12642e1d
Commit
12642e1d
authored
Jul 31, 2020
by
syasonik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Target stubs for embed domains
parent
19c8ef03
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
12 deletions
+24
-12
ee/lib/banzai/filter/inline_alert_metrics_filter.rb
ee/lib/banzai/filter/inline_alert_metrics_filter.rb
+1
-1
ee/spec/features/markdown/metrics_spec.rb
ee/spec/features/markdown/metrics_spec.rb
+1
-4
lib/banzai/filter/inline_cluster_metrics_filter.rb
lib/banzai/filter/inline_cluster_metrics_filter.rb
+1
-1
lib/banzai/filter/inline_embeds_filter.rb
lib/banzai/filter/inline_embeds_filter.rb
+4
-0
lib/banzai/filter/inline_metrics_filter.rb
lib/banzai/filter/inline_metrics_filter.rb
+1
-1
lib/gitlab/metrics/dashboard/url.rb
lib/gitlab/metrics/dashboard/url.rb
+5
-1
spec/features/markdown/metrics_spec.rb
spec/features/markdown/metrics_spec.rb
+1
-4
spec/support/helpers/metrics_dashboard_url_helpers.rb
spec/support/helpers/metrics_dashboard_url_helpers.rb
+10
-0
No files found.
ee/lib/banzai/filter/inline_alert_metrics_filter.rb
View file @
12642e1d
...
...
@@ -12,7 +12,7 @@ module Banzai
def
xpath_search
"descendant-or-self::a[contains(@href,'metrics_dashboard') and \
contains(@href,'prometheus/alerts') and \
starts-with(@href, '
#{
::
Gitlab
.
config
.
gitlab
.
url
}
')]"
starts-with(@href, '
#{
gitlab_domain
}
')]"
end
# Regular expression matching alert dashboard urls
...
...
ee/spec/features/markdown/metrics_spec.rb
View file @
12642e1d
...
...
@@ -14,10 +14,7 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
before
do
clear_host_from_memoized_variables
allow
(
::
Gitlab
.
config
.
gitlab
)
.
to
receive
(
:url
)
.
and_return
(
urls
.
root_url
.
chomp
(
'/'
))
stub_gitlab_domain
stub_licensed_features
(
prometheus_alerts:
true
)
...
...
lib/banzai/filter/inline_cluster_metrics_filter.rb
View file @
12642e1d
...
...
@@ -15,7 +15,7 @@ module Banzai
def
xpath_search
"descendant-or-self::a[contains(@href,'clusters') and \
starts-with(@href, '
#{
::
Gitlab
.
config
.
gitlab
.
url
}
')]"
starts-with(@href, '
#{
gitlab_domain
}
')]"
end
def
link_pattern
...
...
lib/banzai/filter/inline_embeds_filter.rb
View file @
12642e1d
...
...
@@ -82,6 +82,10 @@ module Banzai
def
metrics_dashboard_url
raise
NotImplementedError
end
def
gitlab_domain
::
Gitlab
.
config
.
gitlab
.
url
end
end
end
end
lib/banzai/filter/inline_metrics_filter.rb
View file @
12642e1d
...
...
@@ -11,7 +11,7 @@ module Banzai
def
xpath_search
"descendant-or-self::a[contains(@href,'metrics') and \
contains(@href,'environments') and \
starts-with(@href, '
#{
Gitlab
.
config
.
gitlab
.
url
}
')]"
starts-with(@href, '
#{
gitlab_domain
}
')]"
end
# Regular expression matching metrics urls
...
...
lib/gitlab/metrics/dashboard/url.rb
View file @
12642e1d
...
...
@@ -92,12 +92,16 @@ module Gitlab
end
def
gitlab_host_pattern
Regexp
.
escape
(
Gitlab
.
config
.
gitlab
.
url
)
Regexp
.
escape
(
gitlab_domain
)
end
def
project_path_pattern
"
\/
#{
Project
.
reference_pattern
}
"
end
def
gitlab_domain
Gitlab
.
config
.
gitlab
.
url
end
end
end
end
...
...
spec/features/markdown/metrics_spec.rb
View file @
12642e1d
...
...
@@ -18,10 +18,7 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
before
do
clear_host_from_memoized_variables
allow
(
::
Gitlab
.
config
.
gitlab
)
.
to
receive
(
:url
)
.
and_return
(
urls
.
root_url
.
chomp
(
'/'
))
stub_gitlab_domain
project
.
add_developer
(
user
)
sign_in
(
user
)
...
...
spec/support/helpers/metrics_dashboard_url_helpers.rb
View file @
12642e1d
...
...
@@ -13,4 +13,14 @@ module MetricsDashboardUrlHelpers
Gitlab
::
Metrics
::
Dashboard
::
Url
.
clear_memoization
(
method_name
)
end
end
def
stub_gitlab_domain
allow_any_instance_of
(
Banzai
::
Filter
::
InlineEmbedsFilter
)
.
to
receive
(
:gitlab_domain
)
.
and_return
(
urls
.
root_url
.
chomp
(
'/'
))
allow
(
Gitlab
::
Metrics
::
Dashboard
::
Url
)
.
to
receive
(
:gitlab_domain
)
.
and_return
(
urls
.
root_url
.
chomp
(
'/'
))
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