-
Notifications
You must be signed in to change notification settings - Fork 37
Feature soap logs view #119
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
Open
nicoaravena
wants to merge
11
commits into
azerothcore:master
Choose a base branch
from
nicoaravena:feature-soap-logs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b94cfb
Create a new table to log soap commands
nicoaravena 33aa274
Add logs possibility to soap command
nicoaravena 4d72678
Add executed datetime
nicoaravena db9b12f
Add view for logs
nicoaravena e382426
use <?= instead of echo for some value outputs
nicoaravena 3f8ac75
Fix insert query
nicoaravena 8932049
Fix creation process of the select query
nicoaravena 5147efa
Improve readability in some strings
nicoaravena 442b074
Clean some code
nicoaravena 7235a90
Restore script to toggle raf config
nicoaravena 0c40220
Add remaining soap logger and fix send items
nicoaravena File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
...wordpress/wp-content/plugins/acore-wp-plugin/src/Components/AdminPanel/Pages/SoapLogs.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| <?php | ||
| use ACore\Manager\Opts; | ||
| // Now display the settings editing screen | ||
| $myCredConfs = get_option('mycred_pref_core'); | ||
| ?> | ||
|
|
||
| <div class="wrap"> | ||
| <h2> <?= __('Soap Logs', Opts::I()->page_alias)?> </h2> | ||
| <p>A list of the logged commands.</p> | ||
| <div class="row"> | ||
| <div class="col"> | ||
| <div class="card p-0"> | ||
| <div class="card-body"> | ||
| <h5>Soap Logs</h5> | ||
| <hr> | ||
| <form class="row row-cols-lg-auto g-2" url="<?= menu_page_url(ACORE_SLUG . '-soap-logs'); ?>"> | ||
| <input type="hidden" value="<?= ACORE_SLUG . '-soap-logs'; ?>" name="page"> | ||
| <div class="col"> | ||
| <label class="visually-hidden" for="username">Username</label> | ||
| <input type="text" class="form-control form-control-sm" id="username" name="username" placeholder="Username" value="<?= $data['username']; ?>"> | ||
| </div> | ||
| <div class="col"> | ||
| <label class="visually-hidden" for="order_id">Order ID</label> | ||
| <input type="text" class="form-control form-control-sm" id="order_id" name="order_id" placeholder="Order ID" value="<?= $data['order_id']; ?>"> | ||
| </div> | ||
|
|
||
| <div class="col"> | ||
| <label class="visually-hidden" for="items">Items</label> | ||
| <select class="form-select" name="items" id="items"> | ||
| <option value="10">10</option> | ||
| <option value="25" <?= $data['items'] == '25' ? 'selected' : ''; ?>>25</option> | ||
| <option value="50" <?= $data['items'] == '50' ? 'selected' : ''; ?>>50</option> | ||
| <option value="100" <?= $data['items'] == '100' ? 'selected' : ''; ?>>100</option> | ||
| </select> | ||
| </div> | ||
|
|
||
| <div class="col"> | ||
| <button type="submit" class="btn btn-primary btn-sm">Search</button> | ||
| </div> | ||
|
|
||
| <div class="col ms-auto"> | ||
| <nav aria-label="Table pagination"> | ||
| <ul class="pagination pagination-sm"> | ||
| <?php | ||
| $maxPagination = 3; | ||
| $diff = $data["max_page"] - $data["pos"]; | ||
| $start = ($data["pos"] - $maxPagination > 0 && $diff >= 0) ? $data["pos"] - $maxPagination : 1; | ||
| $end = ($data["pos"] + $maxPagination < $data["max_page"] && $diff > 0) ? $data["pos"] + $maxPagination : $data["max_page"]; | ||
|
|
||
| $link = menu_page_url(ACORE_SLUG . '-soap-logs', false); | ||
| if ($data["username"]) { | ||
| $link .= "&username=" . $data["username"]; | ||
| } | ||
| if ($data["order_id"]) { | ||
| $link .= "&order_id=" . $data["order_id"]; | ||
| } | ||
| ?> | ||
|
|
||
| <li class="page-item disabled"> | ||
| <?php if ($data["count"] > 0): ?> | ||
| <a class="page-link">Results <?= ($data["pos"] - 1) * $data["items"] + 1; ?> to <?= $data["pos"] != $data["max_page"] ? $data["pos"] * $data["items"] : $data["count"]; ?> from <?= $data["count"]; ?> </a> | ||
| <?php else: ?> | ||
| <a class="page-link">No results </a> | ||
| <?php endif; ?> | ||
Helias marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </li> | ||
|
|
||
| <?php | ||
| $link .= "&items=" . $data["items"]; | ||
| if ($start > 1) { | ||
| echo '<li class="page-item"><a class="page-link" href="' . $link . '&pos=1">1</a></li>'; | ||
| if ($maxPagination <= $start) { | ||
| echo '<li class="page-item disabled"><a class="page-link">...</a></li>'; | ||
| } | ||
| } | ||
| for ($i = $start; $i <= $end; $i++) { | ||
| $href = "$link&pos=$i"; | ||
| $class = ""; | ||
| if ($i == $data["pos"]) { | ||
| $href = "#"; | ||
| $class = " active"; | ||
| } | ||
| echo '<li class="page-item' . $class . '"><a class="page-link" href="' . $href . '">' . $i . '</a></li>'; | ||
| } | ||
| if ($end < $data["max_page"]) { | ||
| if ($data["max_page"] - 1 != $end) { | ||
| echo '<li class="page-item disabled"><a class="page-link">...</a></li>'; | ||
| } | ||
| echo '<li class="page-item"><a class="page-link" href="' . $link . '&pos=' . $data["max_page"] . '">' . $data["max_page"] . '</a></li>'; | ||
| } | ||
| ?> | ||
| </ul> | ||
| </nav> | ||
| </div> | ||
|
|
||
| </form> | ||
| <table class="table table-bordered table-hover align-middle"> | ||
| <thead> | ||
| <tr> | ||
| <th>#</th> | ||
| <th>Result</th> | ||
| <th>Details</th> | ||
| <th>Command</th> | ||
| <th>User</th> | ||
| <th>Order</th> | ||
| <th>Executed DateTime</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <?php | ||
| foreach ($result as $item) { | ||
| echo "<tr><td>{$item->id}</td>"; | ||
| if ($item->success) { | ||
| echo '<td><span class="dashicons dashicons-yes text-success"></span></td>'; | ||
| } else { | ||
| echo '<td><span class="dashicons dashicons-no text-danger"></span></td>'; | ||
| } | ||
| echo "<td>{$item->result}</td>"; | ||
| echo "<td>{$item->command}</td>"; | ||
| $user_info = get_userdata($item->user_id); | ||
| echo '<td><a href="' . get_edit_user_link($item->user_id) . '">' . $user_info->user_login . '</a></td>'; | ||
| echo "<td>{$item->order_id}</td>"; | ||
| echo "<td>{$item->executed_at}</td></tr>"; | ||
| } | ||
| ?> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,10 @@ public function getToolsRender() { | |
| return $this->loadPageLayout('Tools'); | ||
| } | ||
|
|
||
| public function getSoapLogsRender($data, $result) { | ||
| return $this->loadPageLayout('SoapLogs', ['data' => $data, 'result' => $result]); | ||
| } | ||
|
|
||
| private function loadPageLayout($pageName, $varExtract=null) { | ||
| wp_enqueue_style('bootstrap-css', '//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', array(), '5.1.3'); | ||
| wp_enqueue_style('acore-css', ACORE_URL_PLG . 'web/assets/css/main.css', array(), '0.1'); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.