Sha256: f964027e0f9f3ebb6f4549e0b66fd3431260b712986fc69d6274df5199d1936f

Contents?: true

Size: 1.52 KB

Versions: 22

Compression:

Stored size: 1.52 KB

Contents

require 'pact_broker/ui/controllers/base_controller'
require 'pact_broker/ui/view_models/matrix_lines'
require 'pact_broker/matrix/unresolved_selector'
require 'pact_broker/matrix/parse_query'
require 'pact_broker/logging'
require 'pact_broker/api/pact_broker_urls'
require 'pact_broker/ui/helpers/matrix_helper'
require 'haml'

module PactBroker
  module UI
    module Controllers
      class CanIDeploy < Base

        include PactBroker::Services
        include PactBroker::UI::Helpers::MatrixHelper

        get "/:pacticipant_name/latest-version/:tag/can-i-deploy/to/:environment_tag" do
          # selector and options must be in sync with lib/pact_broker/api/resources/can_i_deploy_badge.rb
          selectors = [ PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: params[:pacticipant_name], latest: true, tag: params[:tag]) ]
          options = { latestby: 'cvp', limit: 100, tag: params[:to] }
          result = matrix_service.find(selectors, options)
          lines = PactBroker::UI::ViewDomain::MatrixLines.new(result, base_url: base_url)
          locals = {
            lines: lines,
            selectors: create_selector_objects(selectors),
            options: create_options_model(options),
            badge_url: badge_url,
            base_url: base_url
          }
          haml :'matrix/show', { locals: locals, layout: :'layouts/main', escape_html: true }
        end

        def badge_url
          u = URI(request.url)
          u.path = u.path + "/badge"
          u.to_s
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.79.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.78.1 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.78.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.77.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.76.2 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.76.1 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.76.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.75.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.74.1 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.74.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.73.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.72.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.71.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.70.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.69.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.68.1 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.68.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.67.0 lib/pact_broker/ui/controllers/can_i_deploy.rb
pact_broker-2.66.0 lib/pact_broker/ui/controllers/can_i_deploy.rb