Copy with columns

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-10-27 12:00:09 +01:00
parent 3dede0273b
commit 1074291485

View File

@@ -24,7 +24,7 @@
let copyText = $state("Copy to clipboard"); let copyText = $state("Copy to clipboard");
async function copyDataleaksInformation(withSample: boolean) { async function copyDataleaksInformation(withColumns: boolean, withSample: boolean) {
if (!filteredDataleaks || filteredDataleaks.length === 0) { if (!filteredDataleaks || filteredDataleaks.length === 0) {
copyText = "No dataleaks to copy"; copyText = "No dataleaks to copy";
return; return;
@@ -60,6 +60,8 @@
console.error("Failed to fetch sample for", dataleak.Name, err); console.error("Failed to fetch sample for", dataleak.Name, err);
fullText += "Sample: [Failed to fetch]\n"; fullText += "Sample: [Failed to fetch]\n";
}); });
} else if (withColumns) {
fullText += `Columns: ${dataleak.Columns.join(", ")}\n`;
} }
fullText += "\n"; fullText += "\n";
} }
@@ -150,12 +152,17 @@
> >
<button <button
class="btn btn-xs" class="btn btn-xs"
onclick={() => copyDataleaksInformation(false)}>{copyText}</button onclick={() => copyDataleaksInformation(false, false)}>{copyText}</button
> >
<button <button
class="btn btn-xs" class="btn btn-xs"
onclick={() => copyDataleaksInformation(true)} onclick={() => copyDataleaksInformation(true, false)}
>{copyText} (w/ sample)</button >{copyText} (w/ columns)</button
>
<button
class="btn btn-xs"
onclick={() => copyDataleaksInformation(false, true)}
>{copyText} (w/ samples)</button
> >
</div> </div>
</div> </div>