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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
b80f819b
Commit
b80f819b
authored
Jun 28, 2018
by
Tiago Botelho
Committed by
Jose
Jul 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves the request of the environments list to the index action
parent
95954a60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
17 deletions
+6
-17
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+5
-17
app/views/projects/environments/metrics.html.haml
app/views/projects/environments/metrics.html.haml
+1
-0
No files found.
app/controllers/projects/environments_controller.rb
View file @
b80f819b
...
...
@@ -6,11 +6,13 @@ class Projects::EnvironmentsController < Projects::ApplicationController
before_action
:authorize_update_environment!
,
only:
[
:edit
,
:update
]
before_action
:authorize_admin_environment!
,
only:
[
:terminal
,
:terminal_websocket_authorize
]
before_action
:environment
,
only:
[
:show
,
:edit
,
:update
,
:stop
,
:terminal
,
:terminal_websocket_authorize
,
:metrics
]
before_action
:environments
,
only:
[
:index
]
before_action
:verify_api_request!
,
only: :terminal_websocket_authorize
before_action
:expire_etag_cache
,
only:
[
:index
]
def
index
@environments
=
project
.
environments
.
with_state
(
params
[
:scope
]
||
:available
)
respond_to
do
|
format
|
format
.
html
format
.
json
do
...
...
@@ -126,12 +128,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
json
do
render
json:
{
metrics:
@metrics
,
environments:
EnvironmentSerializer
.
new
(
project:
project
,
current_user:
current_user
)
.
represent
(
environments
)
},
status:
@metrics
.
any?
?
:ok
:
:no_content
render
json:
@metrics
,
status:
@metrics
.
any?
?
:ok
:
:no_content
end
end
end
...
...
@@ -141,12 +138,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
format
.
json
do
additional_metrics
=
environment
.
additional_metrics
||
{}
render
json:
{
additional_metrics:
additional_metrics
,
environments:
EnvironmentSerializer
.
new
(
project:
project
,
current_user:
current_user
)
.
represent
(
environments
)
},
status:
additional_metrics
.
empty?
?
:ok
:
:no_content
render
json:
additional_metrics
,
status:
additional_metrics
.
any?
?
:ok
:
:no_content
end
end
end
...
...
@@ -173,8 +165,4 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def
environment
@environment
||=
project
.
environments
.
find
(
params
[
:id
])
end
def
environments
@environments
||=
project
.
environments
.
with_state
(
params
[
:scope
]
||
:available
)
end
end
app/views/projects/environments/metrics.html.haml
View file @
b80f819b
...
...
@@ -11,6 +11,7 @@
"empty-unable-to-connect-svg-path"
:
image_path
(
'illustrations/monitoring/unable_to_connect.svg'
),
"metrics-endpoint"
:
additional_metrics_project_environment_path
(
@project
,
@environment
,
format: :json
),
"deployment-endpoint"
:
project_environment_deployments_path
(
@project
,
@environment
,
format: :json
),
"environments"
:
project_environments_path
(
@project
,
format: :json
),
"project-path"
:
project_path
(
@project
),
"tags-path"
:
project_tags_path
(
@project
),
"has-metrics"
:
"#{@environment.has_metrics?}"
}
}
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