Skip to content

Commit

Permalink
feat: support viewing all versions for branch in matrix UI
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jul 13, 2021
1 parent 6c992f8 commit 12f9295
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/pact_broker/db/seed_example_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def call(consumer_name: CONSUMER_NAME, provider_name: PROVIDER_NAME)
.create_consumer_version("725c6ccb7cf7efc51b4394f9828585eea9c379d9", branch: "feat/new-thing", created_at: days_ago(7))
.create_consumer_version_tag("feat-new-thing", created_at: days_ago(7))
.create_pact(json_content: pact_2, created_at: days_ago(7))
.create_consumer_version("6c992f831da299364cf31be6008ee4752189f6d4", branch: "feat/new-thing", created_at: days_ago(6))
.create_consumer_version_tag("feat-new-thing", created_at: days_ago(6))
.create_pact(json_content: pact_2, created_at: days_ago(7))
.create_consumer_version("7bd4d9173522826dc3e8704fd62dde0424f4c827", branch: "main", created_at: days_ago(1))
.create_consumer_version_tag("main", created_at: days_ago(1))
.create_pact(json_content: pact_3, created_at: days_ago(1))
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/matrix/unresolved_selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def max_age
end

def all_for_pacticipant?
!!pacticipant_name && !pacticipant_version_number && !tag && !latest && !environment_name && !max_age
!!pacticipant_name && !pacticipant_version_number && !tag && !branch && !latest && !environment_name && !max_age
end

def latest_for_pacticipant_and_tag?
Expand Down
1 change: 1 addition & 0 deletions lib/pact_broker/ui/helpers/matrix_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def create_selector_objects(selector_hashes)
o = OpenStruct.new(selector_hash)
o.specify_latest_tag = (o.tag && o.latest) ? "checked" : nil
o.specify_latest_branch = (o.branch && o.latest) ? "checked" : nil
o.specify_all_branch = (o.branch && !o.latest) ? "checked" : nil
o.specify_environment = o.environment_name ? "checked" : nil
o.specify_all_tagged = (o.tag && !o.latest) ? "checked" : nil
o.specify_latest = o.latest ? "checked" : nil
Expand Down
2 changes: 2 additions & 0 deletions lib/pact_broker/ui/views/matrix/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
Version number ...
%option{ value: 'specify-latest-branch', selected: selector.specify_latest_branch }
Latest version from branch ...
%option{ value: 'specify-all-branch', selected: selector.specify_all_branch }
All versions from branch ...
%option{ value: 'specify-environment', selected: selector.specify_environment }
Version(s) in environment ...
%option{ value: 'specify-latest-tag', selected: selector.specify_latest_tag }
Expand Down
3 changes: 3 additions & 0 deletions public/javascripts/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function showApplicableTextBoxes(selectorizor) {
else if( selectorizorType === 'specify-latest-branch') {
setTextboxVisibility(selectorizor, '.branch', true);
}
else if( selectorizorType === 'specify-all-branch') {
setTextboxVisibility(selectorizor, '.branch', true);
}
else if ( selectorizorType === 'specify-environment') {
setTextboxVisibility(selectorizor, '.environment', true);
}
Expand Down

0 comments on commit 12f9295

Please sign in to comment.