2017-03-31 07:08:09 -04:00
|
|
|
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 image.destroy
|
2017-03-31 09:10:15 -04:00
|
|
|
redirect_to project_container_registry_path(@project),
|
|
|
|
notice: 'Images repository has been removed successfully!'
|
2017-03-31 07:08:09 -04:00
|
|
|
else
|
2017-03-31 07:56:07 -04:00
|
|
|
redirect_to project_container_registry_path(@project),
|
|
|
|
alert: 'Failed to remove images repository!'
|
2017-03-31 07:08:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-03-31 07:56:07 -04:00
|
|
|
private
|
2017-03-31 07:08:09 -04:00
|
|
|
|
|
|
|
def image
|
|
|
|
@image ||= project.container_repositories.find_by(id: params[:id])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|