Class: Metrics::Dashboard::CustomDashboardService
- Inherits:
-
BaseService
- Object
- BaseService
- BaseService
- Metrics::Dashboard::CustomDashboardService
- Defined in:
- app/services/metrics/dashboard/custom_dashboard_service.rb
Constant Summary
Constants inherited from BaseService
BaseService::SEQUENCE, BaseService::STAGES
Constants included from Gitlab::Metrics::Dashboard::Errors
Gitlab::Metrics::Dashboard::Errors::DashboardProcessingError, Gitlab::Metrics::Dashboard::Errors::LayoutError, Gitlab::Metrics::Dashboard::Errors::MissingIntegrationError, Gitlab::Metrics::Dashboard::Errors::MissingQueryError, Gitlab::Metrics::Dashboard::Errors::NOT_FOUND_ERROR, Gitlab::Metrics::Dashboard::Errors::PanelNotFoundError
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Class Method Summary collapse
- .all_dashboard_paths(project) ⇒ Object
-
.name_for_path(filepath) ⇒ Object
Grabs the filepath after the base directory.
- .valid_params?(params) ⇒ Boolean
Methods inherited from BaseService
#get_dashboard, out_of_the_box_dashboard?, #raw_dashboard
Methods included from Gitlab::Metrics::Dashboard::Errors
#handle_errors, #panels_not_found!
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Class Method Details
.all_dashboard_paths(project) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/metrics/dashboard/custom_dashboard_service.rb', line 14 def all_dashboard_paths(project) project.repository.user_defined_metrics_dashboard_paths .map do |filepath| { path: filepath, display_name: name_for_path(filepath), default: false, system_dashboard: false, out_of_the_box_dashboard: out_of_the_box_dashboard? } end end |
.name_for_path(filepath) ⇒ Object
Grabs the filepath after the base directory.
28 29 30 |
# File 'app/services/metrics/dashboard/custom_dashboard_service.rb', line 28 def name_for_path(filepath) filepath.delete_prefix("#{Gitlab::Metrics::Dashboard::RepoDashboardFinder::DASHBOARD_ROOT}/") end |
.valid_params?(params) ⇒ Boolean
10 11 12 |
# File 'app/services/metrics/dashboard/custom_dashboard_service.rb', line 10 def valid_params?(params) params[:dashboard_path].present? end |