Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-19 21:10:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-19 21:10:34 +0300
commit2f5731cf536deff075d1011814f271cbb1ed67e2 (patch)
treef6e6dec098a60039b1413dae64d24c0bf55bf03d /app/models/blob_viewer
parent74b5b3ffcb9fe4d9424bc2bf35e43f749f76d023 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/blob_viewer')
-rw-r--r--app/models/blob_viewer/metrics_dashboard_yml.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/models/blob_viewer/metrics_dashboard_yml.rb b/app/models/blob_viewer/metrics_dashboard_yml.rb
index 1ee7cad5094..c05fb5d88d6 100644
--- a/app/models/blob_viewer/metrics_dashboard_yml.rb
+++ b/app/models/blob_viewer/metrics_dashboard_yml.rb
@@ -26,10 +26,19 @@ module BlobViewer
def parse_blob_data
yaml = ::Gitlab::Config::Loader::Yaml.new(blob.data).load_raw!
- Gitlab::Metrics::Dashboard::Validator
- .errors(yaml, dashboard_path: blob.path, project: project)
+
+ ::PerformanceMonitoring::PrometheusDashboard.from_json(yaml)
+ nil
rescue Gitlab::Config::Loader::FormatError => error
- [error]
+ wrap_yml_syntax_error(error)
+ rescue ActiveModel::ValidationError => invalid
+ invalid.model.errors
+ end
+
+ def wrap_yml_syntax_error(error)
+ ::PerformanceMonitoring::PrometheusDashboard.new.errors.tap do |errors|
+ errors.add(:'YAML syntax', error.message)
+ end
end
end
end