From 5b86ac888aab6ce74f85ebc8dd13f9c62762c434 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 22 Feb 2022 08:02:11 +1100 Subject: [PATCH] feat(integration dashboard): add copy buttons next to the branch, tag and environment labels --- lib/pact_broker/locale/en.yml | 3 ++ lib/pact_broker/ui/views/dashboard/show.haml | 42 ++++++++++++++------ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/lib/pact_broker/locale/en.yml b/lib/pact_broker/locale/en.yml index fac82065f..4f141f6e8 100644 --- a/lib/pact_broker/locale/en.yml +++ b/lib/pact_broker/locale/en.yml @@ -124,6 +124,9 @@ en: datetime: distance_in_words: half_a_minute: "half a minute" + less_than_x_minutes: + one: "less than 1 minute" + other: "less than %{count} minutes" less_than_x_seconds: one: "less than 1 second" other: "less than %{count} seconds" diff --git a/lib/pact_broker/ui/views/dashboard/show.haml b/lib/pact_broker/ui/views/dashboard/show.haml index ed8405d74..ba3cfa109 100644 --- a/lib/pact_broker/ui/views/dashboard/show.haml +++ b/lib/pact_broker/ui/views/dashboard/show.haml @@ -86,16 +86,25 @@ %span.copy-icon - if view == "branch" || view == "all" - index_item.consumer_version_branch_heads.each do | branch_head | - %div{"class": "tag badge badge-dark", "title": branch_head.tooltip, "data-toggle": "tooltip", "data-placement": "right"} - = "branch: " + ellipsisize(branch_head.branch_name) + %div.clippable{"data-clippable": branch_head.branch_name} + %div{"class": "tag badge badge-dark", "title": branch_head.tooltip, "data-toggle": "tooltip", "data-placement": "right"} + = "branch: " + ellipsisize(branch_head.branch_name) + %button.clippy.invisible{ title: "Copy to clipboard" } + %span.copy-icon - if view == "tag" || view == "all" - index_item.consumer_version_latest_tag_names.each do | tag_name | - .tag.badge.badge-primary - = "tag: " + ellipsisize(tag_name) + %div.clippable{"data-clippable": tag_name} + .tag.badge.badge-primary + = "tag: " + ellipsisize(tag_name) + %button.clippy.invisible{ title: "Copy to clipboard" } + %span.copy-icon - if view == "environment" || view == "all" - index_item.consumer_version_environment_names.each do | environment_name | - .tag.badge.badge-success - = "env: " + ellipsisize(environment_name) + %div.clippable{"data-clippable": environment_name} + .tag.badge.badge-success + = "env: " + ellipsisize(environment_name) + %button.clippy.invisible{ title: "Copy to clipboard" } + %span.copy-icon - if view == "all" && index_item.display_latest_label? && index_item.latest? .tag.badge.bg-light latest @@ -107,16 +116,25 @@ %span.copy-icon - if view == "branch" || view == "all" - index_item.provider_version_branch_heads.each do | branch_head | - %div{"class": "tag badge badge-dark", "title": branch_head.tooltip, "data-toggle": "tooltip", "data-placement": "right"} - = "branch: " + ellipsisize(branch_head.branch_name) + %div.clippable{"data-clippable": branch_head.branch_name} + %div{"class": "tag badge badge-dark", "title": branch_head.tooltip, "data-toggle": "tooltip", "data-placement": "right"} + = "branch: " + ellipsisize(branch_head.branch_name) + %button.clippy.invisible{ title: "Copy to clipboard" } + %span.copy-icon - if view == "tag" || view == "all" - index_item.provider_version_latest_tag_names.each do | tag_name | - .tag.badge.badge-primary - = "tag: " + ellipsisize(tag_name) + %div.clippable{"data-clippable": tag_name} + .tag.badge.badge-primary + = "tag: " + ellipsisize(tag_name) + %button.clippy.invisible{ title: "Copy to clipboard" } + %span.copy-icon - if view == "environment" || view == "all" - index_item.provider_version_environment_names.each do | environment_name | - .tag.badge.badge-success - = "env: " + ellipsisize(environment_name) + %div.clippable{"data-clippable": environment_name} + .tag.badge.badge-success + = "env: " + ellipsisize(environment_name) + %button.clippy.invisible{ title: "Copy to clipboard" } + %span.copy-icon %td.pact %span.pact %a{ href: index_item.pact_url, title: "View pact" }