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
41956773
Commit
41956773
authored
Mar 31, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize container repository controllers and views
parent
4726ff9d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
54 deletions
+75
-54
app/controllers/projects/container_registry_controller.rb
app/controllers/projects/container_registry_controller.rb
+0
-53
app/controllers/projects/registry/application_controller.rb
app/controllers/projects/registry/application_controller.rb
+10
-0
app/controllers/projects/registry/repositories_controller.rb
app/controllers/projects/registry/repositories_controller.rb
+54
-0
app/controllers/projects/registry/tags_controller.rb
app/controllers/projects/registry/tags_controller.rb
+7
-0
app/views/projects/registry/repositories/_image.html.haml
app/views/projects/registry/repositories/_image.html.haml
+0
-0
app/views/projects/registry/repositories/_tag.html.haml
app/views/projects/registry/repositories/_tag.html.haml
+0
-0
app/views/projects/registry/repositories/index.html.haml
app/views/projects/registry/repositories/index.html.haml
+0
-0
config/routes/project.rb
config/routes/project.rb
+4
-1
No files found.
app/controllers/projects/container_registry_controller.rb
deleted
100644 → 0
View file @
4726ff9d
class
Projects::ContainerRegistryController
<
Projects
::
ApplicationController
before_action
:verify_registry_enabled
before_action
:authorize_read_container_image!
before_action
:authorize_update_container_image!
,
only:
[
:destroy
]
layout
'project'
def
index
@images
=
project
.
container_repositories
end
def
destroy
if
tag
delete_tag
else
delete_image
end
end
private
def
registry_url
@registry_url
||=
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
end
def
verify_registry_enabled
render_404
unless
Gitlab
.
config
.
registry
.
enabled
end
def
delete_image
if
image
.
destroy
redirect_to
registry_url
else
redirect_to
registry_url
,
alert:
'Failed to remove image'
end
end
def
delete_tag
if
tag
.
delete
image
.
destroy
if
image
.
tags
.
empty?
redirect_to
registry_url
else
redirect_to
registry_url
,
alert:
'Failed to remove tag'
end
end
def
image
@image
||=
project
.
container_repositories
.
find_by
(
id:
params
[
:id
])
end
def
tag
@tag
||=
image
.
tag
(
params
[
:tag
])
if
params
[
:tag
].
present?
end
end
app/controllers/projects/registry/application_controller.rb
0 → 100644
View file @
41956773
module
Projects
module
Registry
class
ApplicationController
<
Projects
::
ApplicationController
layout
'project'
before_action
:verify_registry_enabled
before_action
:authorize_read_container_image!
end
end
end
app/controllers/projects/registry/repositories_controller.rb
0 → 100644
View file @
41956773
module
Projects
module
Registry
class
RepositoriesController
<
::
Projects
::
Registry
::
ApplicationController
before_action
:authorize_update_container_image!
,
only:
[
:destroy
]
def
index
@images
=
project
.
container_repositories
end
def
destroy
if
tag
delete_tag
else
delete_image
end
end
private
def
registry_url
@registry_url
||=
namespace_project_container_registry_index_path
(
project
.
namespace
,
project
)
end
def
verify_registry_enabled
render_404
unless
Gitlab
.
config
.
registry
.
enabled
end
def
delete_image
if
image
.
destroy
redirect_to
registry_url
else
redirect_to
registry_url
,
alert:
'Failed to remove image'
end
end
def
delete_tag
if
tag
.
delete
image
.
destroy
if
image
.
tags
.
empty?
redirect_to
registry_url
else
redirect_to
registry_url
,
alert:
'Failed to remove tag'
end
end
def
image
@image
||=
project
.
container_repositories
.
find_by
(
id:
params
[
:id
])
end
def
tag
@tag
||=
image
.
tag
(
params
[
:tag
])
if
params
[
:tag
].
present?
end
end
end
end
app/controllers/projects/registry/tags_controller.rb
0 → 100644
View file @
41956773
module
Projects
module
Registry
class
TagsController
<
::
Projects
::
Registry
::
ApplicationController
before_action
:authorize_update_container_image!
,
only:
[
:destroy
]
end
end
end
app/views/projects/
container_registry
/_image.html.haml
→
app/views/projects/
registry/repositories
/_image.html.haml
View file @
41956773
File moved
app/views/projects/
container_registry
/_tag.html.haml
→
app/views/projects/
registry/repositories
/_tag.html.haml
View file @
41956773
File moved
app/views/projects/
container_registry
/index.html.haml
→
app/views/projects/
registry/repositories
/index.html.haml
View file @
41956773
File moved
config/routes/project.rb
View file @
41956773
...
@@ -219,7 +219,10 @@ constraints(ProjectUrlConstrainer.new) do
...
@@ -219,7 +219,10 @@ constraints(ProjectUrlConstrainer.new) do
end
end
end
end
resources
:container_registry
,
only:
[
:index
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
container_registry_reference_regex
}
resources
:container_registry
,
controller:
'registry/repositories'
,
only:
[
:index
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
container_registry_reference_regex
}
resources
:milestones
,
constraints:
{
id:
/\d+/
}
do
resources
:milestones
,
constraints:
{
id:
/\d+/
}
do
member
do
member
do
...
...
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