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

Move action button titles to respective statuses

parent 490d1869
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
illustration_size: illustration[:size], illustration_size: illustration[:size],
title: illustration[:title], title: illustration[:title],
content: illustration[:content], 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 ...@@ -23,6 +23,10 @@ module Gitlab
'Cancel' 'Cancel'
end end
def action_button_title
_('Cancel this job')
end
def self.matches?(build, user) def self.matches?(build, user)
build.cancelable? build.cancelable?
end end
......
...@@ -8,9 +8,7 @@ module Gitlab ...@@ -8,9 +8,7 @@ module Gitlab
image: 'illustrations/manual_action.svg', image: 'illustrations/manual_action.svg',
size: 'svg-394', size: 'svg-394',
title: _('This job requires a manual action'), 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'), 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
} }
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
'Play' 'Play'
end end
def action_button_title
_('Trigger this manual action')
end
def action_path def action_path
play_project_job_path(subject.project, subject) play_project_job_path(subject.project, subject)
end end
......
...@@ -15,6 +15,10 @@ module Gitlab ...@@ -15,6 +15,10 @@ module Gitlab
'Retry' 'Retry'
end end
def action_button_title
_('Retry this job')
end
def action_path def action_path
retry_project_job_path(subject.project, subject) retry_project_job_path(subject.project, subject)
end end
......
...@@ -19,6 +19,10 @@ module Gitlab ...@@ -19,6 +19,10 @@ module Gitlab
'Stop' 'Stop'
end end
def action_button_title
_('Stop this environment')
end
def action_path def action_path
play_project_job_path(subject.project, subject) play_project_job_path(subject.project, subject)
end end
......
...@@ -72,6 +72,10 @@ describe Gitlab::Ci::Status::Build::Cancelable do ...@@ -72,6 +72,10 @@ describe Gitlab::Ci::Status::Build::Cancelable do
describe '#action_title' do describe '#action_title' do
it { expect(subject.action_title).to eq 'Cancel' } it { expect(subject.action_title).to eq 'Cancel' }
end end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Cancel this job' }
end
end end
describe '.matches?' do describe '.matches?' do
......
...@@ -8,6 +8,6 @@ describe Gitlab::Ci::Status::Build::Manual do ...@@ -8,6 +8,6 @@ describe Gitlab::Ci::Status::Build::Manual do
end end
describe '#illustration' do 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
end end
...@@ -53,6 +53,10 @@ describe Gitlab::Ci::Status::Build::Play do ...@@ -53,6 +53,10 @@ describe Gitlab::Ci::Status::Build::Play do
it { expect(subject.action_title).to eq 'Play' } it { expect(subject.action_title).to eq 'Play' }
end end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Trigger this manual action' }
end
describe '.matches?' do describe '.matches?' do
subject { described_class.matches?(build, user) } subject { described_class.matches?(build, user) }
......
...@@ -72,6 +72,10 @@ describe Gitlab::Ci::Status::Build::Retryable do ...@@ -72,6 +72,10 @@ describe Gitlab::Ci::Status::Build::Retryable do
describe '#action_title' do describe '#action_title' do
it { expect(subject.action_title).to eq 'Retry' } it { expect(subject.action_title).to eq 'Retry' }
end end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Retry this job' }
end
end end
describe '.matches?' do describe '.matches?' do
......
...@@ -44,6 +44,10 @@ describe Gitlab::Ci::Status::Build::Stop do ...@@ -44,6 +44,10 @@ describe Gitlab::Ci::Status::Build::Stop do
describe '#action_title' do describe '#action_title' do
it { expect(subject.action_title).to eq 'Stop' } it { expect(subject.action_title).to eq 'Stop' }
end end
describe '#action_button_title' do
it { expect(subject.action_button_title).to eq 'Stop this environment' }
end
end end
describe '.matches?' do 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