Skip to content

Instantly share code, notes, and snippets.

@csilcock
Last active March 29, 2016 18:04
Show Gist options
  • Save csilcock/17177d3b743b05ce6552cf0497568701 to your computer and use it in GitHub Desktop.
Save csilcock/17177d3b743b05ce6552cf0497568701 to your computer and use it in GitHub Desktop.
RabbitMQ UI Event Exporter Bookmarklet
let elems = document.getElementsByClassName('msg-payload'); let csv = ''; Array.prototype.forEach.call(elems, function(elem){csv += elem.innerText + ',\n'}); console.log(csv); let a = document.createElement('a'); a.href = 'data:attachment/csv,' + encodeURIComponent(csv); a.target = '_blank'; a.download = 'events.csv'; document.body.appendChild(a); a.click();
javascript:(function()%7Blet%20elems%20%3D%20document.getElementsByClassName('msg-payload')%3B%20let%20csv%20%3D%20''%3B%20Array.prototype.forEach.call(elems%2C%20function(elem)%7Bcsv%20%2B%3D%20elem.innerText%20%2B%20'%2C%5Cn'%7D)%3B%20console.log(csv)%3B%20let%20a%20%3D%20document.createElement('a')%3B%20a.href%20%3D%20'data%3Aattachment%2Fcsv%2C'%20%2B%20%20encodeURIComponent(csv)%3B%20a.target%20%3D%20'_blank'%3B%20a.download%20%3D%20'events.csv'%3B%20document.body.appendChild(a)%3B%20a.click()%7D)()
@weichensw
Copy link

I got sick of going through all the raw events in the RMQ interface when testing event generation, so I created this bookmarklet to export all of the events that are displayed when you use the "Get Messages" option in the RMQ UI to a csv file. Just create a new bookmark in Chrome and set the URL equal to the text in this file. Should work in Firefox too (untested). Nice thing about this is it breaks up each json property into its own column if opened in excel, so you can sort, filter, etc. Enjoy.

-- Chris.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment