From c6288d27a224e5686340f990551a6927284e7d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Fri, 22 Dec 2017 23:30:04 +0100 Subject: [PATCH 1/2] Show silence ID in the UI This adds silence ID to the list of rendered silence elements, clicking on it will allow to copy it to the clipboard. Fixes #203 --- assets/static/unsee.js | 12 ++++++++++++ assets/templates/alertgroup.html | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/assets/static/unsee.js b/assets/static/unsee.js index 340800f75..dab332604 100644 --- a/assets/static/unsee.js +++ b/assets/static/unsee.js @@ -1,6 +1,7 @@ "use strict"; const $ = window.$ = window.jQuery = require("jquery"); +const Clipboard = require("clipboard"); const moment = require("moment"); const Raven = require("raven-js"); @@ -43,6 +44,7 @@ var selectors = { refreshButton: "#refresh", errors: "#errors", instanceErrors: "#instance-errors", + clickToCopy: ".click-to-copy" }; function parseAJAXError(xhr, textStatus) { @@ -342,6 +344,16 @@ function onReady(localStore) { trigger: "hover" }); + var clipboard = new Clipboard(selectors.clickToCopy); + clipboard.on("success", function(e) { + // flash element after copy + $(e.trigger).finish().fadeOut(100).fadeIn(300); + // hide tooltip after flash + $(e.trigger).tooltip("hide"); + // reset focus + e.clearSelection(); + }); + colors.init($("#alerts").data("static-color-labels").split(" ")); templates.init(); ui.setupModal(); diff --git a/assets/templates/alertgroup.html b/assets/templates/alertgroup.html index a5a0faa1b..2a2e1eab8 100644 --- a/assets/templates/alertgroup.html +++ b/assets/templates/alertgroup.html @@ -150,6 +150,13 @@ <%- am.name %> <% } %> +
+ <%- silence.id %> +
Date: Wed, 3 Jan 2018 16:03:18 -0800 Subject: [PATCH 2/2] Add missing depenency for test-js npm install isn't run when test-js is executed on a fresh clone, so travis fails --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fcb996498..aba3ead58 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ test-go: .build/vendor.ok go test -bench=. -cover `go list ./... | grep -v /vendor/` .PHONY: test-js -test-js: +test-js: .build/deps-build-node.ok npm test .PHONY: test