summaryrefslogtreecommitdiff
path: root/app/services/metrics/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/metrics/dashboard')
-rw-r--r--app/services/metrics/dashboard/default_embed_service.rb6
-rw-r--r--app/services/metrics/dashboard/predefined_dashboard_service.rb4
-rw-r--r--app/services/metrics/dashboard/project_dashboard_service.rb4
3 files changed, 14 insertions, 0 deletions
diff --git a/app/services/metrics/dashboard/default_embed_service.rb b/app/services/metrics/dashboard/default_embed_service.rb
index e1bd98bd5c2..39f7c3943dd 100644
--- a/app/services/metrics/dashboard/default_embed_service.rb
+++ b/app/services/metrics/dashboard/default_embed_service.rb
@@ -20,6 +20,12 @@ module Metrics
system_metrics_kubernetes_container_cores_total
).freeze
+ class << self
+ def valid_params?(params)
+ params[:embedded].present?
+ end
+ end
+
# Returns a new dashboard with only the matching
# metrics from the system dashboard, stripped of groups.
# @return [Hash]
diff --git a/app/services/metrics/dashboard/predefined_dashboard_service.rb b/app/services/metrics/dashboard/predefined_dashboard_service.rb
index 1be1a000854..297f00b1be9 100644
--- a/app/services/metrics/dashboard/predefined_dashboard_service.rb
+++ b/app/services/metrics/dashboard/predefined_dashboard_service.rb
@@ -15,6 +15,10 @@ module Metrics
].freeze
class << self
+ def valid_params?(params)
+ matching_dashboard?(params[:dashboard_path])
+ end
+
def matching_dashboard?(filepath)
filepath == self::DASHBOARD_PATH
end
diff --git a/app/services/metrics/dashboard/project_dashboard_service.rb b/app/services/metrics/dashboard/project_dashboard_service.rb
index b0d54ee9347..fadbe0fae01 100644
--- a/app/services/metrics/dashboard/project_dashboard_service.rb
+++ b/app/services/metrics/dashboard/project_dashboard_service.rb
@@ -9,6 +9,10 @@ module Metrics
DASHBOARD_ROOT = ".gitlab/dashboards"
class << self
+ def valid_params?(params)
+ params[:dashboard_path].present?
+ end
+
def all_dashboard_paths(project)
file_finder(project)
.list_files_for(DASHBOARD_ROOT)