Commit 3df912ce authored by allison.browne's avatar allison.browne

Fix merge conflicts

parents c77bb71c fc967011
......@@ -34,6 +34,7 @@ module EnvironmentsHelper
"project-path" => project_path(project),
"tags-path" => project_tags_path(project),
"has-metrics" => "#{environment.has_metrics?}",
"prometheus-status" => "#{environment.prometheus_status}",
"external-dashboard-url" => project.metrics_setting_external_dashboard_url
}
end
......
......@@ -188,6 +188,10 @@ class Environment < ApplicationRecord
prometheus_adapter.query(:environment, self) if has_metrics?
end
def prometheus_status
deployment_platform&.cluster&.application_prometheus&.status_name
end
def additional_metrics(*args)
return unless has_metrics?
......
......@@ -11,7 +11,7 @@ module Issues
def add_link(link)
if can_add_link? && (link = parse_link(link))
success(_('Zoom meeting added'), create_zoom_meeting(link))
success(_('Zoom meeting added'), add_zoom_meeting(link))
else
error(_('Failed to add a Zoom meeting'))
end
......@@ -43,8 +43,6 @@ module Issues
def fetch_added_meeting
ZoomMeeting.canonical_meeting(@issue)
def issue_description
issue.description || ''
end
def track_meeting_added_event
......
---
title: Expose prometheus status to monitor dashboard
merge_request: 18289
author:
type: fixed
......@@ -3834,24 +3834,24 @@ ActiveRecord::Schema.define(version: 2019_10_16_220135) do
t.bigint "author_id", null: false
t.bigint "updated_by_id"
t.bigint "last_edited_by_id"
t.date "start_date"
t.date "due_date"
t.datetime_with_timezone "last_edited_at"
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.string "title", limit: 255, null: false
t.text "title_html", null: false
t.text "description"
t.text "description_html"
t.bigint "start_date_sourcing_milestone_id"
t.bigint "due_date_sourcing_milestone_id"
t.bigint "closed_by_id"
t.datetime_with_timezone "last_edited_at"
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.datetime_with_timezone "closed_at"
t.date "start_date"
t.date "due_date"
t.integer "state", limit: 2, default: 1, null: false
t.integer "severity", limit: 2, null: false
t.boolean "severity_overridden", default: false
t.integer "confidence", limit: 2, null: false
t.boolean "severity_overridden", default: false
t.boolean "confidence_overridden", default: false
t.string "title", limit: 255, null: false
t.text "title_html", null: false
t.text "description"
t.text "description_html"
t.index ["author_id"], name: "index_vulnerabilities_on_author_id"
t.index ["closed_by_id"], name: "index_vulnerabilities_on_closed_by_id"
t.index ["due_date_sourcing_milestone_id"], name: "index_vulnerabilities_on_due_date_sourcing_milestone_id"
......
......@@ -32,6 +32,7 @@ describe EnvironmentsHelper do
'project-path' => project_path(project),
'tags-path' => project_tags_path(project),
'has-metrics' => "#{environment.has_metrics?}",
'prometheus-status' => "#{environment.prometheus_status}",
'external-dashboard-url' => nil
)
end
......
......@@ -727,6 +727,51 @@ describe Environment, :use_clean_rails_memory_store_caching do
end
end
describe '#prometheus_status' do
context 'when a cluster is present' do
context 'when a deployment platform is present' do
let(:cluster) { create(:cluster, :provided_by_user, :project) }
let(:environment) { create(:environment, project: cluster.project) }
subject { environment.prometheus_status }
context 'when the prometheus application status is :updating' do
let!(:prometheus) { create(:clusters_applications_prometheus, :updating, cluster: cluster) }
it { is_expected.to eq(:updating) }
end
context 'when the prometheus application state is :updated' do
let!(:prometheus) { create(:clusters_applications_prometheus, :updated, cluster: cluster) }
it { is_expected.to eq(:updated) }
end
context 'when the prometheus application is not installed' do
it { is_expected.to be_nil }
end
end
context 'when a deployment platform is not present' do
let(:cluster) { create(:cluster, :project) }
let(:environment) { create(:environment, project: cluster.project) }
subject { environment.prometheus_status }
it { is_expected.to be_nil }
end
end
context 'when a cluster is not present' do
let(:project) { create(:project, :stubbed_repository) }
let(:environment) { create(:environment, project: project) }
subject { environment.prometheus_status }
it { is_expected.to be_nil }
end
end
describe '#additional_metrics' do
let(:project) { create(:prometheus_project) }
let(:metric_params) { [] }
......
......@@ -35,7 +35,7 @@ describe Issues::ZoomLinkService do
describe '#add_link' do
shared_examples 'can add meeting' do
it 'appends the link to issue description' do
it 'appends the link zoom_meetings' do
expect(result).to be_success
expect(result.payload[:zoom_meetings].map(&:url))
.to include(zoom_link)
......@@ -46,6 +46,12 @@ describe Issues::ZoomLinkService do
.with('IncidentManagement::ZoomIntegration', 'add_zoom_meeting', label: 'Issue ID', value: issue.id)
result
end
it 'tracks the add event' do
expect(Gitlab::Tracking).to receive(:event)
.with('IncidentManagement::ZoomIntegration', 'add_zoom_meeting', label: 'Issue ID', value: issue.id)
result
end
end
shared_examples 'cannot add meeting' do
......@@ -122,13 +128,12 @@ describe Issues::ZoomLinkService do
context 'removes the link' do
include_examples 'can remove meeting'
end
it 'tracks the remove event' do
expect(Gitlab::Tracking).to receive(:event)
it 'tracks the remove event' do
expect(Gitlab::Tracking).to receive(:event)
.with('IncidentManagement::ZoomIntegration', 'remove_zoom_meeting', label: 'Issue ID', value: issue.id)
result
result
end
end
context 'with insufficient permissions' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment