Slightly easier validation page error access (#14044)

This commit is contained in:
Tony Murray
2022-06-14 21:36:35 -05:00
committed by GitHub
parent c1a59e29e5
commit 849cd28bcb
2 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ return [
'fix' => 'Fix',
'fixed' => 'Fix has completed, refresh to re-run validations.',
'fetch_failed' => 'Failed to fetch validation results',
'backend_failed' => 'Failed to load data from backend, check webserver.',
'backend_failed' => 'Failed to load data from backend, check console for error.',
'invalid_fixer' => 'Invalid Fixer',
'show_all' => 'Show all',
'show_less' => 'Show less',
+11 -3
View File
@@ -3,9 +3,17 @@
@section('title', __('validation.results.validate'))
@section('content')
<div x-data="{results: [], listItems: 10, errorMessage: ''}"
x-init="fetch('{{ route('validate.results') }}').then(response => response.json().then(data => results = data).catch(error => errorMessage=(error instanceof SyntaxError)?'{{ trans('validation.results.backend_failed') }}':error))"
>
<div x-data="{results: [], listItems: 10, errorMessage: ''}" x-init="fetch('{{ route('validate.results') }}')
.then(response => {
if (response.ok) {
response.json()
.then(data => results = data)
.catch(error => errorMessage = (error instanceof SyntaxError ? '{{ trans('validation.results.backend_failed') }}' : error))
} else {
errorMessage = '{{ trans('validation.results.backend_failed') }}';
response.text().then(console.log);
}
});">
<div class="tw-grid tw-place-items-center" style="height: 80vh" x-show="! results.length">
<h3 x-show="! errorMessage"><i class="fa-solid fa-spinner fa-spin"></i> {{ __('validation.results.validating') }}</h3>
<div x-show="errorMessage" class="panel panel-danger">