Commit 83d1fe9b authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add serveral minor improvements to container registry

parent 00319e59
...@@ -9,7 +9,8 @@ module Projects ...@@ -9,7 +9,8 @@ module Projects
def destroy def destroy
if image.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 else
redirect_to project_container_registry_path(@project), redirect_to project_container_registry_path(@project),
alert: 'Failed to remove images repository!' alert: 'Failed to remove images repository!'
......
...@@ -5,7 +5,8 @@ module Projects ...@@ -5,7 +5,8 @@ module Projects
def destroy def destroy
if tag.delete if tag.delete
redirect_to project_container_registry_path(@project) redirect_to project_container_registry_path(@project),
notice: 'Tag removed successfull!'
else else
redirect_to project_container_registry_path(@project), redirect_to project_container_registry_path(@project),
alert: 'Failed to remove repository tag!' alert: 'Failed to remove repository tag!'
......
...@@ -4,7 +4,8 @@ class ContainerRepository < ActiveRecord::Base ...@@ -4,7 +4,8 @@ class ContainerRepository < ActiveRecord::Base
validates :name, length: { minimum: 0, allow_nil: false } validates :name, length: { minimum: 0, allow_nil: false }
delegate :client, to: :registry delegate :client, to: :registry
before_destroy :delete_tags
before_destroy :delete_tags!
def registry def registry
@registry ||= begin @registry ||= begin
......
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
= escape_once(image.path) = escape_once(image.path)
= clipboard_button(clipboard_text: "docker pull #{image.path}") = clipboard_button(clipboard_text: "docker pull #{image.path}")
.controls.hidden-xs.pull-right .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") = icon("trash cred")
......
...@@ -36,9 +36,7 @@ module ContainerRegistry ...@@ -36,9 +36,7 @@ module ContainerRegistry
end end
def digest def digest
return @digest if defined?(@digest) @digest ||= client.repository_tag_digest(repository.path, name)
@digest = client.repository_tag_digest(repository.path, name)
end end
def config_blob def config_blob
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment