2016-05-08 16:50:30 -04:00
|
|
|
class Projects::ContainerRegistryController < Projects::ApplicationController
|
|
|
|
before_action :authorize_read_image!
|
|
|
|
before_action :authorize_update_image!, only: [:destroy]
|
|
|
|
before_action :tag, except: [:index]
|
|
|
|
layout 'project'
|
|
|
|
|
|
|
|
def index
|
2016-05-09 15:14:46 -04:00
|
|
|
@tags = container_registry_repository.tags
|
2016-05-08 16:50:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
if tag.delete
|
|
|
|
redirect_to namespace_project_container_registry_index_path(project.namespace, project)
|
|
|
|
else
|
|
|
|
redirect_to namespace_project_container_registry_index_path(project.namespace, project), alert: 'Failed to remove tag'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-05-09 15:14:46 -04:00
|
|
|
def container_registry_repository
|
|
|
|
@container_registry_repository ||= project.container_registry_repository
|
2016-05-08 16:50:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def tag
|
|
|
|
@tag ||= container_registry[params[:id]]
|
|
|
|
end
|
|
|
|
end
|