Sha256: acdaef1665296395abb14530a8fcbae4965a8cf7292b2ad8ee232605ebe2a6d0

Contents?: true

Size: 1.24 KB

Versions: 57

Compression:

Stored size: 1.24 KB

Contents

module Katello
  class Api::V2::DockerTagsController < Api::V2::ApiController
    apipie_concern_subst(:a_resource => N_("a docker tag"), :resource => "docker_tags")
    include Katello::Concerns::Api::V2::RepositoryContentController

    before_action :find_repositories, :only => [:auto_complete_name]

    def auto_complete_name
      page_size = Katello::Concerns::FilteredAutoCompleteSearch::PAGE_SIZE
      tags = Katello::DockerMetaTag.in_repositories(@repositories)
      col = "#{Katello::DockerMetaTag.table_name}.name"
      tags = tags.where("#{col} ILIKE ?", "#{params[:term]}%").select(col).group(col).order(col).limit(page_size)
      render :json => tags.pluck(col)
    end

    def index
      if params[:grouped]
        # group docker tags by name, repo, and product
        repos = Repository.readable
        repos = repos.in_organization(@organization) if @organization
        collection = Katello::DockerMetaTag.in_repositories(repos, true)
        respond(:collection => scoped_search(collection, "name", "DESC"))
      else
        super
      end
    end

    private

    def find_repositories
      @repositories = Repository.readable.where(:id => params[:repoids])
    end

    def resource_class
      DockerMetaTag
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
katello-3.15.0.1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.15.0 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.15.0.rc2 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.15.0.rc1.3 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.15.0.rc1.2 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.15.0.rc1.1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.15.0.rc1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.14.1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.4 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.14.0 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.3 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.14.0.rc2 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.2 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.14.0.rc1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.0 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.0.rc2.1 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.13.0.rc2 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.12.3 app/controllers/katello/api/v2/docker_tags_controller.rb
katello-3.12.2 app/controllers/katello/api/v2/docker_tags_controller.rb