Class: Gitlab::Metrics::Dashboard::RepoDashboardFinder
- Inherits:
-
Object
- Object
- Gitlab::Metrics::Dashboard::RepoDashboardFinder
- Defined in:
- lib/gitlab/metrics/dashboard/repo_dashboard_finder.rb
Constant Summary collapse
- DASHBOARD_ROOT =
".gitlab/dashboards"
- DASHBOARD_EXTENSION =
'.yml'
Class Method Summary collapse
-
.list_dashboards(project) ⇒ Array
Returns list of all user-defined dashboard paths.
-
.read_dashboard(project, dashboard_path) ⇒ String
Reads the given dashboard from repository, and returns the content as a string.
Class Method Details
.list_dashboards(project) ⇒ Array
Returns list of all user-defined dashboard paths. Used to populate Repository model cache (Repository#user_defined_metrics_dashboard_paths). Also deletes all dashboard cache entries.
16 17 18 19 20 |
# File 'lib/gitlab/metrics/dashboard/repo_dashboard_finder.rb', line 16 def list_dashboards(project) Gitlab::Metrics::Dashboard::Cache.for(project).delete_all! file_finder(project).list_files_for(DASHBOARD_ROOT) end |
.read_dashboard(project, dashboard_path) ⇒ String
Reads the given dashboard from repository, and returns the content as a string.
24 25 26 |
# File 'lib/gitlab/metrics/dashboard/repo_dashboard_finder.rb', line 24 def read_dashboard(project, dashboard_path) file_finder(project).read(dashboard_path) end |