summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-10 09:09:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-10 09:09:39 +0000
commitc52b81f45762cb7f05a950689dfc6d51b197ea73 (patch)
treec44830c2fc21d13b81814958c44b09fa8d11c805 /app
parent187ee320b39af22929d74c5a2d9b0650bf50a09b (diff)
downloadgitlab-ce-c52b81f45762cb7f05a950689dfc6d51b197ea73.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/monitoring/components/charts/annotations.js12
-rw-r--r--app/assets/javascripts/monitoring/components/charts/time_series.vue12
-rw-r--r--app/assets/stylesheets/framework/sidebar.scss12
-rw-r--r--app/presenters/projects/prometheus/alert_presenter.rb2
-rw-r--r--app/services/metrics/dashboard/custom_metric_embed_service.rb47
5 files changed, 50 insertions, 35 deletions
diff --git a/app/assets/javascripts/monitoring/components/charts/annotations.js b/app/assets/javascripts/monitoring/components/charts/annotations.js
index b0c89d5e374..de2b0c69a88 100644
--- a/app/assets/javascripts/monitoring/components/charts/annotations.js
+++ b/app/assets/javascripts/monitoring/components/charts/annotations.js
@@ -87,11 +87,17 @@ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] }
return {
name: 'deployments',
value: [deployment.createdAt, annotationsYAxisCoords.pos],
+ // style options
symbol: deployment.icon,
symbolSize: symbolSizes.default,
itemStyle: {
color: deployment.color,
},
+ // metadata that are accessible in `formatTooltipText` method
+ tooltipData: {
+ sha: deployment.sha.substring(0, 8),
+ commitUrl: deployment.commitUrl,
+ },
};
});
@@ -100,8 +106,12 @@ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] }
return {
name: 'annotations',
value: [annotation.from, annotationsYAxisCoords.pos],
+ // style options
symbol: 'none',
- description: annotation.description,
+ // metadata that are accessible in `formatTooltipText` method
+ tooltipData: {
+ description: annotation.description,
+ },
};
});
diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue
index f4cd6bbbb34..24aa8480ce4 100644
--- a/app/assets/javascripts/monitoring/components/charts/time_series.vue
+++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue
@@ -262,19 +262,17 @@ export default {
params.seriesData.forEach(dataPoint => {
if (dataPoint.value) {
- const [xVal, yVal] = dataPoint.value;
+ const [, yVal] = dataPoint.value;
this.tooltip.type = dataPoint.name;
if (this.isTooltipOfType(this.tooltip.type, this.$options.tooltipTypes.deployments)) {
- const [deploy] = this.recentDeployments.filter(
- deployment => deployment.createdAt === xVal,
- );
- this.tooltip.sha = deploy.sha.substring(0, 8);
- this.tooltip.commitUrl = deploy.commitUrl;
+ const { data = {} } = dataPoint;
+ this.tooltip.sha = data?.tooltipData?.sha;
+ this.tooltip.commitUrl = data?.tooltipData?.commitUrl;
} else if (
this.isTooltipOfType(this.tooltip.type, this.$options.tooltipTypes.annotations)
) {
const { data } = dataPoint;
- this.tooltip.content.push(data?.description);
+ this.tooltip.content.push(data?.tooltipData?.description);
} else {
const { seriesName, color, dataIndex } = dataPoint;
diff --git a/app/assets/stylesheets/framework/sidebar.scss b/app/assets/stylesheets/framework/sidebar.scss
index ddda2de38cb..1131248dd3f 100644
--- a/app/assets/stylesheets/framework/sidebar.scss
+++ b/app/assets/stylesheets/framework/sidebar.scss
@@ -210,3 +210,15 @@
}
}
}
+
+.health-status {
+ .dropdown-body {
+ .health-divider {
+ border-top-color: $gray-200;
+ }
+
+ .dropdown-item:not(.health-dropdown-item) {
+ padding: 0;
+ }
+ }
+}
diff --git a/app/presenters/projects/prometheus/alert_presenter.rb b/app/presenters/projects/prometheus/alert_presenter.rb
index 02e22f8f46a..c03925c0871 100644
--- a/app/presenters/projects/prometheus/alert_presenter.rb
+++ b/app/presenters/projects/prometheus/alert_presenter.rb
@@ -3,7 +3,7 @@
module Projects
module Prometheus
class AlertPresenter < Gitlab::View::Presenter::Delegated
- RESERVED_ANNOTATIONS = %w(gitlab_incident_markdown title).freeze
+ RESERVED_ANNOTATIONS = %w(gitlab_incident_markdown gitlab_y_label title).freeze
GENERIC_ALERT_SUMMARY_ANNOTATIONS = %w(monitoring_tool service hosts).freeze
MARKDOWN_LINE_BREAK = " \n".freeze
INCIDENT_LABEL_NAME = IncidentManagement::CreateIssueService::INCIDENT_LABEL[:title].freeze
diff --git a/app/services/metrics/dashboard/custom_metric_embed_service.rb b/app/services/metrics/dashboard/custom_metric_embed_service.rb
index 456074ae6ad..22b592c7aa5 100644
--- a/app/services/metrics/dashboard/custom_metric_embed_service.rb
+++ b/app/services/metrics/dashboard/custom_metric_embed_service.rb
@@ -57,7 +57,7 @@ module Metrics
# @return [Hash]
override :raw_dashboard
def raw_dashboard
- panels_not_found!(identifiers) if panels.empty?
+ panels_not_found!(identifiers) if metrics.empty?
{ 'panel_groups' => [{ 'panels' => panels }] }
end
@@ -66,11 +66,20 @@ module Metrics
# Generated dashboard panels for each metric which
# matches the provided input.
+ #
+ # As the panel is generated
+ # on the fly, we're using default values for info
+ # not represented in the DB.
+ #
# @return [Array<Hash>]
def panels
- strong_memoize(:panels) do
- metrics.map { |metric| panel_for_metric(metric) }
- end
+ [{
+ type: DEFAULT_PANEL_TYPE,
+ weight: DEFAULT_PANEL_WEIGHT,
+ title: title,
+ y_label: y_label,
+ metrics: metrics.map(&:to_metric_hash)
+ }]
end
# Metrics which match the provided inputs.
@@ -78,12 +87,14 @@ module Metrics
# displayed in a single panel/chart.
# @return [ActiveRecord::AssociationRelation<PromtheusMetric>]
def metrics
- PrometheusMetricsFinder.new(
- project: project,
- group: group_key,
- title: title,
- y_label: y_label
- ).execute
+ strong_memoize(:metrics) do
+ PrometheusMetricsFinder.new(
+ project: project,
+ group: group_key,
+ title: title,
+ y_label: y_label
+ ).execute
+ end
end
# Returns a symbol representing the group that
@@ -101,22 +112,6 @@ module Metrics
.to_s
end
end
-
- # Returns a representation of a PromtheusMetric
- # as a dashboard panel. As the panel is generated
- # on the fly, we're using default values for info
- # not represented in the DB.
- #
- # @return [Hash]
- def panel_for_metric(metric)
- {
- type: DEFAULT_PANEL_TYPE,
- weight: DEFAULT_PANEL_WEIGHT,
- title: metric.title,
- y_label: metric.y_label,
- metrics: [metric.to_metric_hash]
- }
- end
end
end
end