From 5ff56199da8ebe97ea54eb8cd0ffcf483e4ca2c7 Mon Sep 17 00:00:00 2001 From: Janosch <99879757+jkppr@users.noreply.github.com> Date: Tue, 24 Oct 2023 15:13:48 +0000 Subject: [PATCH] Copy saved search ID (#2956) * add copy saved search ID * Add hover copy link icon --- .../components/LeftPanel/SavedSearches.vue | 52 +++++++++++++++---- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/timesketch/frontend-ng/src/components/LeftPanel/SavedSearches.vue b/timesketch/frontend-ng/src/components/LeftPanel/SavedSearches.vue index e28ad33f42..01ea012a19 100644 --- a/timesketch/frontend-ng/src/components/LeftPanel/SavedSearches.vue +++ b/timesketch/frontend-ng/src/components/LeftPanel/SavedSearches.vue @@ -32,29 +32,49 @@ limitations under the License.
-
{{ savedSearch.name }}
- + + + + Copy link to this search + - + + + mdi-identifier + + Copy saved search ID + mdi-link-variant - Copy link to this search + Copy link to this search @@ -75,6 +95,7 @@ export default { data: function () { return { expanded: false, + c_key: -1, } }, computed: { @@ -89,13 +110,22 @@ export default { setView: function (savedSearch) { EventBus.$emit('setActiveView', savedSearch) }, + copySavedSearchIdToClipboard(savedSearchId) { + try { + navigator.clipboard.writeText(savedSearchId) + this.infoSnackBar('Saved Search ID copied to clipboard') + } catch (error) { + this.errorSnackBar('Failed to load Saved Search ID into the clipboard!') + console.error(error) + } + }, copySavedSearchUrlToClipboard(savedSearchId) { try { let searchUrl = window.location.origin + this.$route.path + '?view=' + savedSearchId navigator.clipboard.writeText(searchUrl) - this.infoSnackBar('Event URL copied to clipboard') + this.infoSnackBar('Saved Search URL copied to clipboard') } catch (error) { - this.errorSnackBar('Failed to load Event URL into the clipboard') + this.errorSnackBar('Failed to load Saved Search URL into the clipboard!') console.error(error) } },