Commit ddabac46 authored by Matija Čupić's avatar Matija Čupić

Move action button titles to respective statuses

parent 490d1869
......@@ -6,4 +6,4 @@
illustration_size: illustration[:size],
title: illustration[:title],
content: illustration[:content],
action: illustration[:action_path] ? link_to(_("Trigger this manual action"), illustration[:action_path], method: illustration[:action_method], class: 'btn btn-primary', title: _("Trigger this manual action")) : nil
action: detailed_status.has_action? ? link_to(detailed_status.action_button_title, detailed_status.action_path, method: detailed_status.action_method, class: 'btn btn-primary', title: detailed_status.action_button_title) : nil
......@@ -23,6 +23,10 @@ module Gitlab
'Cancel'
end
def action_button_title
_('Cancel this job')
end
def self.matches?(build, user)
build.cancelable?
end
......
......@@ -8,9 +8,7 @@ module Gitlab
image: 'illustrations/manual_action.svg',
size: 'svg-394',
title: _('This job requires a manual action'),
content: _('This job depends on a user to trigger its process. Often they are used to deploy code to production environments'),
action_path: play_project_job_path(subject.project, subject),
action_method: :post
content: _('This job depends on a user to trigger its process. Often they are used to deploy code to production environments')
}
end
......
......@@ -19,6 +19,10 @@ module Gitlab
'Play'
end
def action_button_title
_('Trigger this manual action')
end
def action_path
play_project_job_path(subject.project, subject)
end
......
......@@ -15,6 +15,10 @@ module Gitlab
'Retry'
end
def action_button_title
_('Retry this job')
end
def action_path
retry_project_job_path(subject.project, subject)
end
......
......@@ -19,6 +19,10 @@ module Gitlab
'Stop'
end
def action_button_title
_('Stop this environment')
end
def action_path
play_project_job_path(subject.project, subject)
end
......
......@@ -72,6 +72,10 @@ describe Gitlab::Ci::Status::Build::Cancelable do
describe '#action_title' do
it { expect(subject.action_title).to eq 'Cancel' }
end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Cancel this job' }
end
end
describe '.matches?' do
......
......@@ -8,6 +8,6 @@ describe Gitlab::Ci::Status::Build::Manual do
end
describe '#illustration' do
it { expect(subject.illustration).to include(:image, :size, :title, :content, :action_path, :action_method) }
it { expect(subject.illustration).to include(:image, :size, :title, :content) }
end
end
......@@ -53,6 +53,10 @@ describe Gitlab::Ci::Status::Build::Play do
it { expect(subject.action_title).to eq 'Play' }
end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Trigger this manual action' }
end
describe '.matches?' do
subject { described_class.matches?(build, user) }
......
......@@ -72,6 +72,10 @@ describe Gitlab::Ci::Status::Build::Retryable do
describe '#action_title' do
it { expect(subject.action_title).to eq 'Retry' }
end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Retry this job' }
end
end
describe '.matches?' do
......
......@@ -44,6 +44,10 @@ describe Gitlab::Ci::Status::Build::Stop do
describe '#action_title' do
it { expect(subject.action_title).to eq 'Stop' }
end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Stop this environment' }
end
end
describe '.matches?' 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