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
683270d5
Commit
683270d5
authored
Apr 29, 2019
by
Peter Leitzen
Committed by
James Lopez
Apr 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract health data configuration into a helper
parent
311ec363
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
10 deletions
+39
-10
ee/app/helpers/ee/clusters_helper.rb
ee/app/helpers/ee/clusters_helper.rb
+17
-0
ee/app/views/projects/clusters/_prometheus_graphs.html.haml
ee/app/views/projects/clusters/_prometheus_graphs.html.haml
+1
-10
ee/spec/helpers/ee/clusters_helper_spec.rb
ee/spec/helpers/ee/clusters_helper_spec.rb
+21
-0
No files found.
ee/app/helpers/ee/clusters_helper.rb
View file @
683270d5
...
...
@@ -13,5 +13,22 @@ module EE
def
show_cluster_health_graphs?
(
cluster
)
cluster
.
project_type?
&&
cluster
.
project
.
feature_available?
(
:cluster_health
)
end
def
cluster_health_data
(
cluster
)
project
=
cluster
.
project
{
'metrics-endpoint'
:
metrics_project_cluster_path
(
project
,
cluster
,
format: :json
),
'clusters-path'
:
project_clusters_path
(
project
),
'documentation-path'
:
help_page_path
(
'administration/monitoring/prometheus/index.md'
),
'empty-getting-started-svg-path'
:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
'empty-loading-svg-path'
:
image_path
(
'illustrations/monitoring/loading.svg'
),
'empty-no-data-svg-path'
:
image_path
(
'illustrations/monitoring/no_data.svg'
),
'empty-unable-to-connect-svg-path'
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
'settings-path'
:
''
,
'project-path'
:
''
,
'tags-path'
:
''
}
end
end
end
ee/app/views/projects/clusters/_prometheus_graphs.html.haml
View file @
683270d5
...
...
@@ -2,16 +2,7 @@
%h4
=
s_
(
'ClusterIntegration|Cluster health'
)
-
if
@cluster
&
.
application_prometheus_available?
#prometheus-graphs
{
data:
{
"settings-path"
:
edit_project_service_path
(
@project
,
'prometheus'
),
"clusters-path"
:
project_clusters_path
(
@project
),
"documentation-path"
:
help_page_path
(
'administration/monitoring/prometheus/index.md'
),
"empty-getting-started-svg-path"
:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
"empty-loading-svg-path"
:
image_path
(
'illustrations/monitoring/loading.svg'
),
"empty-no-data-svg-path"
:
image_path
(
'illustrations/monitoring/no_data.svg'
),
"empty-unable-to-connect-svg-path"
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
"metrics-endpoint"
:
metrics_namespace_project_cluster_path
(
format: :json
),
"project-path"
:
project_path
(
@project
),
"tags-path"
:
project_tags_path
(
@project
)
}
}
#prometheus-graphs
{
data:
cluster_health_data
(
@cluster
)
}
-
else
%p
.settings-message.text-center
=
s_
(
"ClusterIntegration|In order to view the health of your cluster, you must first install Prometheus below."
)
ee/spec/helpers/ee/clusters_helper_spec.rb
View file @
683270d5
...
...
@@ -62,4 +62,25 @@ describe ClustersHelper do
end
end
end
describe
'#cluster_health_data'
do
let
(
:project
)
{
cluster
.
project
}
let
(
:cluster
)
{
create
(
:cluster
,
:project
,
:provided_by_gcp
)
}
let
(
:cluster_presenter
)
{
cluster
.
present
}
it
'returns graph configuration'
do
expect
(
cluster_health_data
(
cluster_presenter
)).
to
eq
(
'clusters-path'
:
project_clusters_path
(
project
),
'documentation-path'
:
help_page_path
(
'administration/monitoring/prometheus/index.md'
),
'empty-getting-started-svg-path'
:
image_path
(
'illustrations/monitoring/getting_started.svg'
),
'empty-loading-svg-path'
:
image_path
(
'illustrations/monitoring/loading.svg'
),
'empty-no-data-svg-path'
:
image_path
(
'illustrations/monitoring/no_data.svg'
),
'empty-unable-to-connect-svg-path'
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
'metrics-endpoint'
:
metrics_project_cluster_path
(
project
,
cluster
,
format: :json
),
'settings-path'
:
''
,
'project-path'
:
''
,
'tags-path'
:
''
)
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