From dd4f50b1874ac066c7e47be223e98d8a9b317fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Mon, 18 Jul 2016 16:44:10 +0200 Subject: Fix build duration when build is not finished yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- app/helpers/time_helper.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/time_helper.rb b/app/helpers/time_helper.rb index 8cb82c2d5cc..1926f03af07 100644 --- a/app/helpers/time_helper.rb +++ b/app/helpers/time_helper.rb @@ -1,14 +1,4 @@ module TimeHelper - def duration_in_words(finished_at, started_at) - if finished_at && started_at - interval_in_seconds = finished_at.to_i - started_at.to_i - elsif started_at - interval_in_seconds = Time.now.to_i - started_at.to_i - end - - time_interval_in_words(interval_in_seconds) - end - def time_interval_in_words(interval_in_seconds) minutes = interval_in_seconds / 60 seconds = interval_in_seconds - minutes * 60 @@ -25,9 +15,19 @@ module TimeHelper end def duration_in_numbers(finished_at, started_at) - diff_in_seconds = finished_at.to_i - started_at.to_i - time_format = diff_in_seconds < 1.hour ? "%M:%S" : "%H:%M:%S" + interval = interval_in_seconds(started_at, finished_at) + time_format = interval < 1.hour ? "%M:%S" : "%H:%M:%S" - Time.at(diff_in_seconds).utc.strftime(time_format) + Time.at(interval).utc.strftime(time_format) + end + + private + + def interval_in_seconds(started_at, finished_at = nil) + if started_at && finished_at + finished_at.to_i - started_at.to_i + elsif started_at + Time.now.to_i - started_at.to_i + end end end -- cgit v1.2.3 From da55496b6fc3ef1c65c4369cabb89b874dbc79e6 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Fri, 15 Jul 2016 10:26:15 -0500 Subject: Add new running icon; add a bunch of styles to get svg to match existing fa icons --- app/helpers/ci_status_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index e6c99c9959e..5219a0ff47b 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -32,12 +32,12 @@ module CiStatusHelper when 'pending' 'clock-o' when 'running' - 'spinner' + 'icon_running' else 'circle' end - icon(icon_name + ' fw') + status == 'running' ? custom_icon(icon_name) : icon(icon_name + ' fw') end def render_commit_status(commit, tooltip_placement: 'auto left', cssclass: '') -- cgit v1.2.3 From 0301fa8d9c67623c3311eab64d174123bba4b943 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Date: Tue, 19 Jul 2016 06:47:26 -0700 Subject: Add new icons for every CI status --- app/helpers/ci_status_helper.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 5219a0ff47b..59a8365d60b 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -26,18 +26,20 @@ module CiStatusHelper icon_name = case status when 'success' - 'check' + 'icon_status_success' + when 'success_with_warnings' + 'icon_status_warning' when 'failed' - 'close' + 'icon_status_failed' when 'pending' - 'clock-o' + 'icon_status_pending' when 'running' - 'icon_running' + 'icon_status_running' else - 'circle' + 'icon_status_cancel' end - status == 'running' ? custom_icon(icon_name) : icon(icon_name + ' fw') + custom_icon(icon_name) end def render_commit_status(commit, tooltip_placement: 'auto left', cssclass: '') -- cgit v1.2.3