Skip to content

Commit 9308eda

Browse files
Add copy configuration button and functionality
1 parent ca4e123 commit 9308eda

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

resources/views/admin/nodes/view/configuration.blade.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
</div>
4040
<div class="box-footer">
4141
<p class="no-margin">This file should be placed in your daemon's root directory (usually <code>/etc/pterodactyl</code>) in a file called <code>config.yml</code>.</p>
42+
<button id="copyConfigBtn" class="btn btn-sm btn-primary" style="margin-bottom: 5px;">Copy Configuration</button>
4243
</div>
4344
</div>
4445
</div>
@@ -84,5 +85,19 @@
8485
});
8586
});
8687
});
88+
89+
$('#copyConfigBtn').on('click', function () {
90+
const textArea = document.createElement('textarea');
91+
textArea.value = $('pre.no-margin').text();
92+
document.body.appendChild(textArea);
93+
textArea.select();
94+
document.execCommand('copy');
95+
document.body.removeChild(textArea);
96+
swal({
97+
type: 'success',
98+
title: 'Copied!',
99+
text: 'The configuration has been copied to your clipboard.'
100+
});
101+
});
87102
</script>
88103
@endsection

0 commit comments

Comments
 (0)