Привел обработку ошибок в примерах к единообразию

This commit is contained in:
vgoma 2020-10-17 12:56:14 +03:00
parent 56e5e2ff17
commit 4739fe3b9f
6 changed files with 11 additions and 13 deletions

View File

@ -18,10 +18,6 @@ function SystemInfo() {
})(); })();
}); });
if (!systemInfo) {
return null;
}
return ( return (
<> <>
<legend>Информация о системе</legend> <legend>Информация о системе</legend>

View File

@ -7,7 +7,7 @@
var $certificate = document.getElementById('certificate'), var $certificate = document.getElementById('certificate'),
$createSignature = document.getElementById('createSignature'), $createSignature = document.getElementById('createSignature'),
$certificateDetails = document.getElementById('certificateDetails'), $certificateDetails = document.getElementById('certificateDetails'),
$certificateError = document.getElementById('certificateError'); $certificateError = document.getElementById('certificateListError');
$certificate.addEventListener('change', function handleCertSelection() { $certificate.addEventListener('change', function handleCertSelection() {
var thumbprint = $certificate.value; var thumbprint = $certificate.value;
@ -26,6 +26,6 @@
$certificate.appendChild($certOption); $certificate.appendChild($certOption);
}); });
}, function (error) { }, function (error) {
$certificateError.textContent = '\n' + error.message; $certificateError.textContent = error.message;
}); });
})(); })();

View File

@ -43,12 +43,12 @@
}, function (error) { }, function (error) {
$signature.placeholder = 'Не создана'; $signature.placeholder = 'Не создана';
$signatureError.textContent = '\n' + error.message; $signatureError.textContent = error.message;
}); });
}, function (error) { }, function (error) {
$hash.placeholder = 'Не вычислен'; $hash.placeholder = 'Не вычислен';
$hashError.textContent = '\n' + error.message; $hashError.textContent = error.message;
}); });
}); });
})(); })();

View File

@ -16,6 +16,6 @@
}, handleError); }, handleError);
function handleError(error) { function handleError(error) {
$systemInfoError.textContent = '\n' + error.message; $systemInfoError.textContent = error.message;
} }
})(); })();

View File

@ -18,11 +18,13 @@
<select id="certificate" tabindex="-1" required> <select id="certificate" tabindex="-1" required>
<option disabled selected>Не выбран</option> <option disabled selected>Не выбран</option>
</select> </select>
<pre id="certificateListError"></pre>
<details id="certificateDetails"> <details id="certificateDetails">
<summary>Информация о сертификате</summary> <summary>Информация о сертификате</summary>
<pre id="certificateInfo"></pre> <pre id="certificateInfo"></pre>
</details> </details>
<pre id="certificateError"></pre> <pre id="certificateInfoError"></pre>
<label>Тип подписи: *</label> <label>Тип подписи: *</label>
<br> <br>
@ -44,6 +46,8 @@
<label for="signature">Подпись (PKCS7):</label><br> <label for="signature">Подпись (PKCS7):</label><br>
<textarea id="signature" cols="80" rows="30" placeholder="Не создана"></textarea> <textarea id="signature" cols="80" rows="30" placeholder="Не создана"></textarea>
<pre id="signatureError"></pre>
<p> <p>
Для Для
<a href="https://www.gosuslugi.ru/pgu/eds/" <a href="https://www.gosuslugi.ru/pgu/eds/"
@ -54,8 +58,6 @@
<br> <br>
для отделенной подписи (или *.sig для совмещенной). для отделенной подписи (или *.sig для совмещенной).
</p> </p>
<pre id="signatureError"></pre>
</fieldset> </fieldset>
<fieldset> <fieldset>

View File

@ -7,7 +7,7 @@
var $certificate = document.getElementById('certificate'), var $certificate = document.getElementById('certificate'),
$certificateDetails = document.getElementById('certificateDetails'), $certificateDetails = document.getElementById('certificateDetails'),
$certificateInfo = document.getElementById('certificateInfo'), $certificateInfo = document.getElementById('certificateInfo'),
$certificatesError = document.getElementById('certificatesError'); $certificatesError = document.getElementById('certificateInfoError');
$certificateDetails.style.display = 'none'; $certificateDetails.style.display = 'none';