diff options
author | Robert Speicher <robert@gitlab.com> | 2017-01-13 21:10:16 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-01-13 21:10:16 +0000 |
commit | 77756efc22af33dd1cdb16671e39192d5761eaf6 (patch) | |
tree | 5ac74e671f31fbc7c1b6e20831bfeedda48e7771 /app | |
parent | e8538f7a42f63996cadfb124e9947c862cd86cb2 (diff) | |
parent | 0bc48797c8559a1f9c042b74e2faadc820fc7257 (diff) | |
download | gitlab-ce-77756efc22af33dd1cdb16671e39192d5761eaf6.tar.gz |
Merge branch 'fix-build-sort-order' into 'master'
Resolve "Sort order for pipeline build lists doesn't properly handle numbers"
Closes #25428
See merge request !8277
Diffstat (limited to 'app')
-rw-r--r-- | app/models/commit_status.rb | 6 | ||||
-rw-r--r-- | app/views/projects/stage/_graph.html.haml | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 31cd381dcd2..9547c57b2ae 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -137,4 +137,10 @@ class CommitStatus < ActiveRecord::Base .new(self, current_user) .fabricate! end + + def sortable_name + name.split(/(\d+)/).map do |v| + v =~ /\d+/ ? v.to_i : v + end + end end diff --git a/app/views/projects/stage/_graph.html.haml b/app/views/projects/stage/_graph.html.haml index d9d392fa02f..4ee30b023ac 100644 --- a/app/views/projects/stage/_graph.html.haml +++ b/app/views/projects/stage/_graph.html.haml @@ -1,6 +1,6 @@ - stage = local_assigns.fetch(:stage) - statuses = stage.statuses.latest -- status_groups = statuses.sort_by(&:name).group_by(&:group_name) +- status_groups = statuses.sort_by(&:sortable_name).group_by(&:group_name) %li.stage-column .stage-name %a{ name: stage.name } |