Commit 3fad597e authored by Jose Ivan Vargas's avatar Jose Ivan Vargas Committed by Mike Greiling

Resolve "No longer require a deploy to start Prometheus monitoring" - EE

parent edd6fc97
......@@ -175,6 +175,7 @@ export default {
this.state = 'noData';
return;
}
this.showEmptyState = false;
})
.then(this.resize)
......@@ -216,7 +217,10 @@ export default {
name="chevron-down"
/>
</button>
<div class="dropdown-menu dropdown-menu-selectable dropdown-menu-drop-up">
<div
v-if="store.environmentsData.length > 0"
class="dropdown-menu dropdown-menu-selectable dropdown-menu-drop-up"
>
<ul>
<li
v-for="environment in store.environmentsData"
......
......@@ -155,7 +155,7 @@ class Environment < ActiveRecord::Base
end
def has_metrics?
prometheus_adapter&.can_query? && available? && last_deployment.present?
prometheus_adapter&.can_query? && available?
end
def metrics
......
---
title: No longer require a deploy to start Prometheus monitoring
merge_request: 22401
author:
type: changed
......@@ -113,6 +113,22 @@ describe('Dashboard', () => {
});
});
it('hides the dropdown list when there is no environments', done => {
const component = new DashboardComponent({
el: document.querySelector('.prometheus-graphs'),
propsData: { ...propsData, hasMetrics: true, showPanels: false },
});
component.store.storeEnvironmentsData([]);
setTimeout(() => {
const dropdownMenuEnvironments = component.$el.querySelectorAll('.dropdown-menu ul');
expect(dropdownMenuEnvironments.length).toEqual(0);
done();
});
});
it('renders the dropdown with a single is-active element', done => {
const component = new DashboardComponent({
el: document.querySelector('.prometheus-graphs'),
......
......@@ -334,7 +334,7 @@ describe Environment do
describe '#has_terminals?' do
subject { environment.has_terminals? }
context 'when the enviroment is available' do
context 'when the environment is available' do
context 'with a deployment service' do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
context 'and a deployment' do
......@@ -492,7 +492,7 @@ describe Environment do
describe '#has_metrics?' do
subject { environment.has_metrics? }
context 'when the enviroment is available' do
context 'when the environment is available' do
context 'with a deployment service' do
let(:project) { create(:prometheus_project) }
......@@ -501,8 +501,8 @@ describe Environment do
it { is_expected.to be_truthy }
end
context 'but no deployments' do
it { is_expected.to be_falsy }
context 'and no deployments' do
it { is_expected.to be_truthy }
end
end
......@@ -549,39 +549,6 @@ describe Environment do
end
end
describe '#has_metrics?' do
subject { environment.has_metrics? }
context 'when the enviroment is available' do
context 'with a deployment service' do
let(:project) { create(:prometheus_project) }
context 'and a deployment' do
let!(:deployment) { create(:deployment, environment: environment) }
it { is_expected.to be_truthy }
end
context 'but no deployments' do
it { is_expected.to be_falsy }
end
end
context 'without a monitoring service' do
it { is_expected.to be_falsy }
end
end
context 'when the environment is unavailable' do
let(:project) { create(:prometheus_project) }
before do
environment.stop
end
it { is_expected.to be_falsy }
end
end
describe '#additional_metrics' do
let(:project) { create(:prometheus_project) }
subject { environment.additional_metrics }
......
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