diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-10 10:37:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-10 10:38:38 +0900 |
| commit | 6ed373e14764e6bebac876c4f6b32fdd85fa03d2 (patch) | |
| tree | 2cba8b79312a5864b2b1988e3f74a0db4a753184 | |
| parent | 4f51f3dc1dfb25f1e34670f9eb6341fbea126a81 (diff) | |
| download | phperkaigi-2024-albatross-6ed373e14764e6bebac876c4f6b32fdd85fa03d2.tar.gz phperkaigi-2024-albatross-6ed373e14764e6bebac876c4f6b32fdd85fa03d2.tar.zst phperkaigi-2024-albatross-6ed373e14764e6bebac876c4f6b32fdd85fa03d2.zip | |
Revert "do not show stdout/stderr to users"
This reverts commit 9b32f59a34e19a3709af4d4a8cf50b047f1021e2.
| -rw-r--r-- | services/app/assets/loading.js | 8 | ||||
| -rw-r--r-- | services/app/src/App.php | 2 | ||||
| -rw-r--r-- | services/app/templates/answer_view.html.twig | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/services/app/assets/loading.js b/services/app/assets/loading.js index 4c75692..49d8b48 100644 --- a/services/app/assets/loading.js +++ b/services/app/assets/loading.js @@ -11,6 +11,8 @@ document.addEventListener('DOMContentLoaded', () => { ); const statusElemsMap = getElemsMap('js-testcase-execution-status'); const statusLoadingIndicatorElemsMap = getElemsMap('js-testcase-execution-status-loading-indicator'); + const stdoutElemsMap = getElemsMap('js-testcase-execution-stdout'); + const stderrElemsMap = getElemsMap('js-testcase-execution-stderr'); if (!aggregatedStatusLoadingIndicatorElem) { return; @@ -30,12 +32,16 @@ document.addEventListener('DOMContentLoaded', () => { for (const ex of testcase_executions) { const statusElem = statusElemsMap.get(ex.id); const loadingIndicatorElem = statusLoadingIndicatorElemsMap.get(ex.id); + const stdoutElem = stdoutElemsMap.get(ex.id); + const stderrElem = stderrElemsMap.get(ex.id); - const { status } = ex; + const { status, stdout, stderr } = ex; if (status.label === statusElem.textContent) { continue; } statusElem.textContent = status.label; + stdoutElem.textContent = stdout; + stderrElem.textContent = stderr; if (loadingIndicatorElem && !status.show_loading_indicator) { loadingIndicatorElem.remove(); } diff --git a/services/app/src/App.php b/services/app/src/App.php index aef1b12..6cb9dc2 100644 --- a/services/app/src/App.php +++ b/services/app/src/App.php @@ -935,6 +935,8 @@ final class App 'label' => $ex->status->label(), 'show_loading_indicator' => $ex->status->showLoadingIndicator(), ], + 'stdout' => $ex->stdout, + 'stderr' => $ex->stderr, ], $testcaseExecutions), 'phper_token' => $phper_token, ])->withStatus(200); diff --git a/services/app/templates/answer_view.html.twig b/services/app/templates/answer_view.html.twig index 8c7e090..1ec88ab 100644 --- a/services/app/templates/answer_view.html.twig +++ b/services/app/templates/answer_view.html.twig @@ -46,6 +46,10 @@ <div class="js-testcase-execution-status-loading-indicator spinner-border text-primary spinner-border-sm" role="status" data-testcase-execution-id="{{ ex.testcase_execution_id }}"><span class="visually-hidden">Loading...</span></div> {% endif %} </div> + <h4>標準出力</h4> + <pre><code class="js-testcase-execution-stdout hljs language-plaintext" data-testcase-execution-id="{{ ex.testcase_execution_id }}">{{ ex.stdout }}</code></pre> + <h4>標準エラー出力</h4> + <pre><code class="js-testcase-execution-stderr hljs language-plaintext" data-testcase-execution-id="{{ ex.testcase_execution_id }}">{{ ex.stderr }}</code></pre> {% endfor %} </div> <script type="module" src="{{ base_path() }}/assets/loading.js"></script> |
