Skip to content

Commit db4b54f

Browse files
committed
Simplify all times shown to not use any words, just exact numbers
So everything is hardcoded to English and we don't need to set a locale or having mixed-language phrases all over the place.
1 parent 75f64ee commit db4b54f

File tree

19 files changed

+73
-88
lines changed

19 files changed

+73
-88
lines changed
Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
module MissionControl::Jobs::DatesHelper
2-
def time_ago_in_words_with_title(time)
3-
tag.span time_ago_in_words(time), title: time.to_fs(:long)
4-
end
5-
6-
def time_distance_in_words_with_title(time)
7-
tag.span distance_of_time_in_words_to_now(time, include_seconds: true), title: "Since #{time.to_fs(:long)}"
8-
end
9-
10-
def bidirectional_time_distance_in_words_with_title(time)
11-
time_distance = if time.past?
12-
"#{distance_of_time_in_words_to_now(time, include_seconds: true)} ago"
13-
else
14-
"in #{distance_of_time_in_words_to_now(time, include_seconds: true)}"
15-
end
16-
17-
tag.span time_distance, title: time.to_fs(:long)
2+
def formatted_time(time)
3+
time.strftime("%Y-%m-%d %H:%M:%S.%3N")
184
end
195
end

app/helpers/mission_control/jobs/jobs_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def attribute_names_for_job_status(status)
2929
when "blocked" then [ "Queue", "Blocked by", "Block expiry", "" ]
3030
when "finished" then [ "Queue", "Finished" ]
3131
when "scheduled" then [ "Queue", "Scheduled", "" ]
32-
when "in_progress" then [ "Queue", "Run by", "Running for" ]
32+
when "in_progress" then [ "Queue", "Run by", "Running since" ]
3333
else []
3434
end
3535
end

app/views/mission_control/jobs/jobs/_general_information.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@
2323
<tr>
2424
<th>Enqueued</th>
2525
<td>
26-
<%= time_ago_in_words_with_title(job.enqueued_at.to_datetime) %> ago
26+
<%= formatted_time(job.enqueued_at.to_datetime) %>
2727
</td>
2828
</tr>
2929
<% if job.failed? %>
3030
<tr>
3131
<th>Failed</th>
3232
<td>
33-
<%= time_ago_in_words_with_title(job.failed_at) %> ago
33+
<%= formatted_time(job.failed_at) %>
3434
</td>
3535
</tr>
3636
<% end %>
3737
<% if job.finished_at.present? %>
3838
<tr>
3939
<th>Finished at</th>
4040
<td>
41-
<%= time_ago_in_words_with_title(job.finished_at) %> ago
41+
<%= formatted_time(job.finished_at) %>
4242
</td>
4343
</tr>
4444
<% end %>

app/views/mission_control/jobs/jobs/_job.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="is-family-monospace"><%= job_arguments(job) %></div>
77
<% end %>
88

9-
<div class="has-text-grey is-size-7">Enqueued <%= time_ago_in_words_with_title(job.enqueued_at.to_datetime) %> ago</div>
9+
<div class="has-text-grey is-size-7">Enqueued <%= formatted_time(job.enqueued_at.to_datetime) %></div>
1010
</td>
1111

1212
<%= render "mission_control/jobs/jobs/#{jobs_status}/job", job: job %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<td><%= link_to job.queue_name, application_queue_path(@application, job.queue) %></td>
22
<td><div class="is-family-monospace is-size-7"><%= job.blocked_by %></div></td>
3-
<td><%= bidirectional_time_distance_in_words_with_title(job.blocked_until) %></td>
3+
<td><%= formatted_time(job.blocked_until) %></td>
44
<td class="pr-0">
55
<%= render "mission_control/jobs/jobs/blocked/actions", job: job %>
66
</td>

app/views/mission_control/jobs/jobs/failed/_job.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<td>
22
<%= link_to failed_job_error(job), application_job_path(@application, job.job_id, anchor: "error") %>
3-
<div class="has-text-grey"><%= time_ago_in_words_with_title(job.failed_at) %> ago</div>
3+
<div class="has-text-grey"><%= formatted_time(job.failed_at) %></div>
44
</td>
55
<td class="pr-0">
66
<%= render "mission_control/jobs/jobs/failed/actions", job: job %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<td><%= link_to job.queue_name, application_queue_path(@application, job.queue) %></td>
2-
<td><div class="has-text-grey"><%= time_ago_in_words_with_title(job.finished_at) %> ago</div></td>
2+
<td><div class="has-text-grey"><%= formatted_time(job.finished_at) %></div></td>

app/views/mission_control/jobs/jobs/in_progress/_job.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
77
<% end %>
88
</td>
9-
<td><div class="has-text-grey"><%= job.started_at ? time_distance_in_words_with_title(job.started_at) : "(Finished)" %></div></td>
9+
<td><div class="has-text-grey"><%= job.started_at ? formatted_time(job.started_at) : "(Finished)" %></div></td>

app/views/mission_control/jobs/jobs/scheduled/_job.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<td><%= link_to job.queue_name, application_queue_path(@application, job.queue) %></td>
22
<td>
3-
<%= bidirectional_time_distance_in_words_with_title(job.scheduled_at) %>
3+
<%= formatted_time(job.scheduled_at) %>
44
<% if job_delayed?(job) %>
55
<div class="is-danger tag ml-4">delayed</div>
66
<% end %>

app/views/mission_control/jobs/queues/_job.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%= link_to application_job_path(@application, job.job_id, filter: { queue_name: job.queue }) do %>
44
<%= job_title(job) %>
55
<% end %>
6-
<div class="has-text-grey">Enqueued <%= time_ago_in_words_with_title(job.enqueued_at.to_datetime) %> ago</div>
6+
<div class="has-text-grey">Enqueued on <%= formatted_time(job.enqueued_at.to_datetime) %></div>
77
</td>
88
<td>
99
<% if job.serialized_arguments.present? %>

0 commit comments

Comments
 (0)