Sha256: fc515b347ce688aeb0c4e63f5fc193c8ab3e6356547f61a5ddd0acf77bf35180

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

module Wassup
  module Panes
    module CircleCI
      class Workflows
        attr_accessor :vcs
        attr_accessor :org
        attr_accessor :repo

        def initialize(vcs:, org:, repo:)
          @vcs = vcs
          @org = org
          @repo = repo
        end

        def configure(pane)
          pane.content do |content|
            workflows = Helpers::CircleCI.workflows(vcs: vcs, org: org, repo: repo, limit_days: 14)
            workflows.each do |workflow|
              display = Helpers::CircleCI::Formatter.workflow(workflow)
              content.add_row(display, workflow)
            end
          end
          pane.selection('enter', 'Open workflow in browser') do |workflow|
            slug = workflow["project_slug"]
            pipeline_number = workflow["pipeline_number"]
            workflow_id = workflow["id"]
        
            url = "https://app.circleci.com/pipelines/#{slug}/#{pipeline_number}/workflows/#{workflow_id}"
            `open #{url}`
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wassup-0.4.1 lib/wassup/panes/circleci.rb
wassup-0.4.0 lib/wassup/panes/circleci.rb