diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-10-26 10:29:45 +0200 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2018-11-07 10:00:25 +0100 |
commit | 390abbf054e82cfc51707ec3e2f68017d22ac75d (patch) | |
tree | bd1ba017a4e9ab4a0dd68786c37f8b32626073c1 | |
parent | d0c58a97c8a053c0beec7c13c1c6ec5042120ef1 (diff) | |
download | gitlab-ce-390abbf054e82cfc51707ec3e2f68017d22ac75d.tar.gz |
Add placeholder for remaining time in delayed job tooltips
-rw-r--r-- | lib/gitlab/ci/status/build/scheduled.rb | 13 | ||||
-rw-r--r-- | locale/gitlab.pot | 2 | ||||
-rw-r--r-- | spec/features/projects/jobs_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/status/build/scheduled_spec.rb | 20 |
4 files changed, 7 insertions, 30 deletions
diff --git a/lib/gitlab/ci/status/build/scheduled.rb b/lib/gitlab/ci/status/build/scheduled.rb index f443dbee120..b3452eae189 100644 --- a/lib/gitlab/ci/status/build/scheduled.rb +++ b/lib/gitlab/ci/status/build/scheduled.rb @@ -9,7 +9,7 @@ module Gitlab { image: 'illustrations/illustrations_scheduled-job_countdown.svg', size: 'svg-394', - title: _("This is a delayed to run in ") + " #{execute_in}", + title: _("This is a delayed job to run in %{remainingTime}"), content: _("This job will automatically run after it's timer finishes. " \ "Often they are used for incremental roll-out deploys " \ "to production environments. When unscheduled it converts " \ @@ -18,21 +18,12 @@ module Gitlab end def status_tooltip - "delayed manual action (#{execute_in})" + "delayed manual action (%{remainingTime})" end def self.matches?(build, user) build.scheduled? && build.scheduled_at end - - private - - include TimeHelper - - def execute_in - remaining_seconds = [0, subject.scheduled_at - Time.now].max - duration_in_numbers(remaining_seconds) - end end end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 3e35a5dbdf4..eac2f8ffdc9 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -6188,7 +6188,7 @@ msgstr "" msgid "This is a confidential issue." msgstr "" -msgid "This is a delayed to run in " +msgid "This is a delayed job to run in %{remainingTime}" msgstr "" msgid "This is the author's first Merge Request to this project." diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index cbb935abd53..a1323699969 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -595,7 +595,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do end it 'shows delayed job', :js do - expect(page).to have_content('This is a delayed to run in') + expect(page).to have_content('This is a delayed job to run in') expect(page).to have_content("This job will automatically run after it's timer finishes.") expect(page).to have_link('Unschedule job') end diff --git a/spec/lib/gitlab/ci/status/build/scheduled_spec.rb b/spec/lib/gitlab/ci/status/build/scheduled_spec.rb index 4a52b3ab8de..68b87fea75d 100644 --- a/spec/lib/gitlab/ci/status/build/scheduled_spec.rb +++ b/spec/lib/gitlab/ci/status/build/scheduled_spec.rb @@ -13,24 +13,10 @@ describe Gitlab::Ci::Status::Build::Scheduled do end describe '#status_tooltip' do - context 'when scheduled_at is not expired' do - let(:build) { create(:ci_build, scheduled_at: 1.minute.since, project: project) } - - it 'shows execute_in of the scheduled job' do - Timecop.freeze(Time.now.change(usec: 0)) do - expect(subject.status_tooltip).to include('00:01:00') - end - end - end - - context 'when scheduled_at is expired' do - let(:build) { create(:ci_build, :expired_scheduled, project: project) } + let(:build) { create(:ci_build, scheduled_at: 1.minute.since, project: project) } - it 'shows 00:00' do - Timecop.freeze do - expect(subject.status_tooltip).to include('00:00') - end - end + it 'has a placeholder for the remaining time' do + expect(subject.status_tooltip).to include('%{remainingTime}') end end |