Commit 5b97b793 authored by Mike Greiling's avatar Mike Greiling

do not display CI limit warnings when user cannot start pipelines anyway

parent 90741eea
......@@ -4,7 +4,7 @@
- if current_user && can?(current_user, :download_code, @project)
= render 'shared/no_ssh'
= render 'shared/no_password'
= render 'shared/shared_runner_minutes_limit', namespace: @project.namespace
= render 'shared/shared_runner_minutes_limit', project: @project
= render "home_panel"
......
......@@ -8,7 +8,7 @@
- if current_user && can?(current_user, :download_code, @project)
= render 'shared/no_ssh'
= render 'shared/no_password'
= render 'shared/shared_runner_minutes_limit', namespace: @project.namespace
= render 'shared/shared_runner_minutes_limit', project: @project
- if @project.above_size_limit?
= render 'above_size_limit_warning'
......
- if cookies[:hide_shared_runner_quota_message].blank? && namespace.shared_runners_minutes_used?
- project = local_assigns.fetch(:project, nil)
- namespace = local_assigns.fetch(:namespace, project && project.namespace)
- can_see_status = project.nil? || can?(current_user, :create_pipeline, project)
- if cookies[:hide_shared_runner_quota_message].blank? && namespace.shared_runners_minutes_used? && can_see_status
.shared-runner-quota-message.alert.alert-warning.hidden-xs
- if namespace.class.to_s === 'Group'
Your group has exceeded its build minutes quota.
- else
You have exceeded your build minutes quota.
Pipelines will not run anymore on shared runners.
= namespace.name
has exceeded their build minutes quota. Pipelines will not run anymore on shared runners.
.pull-right
= link_to "Don't show again this month", '#', class: 'hide-shared-runner-limit-message-one-month alert-link'
......
......@@ -2,15 +2,14 @@ require 'spec_helper'
feature 'CI shared runner limits', feature: true do
let(:user) { create(:user) }
let(:project) { create(:project, :public, namespace: namespace, shared_runners_enabled: true) }
let(:namespace) { create(:namespace) }
before do
login_as(user)
end
context 'with project' do
let(:project) { create(:project, namespace: namespace, shared_runners_enabled: true) }
let(:namespace) { create(:namespace) }
context 'when project member' do
before do
project.team << [user, :developer]
end
......@@ -28,7 +27,7 @@ feature 'CI shared runner limits', feature: true do
scenario 'it displays a warning message on project homepage' do
visit namespace_project_path(project.namespace, project)
expect_quota_exceeded_alert('You have exceeded your build minutes quota.')
expect_quota_exceeded_alert("#{namespace.name} has exceeded their build minutes quota.")
end
end
......@@ -52,6 +51,17 @@ feature 'CI shared runner limits', feature: true do
end
end
context 'when not a project member' do
let(:namespace) { create(:namespace, :with_used_build_minutes_limit) }
context 'when limit is defined and limit is exceeded' do
scenario 'it does not display a warning message on project homepage' do
visit namespace_project_path(project.namespace, project)
expect_no_quota_exceeded_alert
end
end
end
def expect_quota_exceeded_alert(message = nil)
expect(page).to have_selector('.shared-runner-quota-message', count: 1)
expect(page.find('.shared-runner-quota-message')).to have_content(message) unless message.nil?
......
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