2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module EnvironmentsHelper
|
|
|
|
def environments_list_data
|
|
|
|
{
|
2017-09-10 17:25:29 +05:30
|
|
|
endpoint: project_environments_path(@project, format: :json)
|
2017-08-17 22:00:37 +05:30
|
|
|
}
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
def environments_folder_list_view_data
|
|
|
|
{
|
|
|
|
"endpoint" => folder_project_environments_path(@project, @folder, format: :json),
|
|
|
|
"folder-name" => @folder,
|
|
|
|
"can-read-environment" => can?(current_user, :read_environment, @project).to_s
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
def metrics_data(project, environment)
|
|
|
|
{
|
|
|
|
"settings-path" => edit_project_service_path(project, 'prometheus'),
|
|
|
|
"clusters-path" => project_clusters_path(project),
|
|
|
|
"current-environment-name": environment.name,
|
|
|
|
"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" => additional_metrics_project_environment_path(project, environment, format: :json),
|
|
|
|
"deployment-endpoint" => project_environment_deployments_path(project, environment, format: :json),
|
|
|
|
"environments-endpoint": project_environments_path(project, format: :json),
|
|
|
|
"project-path" => project_path(project),
|
|
|
|
"tags-path" => project_tags_path(project),
|
|
|
|
"has-metrics" => "#{environment.has_metrics?}"
|
|
|
|
}
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|