Skip to content

Commit

Permalink
Simple copy-to-clipboard action for thread dumps (support OrderOfTheB…
Browse files Browse the repository at this point in the history
  • Loading branch information
AFaust committed May 11, 2020
1 parent db48fd1 commit 4777c50
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ Admin.addEventListener(window, 'load', function()
{
toolName = newToolName;
};

AdminTD.copyToClipboard = function copyToClipBoard(toSave)
{
var textToWrite, dump, tDump, area;

dump = el(toSave);
if (dump)
{
tDump = dump.innerHTML;
textToWrite += tDump + "\n";
}

textToWrite = textToWrite.replace(/<span id="date" class="highlight">/g, "");
textToWrite = textToWrite.replace(/<span class="highlight">/g, "");
textToWrite = textToWrite.replace(/<\/span>/g, "");
textToWrite = textToWrite.replace(/&lt;/g, "<");
textToWrite = textToWrite.replace(/&gt;/g, ">");

area = document.createElement('textarea');
area.value = textToWrite;
document.body.appendChild(area);
area.select();
document.execCommand('copy');
document.body.removeChild(area);
};

AdminTD.saveTextAsFile = function saveTextAsFile(toSave)
{
Expand Down Expand Up @@ -158,6 +183,7 @@ Admin.addEventListener(window, 'load', function()
if (selectors[i].id === "s" + tabName)
{
Admin.addClass(selectors[i], "selected");
el("copycurrent").setAttribute("onclick", "AdminTD.copyToClipboard('" + tabName + "');");
el("savecurrent").setAttribute("onclick", "AdminTD.saveTextAsFile('" + tabName + "');");
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Copyright (C) 2005 - 2020 Alfresco Software Limited.
<p class="intro">${msg("threaddump.intro-text")?html}</p>

<@button label=msg("threaddump.get-another") onclick="AdminTD.getDump();"/>
<@button id="copycurrent" class="copy" label=msg("threaddump.copycurrent") onclick="AdminTD.copyToClipboard('current');"/>
<@button id="savecurrent" class="save" label=msg("threaddump.savecurrent") onclick="AdminTD.saveTextAsFile('current');"/>
<@button class="save" label=msg("threaddump.saveall") onclick="AdminTD.saveTextAsFile('all');"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ threaddump.title=Thread Dump
threaddump.intro-text=View and save thread dumps.
threaddump.get-another=Get Another Thread Dump
threaddump.saveall=Save All
threaddump.copycurrent=Copy Current Thread to Clipboard
threaddump.savecurrent=Save Current Thread
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
threaddump.title=Prozessabbild
threaddump.intro-text=Hier k\u00f6nnen Sie Prozessabbilder erstellen und speichern.
threaddump.get-another=Weiteres Abbild erstellen
threaddump.saveall=Alles Speichern
threaddump.savecurrent=Aktuelles Abbild Speichern
threaddump.saveall=Alle speichern
threaddump.copycurrent=Aktuelles Abbild in Zwischenablage kopieren
threaddump.savecurrent=Aktuelles Abbild speichern
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ threaddump.title=Thread Dump
threaddump.intro-text=View and save thread dumps.
threaddump.get-another=Get Another Thread Dump
threaddump.saveall=Save All
threaddump.copycurrent=Copy Current Thread to Clipboard
threaddump.savecurrent=Save Current Thread
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ threaddump.title=Thread Dump
threaddump.intro-text=Ver y salvar Thread Dumps (Volcados de hilos).
threaddump.get-another=Obtener un Thread Dump
threaddump.saveall=Salvar Todo
threaddump.copycurrent=Copy Current Thread to Clipboard
threaddump.savecurrent=Salvar este Thread Dump
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ threaddump.title=Dump del Thread
threaddump.intro-text=Visualizza e salva i dump del thread
threaddump.get-another=Ottieni un altro dump del Thread
threaddump.saveall=Salva Tutto
threaddump.copycurrent=Copy Current Thread to Clipboard
threaddump.savecurrent=Salva il thread corrente
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ threaddump.title=Dump de Thread
threaddump.intro-text=Visualizar e salvar dumps de threads.
threaddump.get-another=Obter outro Dump de Thread
threaddump.saveall=Salvar Tudo
threaddump.copycurrent=Copy Current Thread to Clipboard
threaddump.savecurrent=Salvar Thread Atual

0 comments on commit 4777c50

Please sign in to comment.