Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0385f9ef
Commit
0385f9ef
authored
May 17, 2017
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort environments folders when opening them
Fixes gitlab-org/gitlab-ce#30814
parent
6a2bcb4b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+1
-0
changelogs/unreleased/zj-sort-env-folders.yml
changelogs/unreleased/zj-sort-env-folders.yml
+4
-0
spec/controllers/projects/environments_controller_spec.rb
spec/controllers/projects/environments_controller_spec.rb
+5
-0
No files found.
app/controllers/projects/environments_controller.rb
View file @
0385f9ef
...
@@ -31,6 +31,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
...
@@ -31,6 +31,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def
folder
def
folder
folder_environments
=
project
.
environments
.
where
(
environment_type:
params
[
:id
])
folder_environments
=
project
.
environments
.
where
(
environment_type:
params
[
:id
])
@environments
=
folder_environments
.
with_state
(
params
[
:scope
]
||
:available
)
@environments
=
folder_environments
.
with_state
(
params
[
:scope
]
||
:available
)
.
order
(
:name
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
...
changelogs/unreleased/zj-sort-env-folders.yml
0 → 100644
View file @
0385f9ef
---
title
:
Sort folder for environments
merge_request
:
author
:
spec/controllers/projects/environments_controller_spec.rb
View file @
0385f9ef
...
@@ -84,6 +84,9 @@ describe Projects::EnvironmentsController do
...
@@ -84,6 +84,9 @@ describe Projects::EnvironmentsController do
create
(
:environment
,
project:
project
,
create
(
:environment
,
project:
project
,
name:
'staging-1.0/review'
,
name:
'staging-1.0/review'
,
state: :available
)
state: :available
)
create
(
:environment
,
project:
project
,
name:
'staging-1.0/preview'
,
state: :available
)
end
end
context
'when using default format'
do
context
'when using default format'
do
...
@@ -107,6 +110,8 @@ describe Projects::EnvironmentsController do
...
@@ -107,6 +110,8 @@ describe Projects::EnvironmentsController do
expect
(
response
).
to
be_ok
expect
(
response
).
to
be_ok
expect
(
response
).
not_to
render_template
'folder'
expect
(
response
).
not_to
render_template
'folder'
expect
(
json_response
[
'environments'
][
0
])
expect
(
json_response
[
'environments'
][
0
])
.
to
include
(
'name'
=>
'staging-1.0/preview'
)
expect
(
json_response
[
'environments'
][
1
])
.
to
include
(
'name'
=>
'staging-1.0/review'
)
.
to
include
(
'name'
=>
'staging-1.0/review'
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment