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
Léo-Paul Géneau
gitlab-ce
Commits
55943872
Commit
55943872
authored
Jun 21, 2018
by
Tiago Botelho
Committed by
Jose
Jun 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds empty environments page
parent
3c49bcb6
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
7 deletions
+18
-7
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+3
-3
app/controllers/projects/environments_controller.rb
app/controllers/projects/environments_controller.rb
+4
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/helpers/environments_helper.rb
app/helpers/environments_helper.rb
+2
-2
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+1
-1
app/views/projects/environments/empty.html.haml
app/views/projects/environments/empty.html.haml
+6
-0
config/routes/project.rb
config/routes/project.rb
+1
-0
No files found.
app/controllers/projects/application_controller.rb
View file @
55943872
...
@@ -5,7 +5,7 @@ class Projects::ApplicationController < ApplicationController
...
@@ -5,7 +5,7 @@ class Projects::ApplicationController < ApplicationController
skip_before_action
:authenticate_user!
skip_before_action
:authenticate_user!
before_action
:project
before_action
:project
before_action
:repository
before_action
:repository
before_action
:environment
before_action
:
available_
environment
layout
'project'
layout
'project'
helper_method
:repository
,
:can_collaborate_with_project?
,
:user_access
helper_method
:repository
,
:can_collaborate_with_project?
,
:user_access
...
@@ -33,8 +33,8 @@ class Projects::ApplicationController < ApplicationController
...
@@ -33,8 +33,8 @@ class Projects::ApplicationController < ApplicationController
@repository
||=
project
.
repository
@repository
||=
project
.
repository
end
end
def
environment
def
available_
environment
@
environment
||=
project
.
environments
.
first
@
available_environment
||=
project
.
environments
.
with_state
(
:available
)
.
first
end
end
def
authorize_action!
(
action
)
def
authorize_action!
(
action
)
...
...
app/controllers/projects/environments_controller.rb
View file @
55943872
...
@@ -31,6 +31,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController
...
@@ -31,6 +31,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
end
end
end
def
empty
render
:empty
end
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
)
...
...
app/controllers/projects_controller.rb
View file @
55943872
...
@@ -8,7 +8,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -8,7 +8,7 @@ class ProjectsController < Projects::ApplicationController
before_action
:redirect_git_extension
,
only:
[
:show
]
before_action
:redirect_git_extension
,
only:
[
:show
]
before_action
:project
,
except:
[
:index
,
:new
,
:create
]
before_action
:project
,
except:
[
:index
,
:new
,
:create
]
before_action
:repository
,
except:
[
:index
,
:new
,
:create
]
before_action
:repository
,
except:
[
:index
,
:new
,
:create
]
before_action
:environment
,
except:
[
:index
,
:new
,
:create
]
before_action
:
available_
environment
,
except:
[
:index
,
:new
,
:create
]
before_action
:assign_ref_vars
,
only:
[
:show
],
if: :repo_exists?
before_action
:assign_ref_vars
,
only:
[
:show
],
if: :repo_exists?
before_action
:tree
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:tree
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:lfs_blob_ids
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
before_action
:lfs_blob_ids
,
only:
[
:show
],
if:
[
:repo_exists?
,
:project_view_files?
]
...
...
app/helpers/environments_helper.rb
View file @
55943872
...
@@ -6,8 +6,8 @@ module EnvironmentsHelper
...
@@ -6,8 +6,8 @@ module EnvironmentsHelper
end
end
def
metrics_path
(
project
,
environment
)
def
metrics_path
(
project
,
environment
)
metrics_project_environment_path
(
project
,
environment
)
if
environment
return
metrics_project_environment_path
(
project
,
environment
)
if
environment
project_environments_path
(
project
)
empty_
project_environments_path
(
project
)
end
end
end
end
app/views/layouts/nav/sidebar/_project.html.haml
View file @
55943872
...
@@ -211,7 +211,7 @@
...
@@ -211,7 +211,7 @@
-
if
project_nav_tab?
:environments
-
if
project_nav_tab?
:environments
=
nav_link
(
controller:
[
:environments
,
:metrics
])
do
=
nav_link
(
controller:
[
:environments
,
:metrics
])
do
=
link_to
metrics_path
(
@project
,
@environment
),
title:
'Metrics'
,
class:
'shortcuts-environments'
do
=
link_to
metrics_path
(
@project
,
@
available_
environment
),
title:
'Metrics'
,
class:
'shortcuts-environments'
do
%span
%span
=
_
(
'Metrics'
)
=
_
(
'Metrics'
)
...
...
app/views/projects/environments/empty.html.haml
0 → 100644
View file @
55943872
-
page_title
"Metrics"
%h1
No environments were found
=
link_to
"New Environment"
,
new_project_environment_path
(
@project
)
config/routes/project.rb
View file @
55943872
...
@@ -235,6 +235,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
...
@@ -235,6 +235,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
collection
do
collection
do
get
:empty
get
:folder
,
path:
'folders/*id'
,
constraints:
{
format:
/(html|json)/
}
get
:folder
,
path:
'folders/*id'
,
constraints:
{
format:
/(html|json)/
}
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