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
5196f8e9
Commit
5196f8e9
authored
May 08, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
9e619d38
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
12 deletions
+43
-12
app/controllers/projects/container_registry_controller.rb
app/controllers/projects/container_registry_controller.rb
+31
-0
app/helpers/gitlab_routing_helper.rb
app/helpers/gitlab_routing_helper.rb
+2
-2
app/models/project.rb
app/models/project.rb
+2
-2
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+3
-3
app/views/projects/container_registry/_header_title.html.haml
...views/projects/container_registry/_header_title.html.haml
+1
-0
app/views/projects/container_registry/index.html.haml
app/views/projects/container_registry/index.html.haml
+2
-2
app/views/projects/images/_header_title.html.haml
app/views/projects/images/_header_title.html.haml
+0
-1
config/routes.rb
config/routes.rb
+1
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+1
-1
No files found.
app/controllers/projects/
images
_controller.rb
→
app/controllers/projects/
container_registry
_controller.rb
View file @
5196f8e9
class
Projects::
Images
Controller
<
Projects
::
ApplicationController
class
Projects::
ContainerRegistry
Controller
<
Projects
::
ApplicationController
before_action
:authorize_read_image!
before_action
:authorize_update_image!
,
only:
[
:destroy
]
before_action
:tag
,
except:
[
:index
]
layout
'project'
def
index
@tags
=
image_repository
.
tags
@tags
=
container_registry
.
tags
other_repository
=
container_registry
.
registry
[
"gitlab/gitlab-test3"
]
container_registry
.
copy_to
(
other_repository
)
end
def
destroy
if
tag
.
delete
redirect_to
namespace_project_
images
_path
(
project
.
namespace
,
project
)
redirect_to
namespace_project_
container_registry_index
_path
(
project
.
namespace
,
project
)
else
redirect_to
namespace_project_
images
_path
(
project
.
namespace
,
project
),
alert:
'Failed to remove tag'
redirect_to
namespace_project_
container_registry_index
_path
(
project
.
namespace
,
project
),
alert:
'Failed to remove tag'
end
end
private
def
image_reposito
ry
@
image_repository
||=
project
.
image_reposito
ry
def
container_regist
ry
@
container_registry
||=
project
.
container_regist
ry
end
def
tag
@tag
||=
image_reposito
ry
[
params
[
:id
]]
@tag
||=
container_regist
ry
[
params
[
:id
]]
end
end
app/helpers/gitlab_routing_helper.rb
View file @
5196f8e9
...
...
@@ -33,8 +33,8 @@ module GitlabRoutingHelper
namespace_project_builds_path
(
project
.
namespace
,
project
,
*
args
)
end
def
project_
images
_path
(
project
,
*
args
)
namespace_project_
images_path
(
project
.
namespace
,
project
,
*
args
)
def
project_
container_registry
_path
(
project
,
*
args
)
namespace_project_
container_registry_index_url
(
project
.
namespace
,
project
,
*
args
)
end
def
activity_project_path
(
project
,
*
args
)
...
...
app/models/project.rb
View file @
5196f8e9
...
...
@@ -370,10 +370,10 @@ class Project < ActiveRecord::Base
@repository
||=
Repository
.
new
(
path_with_namespace
,
self
)
end
def
image_reposito
ry
def
container_regist
ry
@registry_token
||=
Jwt
::
DockerAuthenticationService
.
full_access_token
(
path_with_namespace
)
@registry
||=
ImageRegistry
::
Registry
.
new
(
Gitlab
.
config
.
registry
.
api_url
,
token:
@registry_token
)
@
image_reposito
ry
||=
ImageRegistry
::
Repository
.
new
(
@registry
,
path_with_namespace
)
@
container_regist
ry
||=
ImageRegistry
::
Repository
.
new
(
@registry
,
path_with_namespace
)
end
def
registry_repository_url
...
...
app/views/layouts/nav/_project.html.haml
View file @
5196f8e9
...
...
@@ -47,11 +47,11 @@
%span
.count.builds_counter
=
number_with_delimiter
(
@project
.
builds
.
running_or_pending
.
count
(
:all
))
-
if
project_nav_tab?
:images
=
nav_link
(
controller:
%w(
images
)
)
do
=
link_to
project_
images_path
(
@project
),
title:
'Images
'
,
class:
'shortcuts-images'
do
=
nav_link
(
controller:
%w(
container_registry
)
)
do
=
link_to
project_
container_registry_path
(
@project
),
title:
'Container Registry
'
,
class:
'shortcuts-images'
do
=
icon
(
'hdd-o fw'
)
%span
Container
Images
Container
Registry
-
if
project_nav_tab?
:graphs
=
nav_link
(
controller:
%w(graphs)
)
do
...
...
app/views/projects/container_registry/_header_title.html.haml
0 → 100644
View file @
5196f8e9
-
header_title
project_title
(
@project
,
"Container Registry"
,
project_container_registry_path
(
@project
))
app/views/projects/
images
/index.html.haml
→
app/views/projects/
container_registry
/index.html.haml
View file @
5196f8e9
-
page_title
"Container
Images
"
-
page_title
"Container
Registry
"
=
render
"header_title"
.light.prepend-top-default
...
...
@@ -53,5 +53,5 @@
=
time_ago_in_words
(
tag
.
created_at
)
%td
.content
.controls.hidden-xs.pull-right
=
link_to
namespace_project_
image
_path
(
@project
.
namespace
,
@project
,
tag
.
name
),
class:
'btn btn-remove has-tooltip'
,
title:
"Remove"
,
data:
{
confirm:
"Are you sure?"
},
method: :delete
do
=
link_to
namespace_project_
container_registry
_path
(
@project
.
namespace
,
@project
,
tag
.
name
),
class:
'btn btn-remove has-tooltip'
,
title:
"Remove"
,
data:
{
confirm:
"Are you sure?"
},
method: :delete
do
=
icon
(
"trash cred"
)
app/views/projects/images/_header_title.html.haml
deleted
100644 → 0
View file @
9e619d38
-
header_title
project_title
(
@project
,
"Container Images"
,
project_images_path
(
@project
))
config/routes.rb
View file @
5196f8e9
...
...
@@ -690,7 +690,7 @@ Rails.application.routes.draw do
end
end
resources
:
images
,
only:
[
:index
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
image
_reference_regex
}
resources
:
container_registry
,
only:
[
:index
,
:destroy
],
constraints:
{
id:
Gitlab
::
Regex
.
container_registry
_reference_regex
}
resources
:milestones
,
constraints:
{
id:
/\d+/
}
do
member
do
...
...
lib/gitlab/regex.rb
View file @
5196f8e9
...
...
@@ -97,7 +97,7 @@ module Gitlab
}x
.
freeze
end
def
image
_reference_regex
def
container_registry
_reference_regex
git_reference_regex
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