Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/config: Added Copy to clipboard button for /config #4410

Merged
merged 5 commits into from Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 52 additions & 2 deletions web/ui/assets_vfsdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions web/ui/static/css/config.css
@@ -0,0 +1,3 @@
.btn {
border-radius: 0;
}
staff0rd marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions web/ui/static/js/config.js
@@ -0,0 +1,12 @@
function init() {
$("#copyToClipboard").on("click", function () {
var range = document.createRange();
range.selectNode(document.getElementById("config_yaml"));
window.getSelection().empty();
window.getSelection().addRange(range);
document.execCommand("copy");
window.getSelection().empty();
});
}

$(init);
9 changes: 6 additions & 3 deletions web/ui/templates/config.html
@@ -1,8 +1,11 @@
{{define "head"}}<!-- nix -->{{end}}
{{define "head"}}
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/config.css?v={{ buildVersion }}">
<script src="{{ pathPrefix }}/static/js/config.js?v={{ buildVersion }}"></script>
{{end}}

{{define "content"}}
<div class="container-fluid">
<h2 id="configuration">Configuration</h2>
<pre>{{.}}</pre>
<h2 id="configuration">Configuration <button type="button" class="btn btn-primary" id="copyToClipboard">Copy to clipboard</button></h2>
<pre id="config_yaml">{{.}}</pre>
</div>
{{end}}