Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions powerindex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ def execute_script():
)
stdout, stderr = process.communicate()

# Scrub sensitive data from stderr
stderr = scrub_github_token(stderr)

# Try to read and highlight headers from b.txt
headers_path = os.path.join(parent_dir, 'b.txt')
headers_content = ''
Expand Down
6 changes: 5 additions & 1 deletion powerindex/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ function executeScript(scriptName) {
.then(data => {
const stdoutElement = document.getElementById('stdout');
const headersElement = document.getElementById('headers');
const stderrElement = document.getElementById('stderr');
const stderrCopyButton = document.querySelector('.stderr-copy');

if (data.is_json) {
stdoutElement.innerHTML = data.stdout;
Expand All @@ -122,7 +124,9 @@ function executeScript(scriptName) {
// Always use innerHTML for headers as it contains highlighted JSON
headersElement.innerHTML = data.headers || '';

document.getElementById('stderr').textContent = data.stderr || '';
stderrElement.textContent = data.stderr || '';
stderrCopyButton.style.display = data.stderr ? 'block' : 'none';

button.textContent = 'Execute';
button.disabled = false;
})
Expand Down
14 changes: 14 additions & 0 deletions powerindex/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@ tr:hover {
background: #f8f8f8;
padding: 15px;
border-radius: 4px;
position: relative;
}

.output-box .copy-button {
position: absolute;
right: 0;
top: 0;
}

.output-box h4 {
Expand Down Expand Up @@ -727,3 +734,10 @@ tr:hover {
color: inherit;
text-decoration: inherit;
}

.stderr-copy {
display: none;
position: absolute;
right: 0;
top: 0;
}
3 changes: 2 additions & 1 deletion powerindex/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ <h4>Standard Output</h4>
</div>
<div class="output-box">
<h4>Standard Error</h4>
<pre id="stderr"></pre>
<button class="copy-button stderr-copy" onclick="copyScriptContent('stderr')">Copy</button>
<pre id="stderr">{{ stderr }}</pre>
</div>
<div class="output-box">
<div class="output-header">
Expand Down