diff options
author | Sarah Yasonik <syasonik@gitlab.com> | 2019-05-01 10:16:03 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-05-01 10:16:03 +0000 |
commit | 552a3d2fd939d3f8a56cfad9fad62227c1d5aa89 (patch) | |
tree | d10ce5f4615b0e9dbeb7543736984b3e3ff10dbb /app/models | |
parent | d7b75b661f8ed2468a322c4ae55eadcbdb3b2615 (diff) | |
download | gitlab-ce-552a3d2fd939d3f8a56cfad9fad62227c1d5aa89.tar.gz |
Update metrics dashboard API to load yml from repo
Updates the EnvironmentController#metrics_dashboard endpoint
to support a "dashboard" param, which can be used to specify
the filepath of a dashboard configuration from a project
repository. Dashboard configurations are expected to be
stored in .gitlab/dashboards/.
Updates dashboard post-processing steps to exclude custom
metrics, which should only display on the system dashboard.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 8b728c4f6b2..f495a03ad8e 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -39,7 +39,8 @@ class Repository changelog license_blob license_key gitignore gitlab_ci_yml branch_names tag_names branch_count tag_count avatar exists? root_ref has_visible_content? - issue_template_names merge_request_template_names xcode_project?).freeze + issue_template_names merge_request_template_names + metrics_dashboard_paths xcode_project?).freeze # Methods that use cache_method but only memoize the value MEMOIZED_CACHED_METHODS = %i(license).freeze @@ -57,6 +58,7 @@ class Repository avatar: :avatar, issue_template: :issue_template_names, merge_request_template: :merge_request_template_names, + metrics_dashboard: :metrics_dashboard_paths, xcode_config: :xcode_project? }.freeze @@ -602,6 +604,11 @@ class Repository end cache_method :merge_request_template_names, fallback: [] + def metrics_dashboard_paths + Gitlab::Metrics::Dashboard::Finder.find_all_paths_from_source(project) + end + cache_method :metrics_dashboard_paths + def readme head_tree&.readme end |