Validate fixes (#13935)

* Fix version check abort when something goes wrong

* more generic message when failing to parse ajax
This commit is contained in:
Tony Murray
2022-04-20 23:10:36 -05:00
committed by GitHub
parent 8b82341cb7
commit 6ad5fdada5
3 changed files with 3 additions and 2 deletions

View File

@@ -67,7 +67,7 @@ class Version
public function localCommit(): array
{
if ($this->is_git_install) {
[$local_sha, $local_date] = explode('|', rtrim(`git show --pretty='%H|%ct' -s HEAD`));
[$local_sha, $local_date] = array_pad(explode('|', rtrim(`git show --pretty='%H|%ct' -s HEAD`), 2), 2, '');
return [
'sha' => $local_sha,

View File

@@ -162,6 +162,7 @@ return [
'results' => [
'fix' => 'Fix',
'fetch_failed' => 'Failed to fetch validation results',
'backend_failed' => 'Failed to load data from backend, check webserver.',
'show_all' => 'Show all',
'show_less' => 'Show less',
'validate' => 'Validate',

View File

@@ -4,7 +4,7 @@
@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))"
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 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>