Sort environments folders when opening them
Fixes gitlab-org/gitlab-ce#30814
This commit is contained in:
parent
6a2bcb4b2a
commit
0385f9efc2
3 changed files with 10 additions and 0 deletions
|
@ -31,6 +31,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
|
|||
def folder
|
||||
folder_environments = project.environments.where(environment_type: params[:id])
|
||||
@environments = folder_environments.with_state(params[:scope] || :available)
|
||||
.order(:name)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
4
changelogs/unreleased/zj-sort-env-folders.yml
Normal file
4
changelogs/unreleased/zj-sort-env-folders.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Sort folder for environments
|
||||
merge_request:
|
||||
author:
|
|
@ -84,6 +84,9 @@ describe Projects::EnvironmentsController do
|
|||
create(:environment, project: project,
|
||||
name: 'staging-1.0/review',
|
||||
state: :available)
|
||||
create(:environment, project: project,
|
||||
name: 'staging-1.0/preview',
|
||||
state: :available)
|
||||
end
|
||||
|
||||
context 'when using default format' do
|
||||
|
@ -107,6 +110,8 @@ describe Projects::EnvironmentsController do
|
|||
expect(response).to be_ok
|
||||
expect(response).not_to render_template 'folder'
|
||||
expect(json_response['environments'][0])
|
||||
.to include('name' => 'staging-1.0/preview')
|
||||
expect(json_response['environments'][1])
|
||||
.to include('name' => 'staging-1.0/review')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue