BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
35ab669a
Commit
35ab669a
authored
May 23, 2017
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zj-sort-env-folders' into 'master'
Sort environments folders when opening them Closes #30814 See merge request !11436
parents
d7157746
5c83d3af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
environments_controller.rb
app/controllers/projects/environments_controller.rb
+1
-0
zj-sort-env-folders.yml
changelogs/unreleased/zj-sort-env-folders.yml
+4
-0
environments_controller_spec.rb
spec/controllers/projects/environments_controller_spec.rb
+12
-7
No files found.
app/controllers/projects/environments_controller.rb
View file @
35ab669a
...
...
@@ -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
...
...
changelogs/unreleased/zj-sort-env-folders.yml
0 → 100644
View file @
35ab669a
---
title
:
Sort folder for environments
merge_request
:
author
:
spec/controllers/projects/environments_controller_spec.rb
View file @
35ab669a
require
'spec_helper'
describe
Projects
::
EnvironmentsController
do
l
et
(
:user
)
{
create
(
:user
)
}
l
et
(
:project
)
{
create
(
:empty_project
)
}
s
et
(
:user
)
{
create
(
:user
)
}
s
et
(
:project
)
{
create
(
:empty_project
)
}
l
et
(
:environment
)
do
s
et
(
:environment
)
do
create
(
:environment
,
name:
'production'
,
project:
project
)
end
before
do
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
sign_in
(
user
)
end
describe
'GET index'
do
context
'when
standardrequest has been
made'
do
context
'when
a request for the HTML is
made'
do
it
'responds with status code 200'
do
get
:index
,
environment_params
expect
(
response
).
to
be_ok
expect
(
response
).
to
have_http_status
(
:ok
)
end
end
...
...
@@ -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/zzz'
,
state: :available
)
end
context
'when using default format'
do
...
...
@@ -98,7 +101,7 @@ describe Projects::EnvironmentsController do
end
context
'when using JSON format'
do
it
'
responds with JSON
'
do
it
'
sorts the subfolders lexicographically
'
do
get
:folder
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
'staging-1.0'
,
...
...
@@ -108,6 +111,8 @@ describe Projects::EnvironmentsController do
expect
(
response
).
not_to
render_template
'folder'
expect
(
json_response
[
'environments'
][
0
])
.
to
include
(
'name'
=>
'staging-1.0/review'
)
expect
(
json_response
[
'environments'
][
1
])
.
to
include
(
'name'
=>
'staging-1.0/zzz'
)
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