summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-31 15:10:15 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-31 15:10:15 +0200
commit83d1fe9b5aeb947c1387666205ecaca81f2bf3a2 (patch)
treef5cd91c67ffbc179f051b9fd75abe6a281b2827c
parent00319e595ab52906d12ef027a10e08ac92ea1337 (diff)
downloadgitlab-ce-83d1fe9b5aeb947c1387666205ecaca81f2bf3a2.tar.gz
Add serveral minor improvements to container registry
-rw-r--r--app/controllers/projects/registry/repositories_controller.rb3
-rw-r--r--app/controllers/projects/registry/tags_controller.rb3
-rw-r--r--app/models/container_repository.rb3
-rw-r--r--app/views/projects/registry/repositories/_image.html.haml6
-rw-r--r--lib/container_registry/tag.rb4
5 files changed, 12 insertions, 7 deletions
diff --git a/app/controllers/projects/registry/repositories_controller.rb b/app/controllers/projects/registry/repositories_controller.rb
index e3e30176b30..2901d83fcef 100644
--- a/app/controllers/projects/registry/repositories_controller.rb
+++ b/app/controllers/projects/registry/repositories_controller.rb
@@ -9,7 +9,8 @@ module Projects
def destroy
if image.destroy
- redirect_to project_container_registry_path(@project)
+ redirect_to project_container_registry_path(@project),
+ notice: 'Images repository has been removed successfully!'
else
redirect_to project_container_registry_path(@project),
alert: 'Failed to remove images repository!'
diff --git a/app/controllers/projects/registry/tags_controller.rb b/app/controllers/projects/registry/tags_controller.rb
index 8f0a1aff394..aab130787e9 100644
--- a/app/controllers/projects/registry/tags_controller.rb
+++ b/app/controllers/projects/registry/tags_controller.rb
@@ -5,7 +5,8 @@ module Projects
def destroy
if tag.delete
- redirect_to project_container_registry_path(@project)
+ redirect_to project_container_registry_path(@project),
+ notice: 'Tag removed successfull!'
else
redirect_to project_container_registry_path(@project),
alert: 'Failed to remove repository tag!'
diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb
index e27369c10d6..ceb82af2e95 100644
--- a/app/models/container_repository.rb
+++ b/app/models/container_repository.rb
@@ -4,7 +4,8 @@ class ContainerRepository < ActiveRecord::Base
validates :name, length: { minimum: 0, allow_nil: false }
delegate :client, to: :registry
- before_destroy :delete_tags
+
+ before_destroy :delete_tags!
def registry
@registry ||= begin
diff --git a/app/views/projects/registry/repositories/_image.html.haml b/app/views/projects/registry/repositories/_image.html.haml
index 64b11e375c6..c3f8580d25b 100644
--- a/app/views/projects/registry/repositories/_image.html.haml
+++ b/app/views/projects/registry/repositories/_image.html.haml
@@ -10,7 +10,11 @@
= escape_once(image.path)
= clipboard_button(clipboard_text: "docker pull #{image.path}")
.controls.hidden-xs.pull-right
- = link_to namespace_project_container_registry_path(@project.namespace, @project, image.id), class: 'btn btn-remove has-tooltip', title: "Remove image", data: { confirm: "Are you sure?" }, method: :delete do
+ = link_to namespace_project_container_registry_path(@project.namespace, @project, image),
+ class: 'btn btn-remove has-tooltip',
+ title: 'Remove repository',
+ data: { confirm: 'Are you sure?' },
+ method: :delete do
= icon("trash cred")
diff --git a/lib/container_registry/tag.rb b/lib/container_registry/tag.rb
index d653deb3bf1..d00e6191e7e 100644
--- a/lib/container_registry/tag.rb
+++ b/lib/container_registry/tag.rb
@@ -36,9 +36,7 @@ module ContainerRegistry
end
def digest
- return @digest if defined?(@digest)
-
- @digest = client.repository_tag_digest(repository.path, name)
+ @digest ||= client.repository_tag_digest(repository.path, name)
end
def config_blob