- Some minor on request debugger
This commit is contained in:
1 parent
c3e3d6a73a
commit
ba74c5a38e
17 files changed
+255
-202
No files matched your search
@@ -10,30 +10,39 @@
|
||||
|
||||
<div class="entities">
|
||||
{% foreach $entities as $name => $entity %}
|
||||
<div class="entity-wrapper" style="padding-left: 15px;border-left: 3px solid #eaa1af;">
|
||||
<div id="{{ $entity['className'] }}" class="entity-wrapper" style="padding-left: 15px;border-left: 3px solid #eaa1af;">
|
||||
<h4 class='entity-name' title="{{ $name }}">{{ $entity['className'] }}</h4>
|
||||
<div class='description'>{{ $entity['description'] }}</div>
|
||||
|
||||
<hr style="margin-top:15px">
|
||||
|
||||
<ol class='fields'>
|
||||
{% foreach $entity['fields'] as $field %}
|
||||
<li class="odd-even">
|
||||
<div class="title">
|
||||
<div><strong style="font-family:monospace">${{ $field['name'] }}</strong> <span style='margin-left:15px'>{{ $field['description'] }}</span></div>
|
||||
</div>
|
||||
<div class="fields-wrapper">
|
||||
<div class="header-fields">Champs</div>
|
||||
<ol class='fields'>
|
||||
{% foreach $entity['fields'] as $field %}
|
||||
<li class="odd-even">
|
||||
<div class="title">
|
||||
<div>
|
||||
<strong style="font-family:monospace">${{ $field['name'] }} {% if ! $field['allowNulls'] %}<span style="color:red">*</span>{% endif %}</strong>
|
||||
<span style='margin-left:15px'>{{ $field['description'] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||
<div style="padding:5px"><u>Champ SQL</u> : {{ $field['fieldName'] }}</div>
|
||||
<div style="padding:5px"><u>Attribut</u> : {{ $field['tag'] }}</div>
|
||||
<div style="padding:5px"><u>Type(s)</u> : {{ $field['type'] }}</div>
|
||||
<div style="padding:5px"><u>Nullable</u> {{ yesOrNo($field['allowNulls']) }}</div>
|
||||
<div style="padding:5px"><u>Taille</u> : {{ length($field['length']) }}</div>
|
||||
<div style="padding:5px"><u>Lecture seule</u> : {{ yesOrNo($field['readonly']) }}</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endforeach %}
|
||||
</ol>
|
||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||
<div class="fieldname"><u>Champ SQL</u> : {{ $field['fieldName'] }}</div>
|
||||
<div class="tag"><u>Attribut</u> : {{ $field['tag'] }}</div>
|
||||
<div class="type"><u>Type(s)</u> : {{ $field['type'] }}</div>
|
||||
<div class="nullable"><u>Nullable</u> {{ yesOrNo($field['allowNulls']) }}</div>
|
||||
{% if $field['default'] %}
|
||||
<div class="default"><u>Valeur par défaut</u> : {{ $field['default'] }}</div>
|
||||
{% endif %}
|
||||
<div class="length"><u>Taille</u> : {{ length($field['length']) }}</div>
|
||||
<div class="readonly"><u>Lecture seule</u> : {{ yesOrNo($field['readonly']) }}</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endforeach %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if $entity['searchRequestFields'] %}
|
||||
@@ -44,25 +53,35 @@
|
||||
<div class='description' style="margin-bottom:10px">{{ $entity['searchRequestDescription'] }}</div>
|
||||
{% endif %}
|
||||
|
||||
<ol class='requests'>
|
||||
{% foreach $entity['searchRequestFields'] as $field %}
|
||||
<li class="odd-even">
|
||||
<div class="title">
|
||||
<div><strong style="font-family:monospace">{{ $field['name'] }}</strong> <span style='margin-left:15px'>{{ $field['description'] }}</span></div>
|
||||
</div>
|
||||
|
||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||
<div><u>Paramètre de requête (GET)</u> : {{ $field['parameter'] }}</div>
|
||||
<div><u>Attribut</u> : {{ $field['tag'] }}</div>
|
||||
<div><u>Type(s)</u> : {{ $field['type'] }}</div>
|
||||
<div><u>Nullable</u> : {{ yesOrNo($field['allowNulls']) }}</div>
|
||||
{% if $field['default'] !== "" %}
|
||||
<div><u>Valeur par défault</u> : {{ $this->displayValue($field['default']) }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endforeach %}
|
||||
</ol>
|
||||
<div class="fields-wrapper">
|
||||
<div class="header-fields">Champs</div>
|
||||
|
||||
<ol class='requests'>
|
||||
{% foreach $entity['searchRequestFields'] as $field %}
|
||||
<li class="odd-even">
|
||||
<div class="title">
|
||||
<div>
|
||||
<strong style="font-family:monospace">{{ $field['name'] }}</strong>
|
||||
<span style='margin-left:15px'>{{ $field['description'] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||
<div class="parameter"><u>Paramètre de requête (GET)</u> : {{ $field['parameter'] }}</div>
|
||||
<div class="tag"><u>Attribut</u> : {{ $field['tag'] }}</div>
|
||||
<div class="type"><u>Type(s)</u> : {{ $field['type'] }}</div>
|
||||
{% if $field['possibleValues'] ?? false %}
|
||||
<div class="possible-values"><u>Valeurs possibles</u> : {{ $field['possibleValues'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['default'] !== "" %}
|
||||
<div class="default"><u>Valeur par défault</u> : {{ $this->displayValue($field['default']) }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endforeach %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% or %}
|
||||
|
||||
@@ -13,42 +13,47 @@
|
||||
<div class='description'>{{ $form['description'] }}</div>
|
||||
<hr style="margin-top:15px">
|
||||
|
||||
<h5>Champs</h5>
|
||||
|
||||
<ol class='fields'>
|
||||
{% foreach $form['fields'] as $field %}
|
||||
<li class="odd-even">
|
||||
<div class="title">
|
||||
<div>
|
||||
<strong style="font-family:monospace">{{ $field['name'] }}</strong>
|
||||
<span style='margin-left:15px'>{{ $field['description'] }}</span>
|
||||
<div class="fields-wrapper">
|
||||
<div class="header-fields">Champs</div>
|
||||
|
||||
<ol class='fields'>
|
||||
{% foreach $form['fields'] as $field %}
|
||||
<li class="odd-even">
|
||||
<div class="title">
|
||||
<div>
|
||||
<strong style="font-family:monospace">{{ $field['name'] }} {% if $field['mandatory'] %}<span style="color:red">*</span>{% endif %}</strong>
|
||||
<span style='margin-left:15px'>{{ $field['description'] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||
<div><u>Variable POST / champ JSON</u> : {{ $field['name'] }}</div>
|
||||
<div><u>Type(s)</u> : {{ implode(' | ', array_map(fn($e) => $e->type, $field['type'])) }}</div>
|
||||
<div><u>Nullable</u> : {{ yesOrNo($field['allowNulls']) }}</div>
|
||||
{% if $field['regexPattern'] !== null %}
|
||||
<div><u>Pattern regex</u> : {{ $field['regexPattern'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['minLength'] !== null %}
|
||||
<div><u>Taille min.</u> : {{ $field['minLength'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['maxLength'] !== null %}
|
||||
<div><u>Taille max.</u> : {{ $field['maxLength'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['example'] !== null || $field['values'] %}
|
||||
<div><u>Exemple</u> : {{ $field['example'] }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if $field['values'] %}
|
||||
<div><u>Valeurs possibles</u> : [ <u>{{= implode('</u>, <u>', $field['values']) }}</u> ]</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endforeach %}
|
||||
</ol>
|
||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||
<div><u>Variable POST / champ JSON</u> : {{ $field['name'] }}</div>
|
||||
<div><u>Type(s)</u> : {{ implode(' | ', array_map(fn($e) => $e->type, $field['type'])) }}</div>
|
||||
<div><u>Nullable</u> : {{ yesOrNo($field['allowNulls']) }}</div>
|
||||
{% if $field['regexPattern'] !== null %}
|
||||
<div><u>Pattern regex</u> : {{ $field['regexPattern'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['minLength'] !== null %}
|
||||
<div><u>Taille min.</u> : {{ $field['minLength'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['maxLength'] !== null %}
|
||||
<div><u>Taille max.</u> : {{ $field['maxLength'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['example'] !== null || $field['values'] %}
|
||||
<div><u>Exemple</u> : {{ $field['example'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['default'] !== null %}
|
||||
<div><u>Default</u> : {{ $field['default'] }}</div>
|
||||
{% endif %}
|
||||
{% if $field['values'] %}
|
||||
<div><u>Valeurs possibles</u> : [ <u>{{= implode('</u>, <u>', $field['values']) }}</u> ]</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endforeach %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
{% or %}
|
||||
<i style="color:#585858; padding:0 12px">{% _ "none" %}</i>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<div class="url" style="flex-grow: 1;">
|
||||
{% ui:text "url" %}
|
||||
{% ui:text "token", $this->session->jwt %}
|
||||
{% ui:text "token", $this->session->jwt, [ 'placeholder' => "JWT Token" ] %}
|
||||
<button class="request-btn">Envoyer</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,6 +85,7 @@
|
||||
method = requestHead.querySelector(".method"),
|
||||
input = requestHead.querySelector("[name='url']"),
|
||||
token = requestHead.querySelector("[name='token']"),
|
||||
tokenValue = sessionStorage.getItem("token"),
|
||||
button = requestHead.querySelector(".request-btn");
|
||||
|
||||
// Editor
|
||||
@@ -98,6 +99,11 @@
|
||||
responseEditorElement = responseResponse.querySelector('#response');
|
||||
|
||||
input.addEventListener('keydown', evt => evt.keyCode === 13 ? button.click() : null);
|
||||
token.addEventListener('change', evt => sessionStorage.setItem("token", evt.target.value));
|
||||
|
||||
if (tokenValue) {
|
||||
token.value = tokenValue;
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", (evt) => {
|
||||
document.querySelectorAll(".form-name").forEach(elem => {
|
||||
@@ -111,10 +117,12 @@
|
||||
let json = {};
|
||||
|
||||
formData.fields.forEach((field) => {
|
||||
json[field.name] = field.allowNulls ? null : "";
|
||||
const value = field.default ? field.default : ( field.allowNulls ? null : "" );
|
||||
|
||||
json[field.name] = value === "[]" ? [] : value;
|
||||
});
|
||||
|
||||
editor.setValue(JSON.stringify(json,null,2), -1);
|
||||
editor.setValue(JSON.stringify(json, null, 2), -1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -148,6 +156,7 @@
|
||||
|
||||
launchRequest(requestMethod, input.value, editor.getValue())
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
responseHead.querySelector('.response-code').innerText = response.status;
|
||||
responseHead.querySelector('.response-message').innerText = response.statusText;
|
||||
|
||||
@@ -156,6 +165,7 @@
|
||||
return response.text();
|
||||
})
|
||||
.then(body => {
|
||||
console.log(aceMode);
|
||||
if (aceMode === "json") {
|
||||
body = JSON.stringify(JSON.parse(body), null, 2);
|
||||
responseEditorElement.innerHTML = body;
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
<span>{{ $route['name'] }}</span>
|
||||
<br>
|
||||
<span class="permissions">
|
||||
{% foreach ['admin', 'school' ] as $privilege %}
|
||||
à venir
|
||||
{# foreach ['admin', 'school' ] as $privilege %}
|
||||
<u class="privilege">{{ $privilege }}</u>
|
||||
{% endforeach %}
|
||||
{% endforeach #}
|
||||
</span>
|
||||
</small>
|
||||
</li>
|
||||
|
||||
Reference in new issue
Block a user