Schedule: Make URLs klickable on overview and handle connection errors

This commit is contained in:
Igor Scheller 2022-12-21 12:06:58 +01:00
parent 700d841a87
commit d92733f658
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,7 @@ use Engelsystem\Models\Shifts\ShiftType;
use Engelsystem\Models\User\User;
use ErrorException;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Exception\ConnectException;
use Illuminate\Database\Connection as DatabaseConnection;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
@ -445,7 +446,12 @@ class ImportSchedule extends BaseController
/** @var ScheduleUrl $scheduleUrl */
$scheduleUrl = ScheduleUrl::findOrFail($scheduleId);
try {
$scheduleResponse = $this->guzzle->get($scheduleUrl->url);
} catch (ConnectException $e) {
throw new ErrorException('schedule.import.request-error');
}
if ($scheduleResponse->getStatusCode() != 200) {
throw new ErrorException('schedule.import.request-error');
}

View File

@ -35,7 +35,7 @@
{% for schedule in schedules %}
<tr>
<td>{{ schedule.name }}</td>
<td>{{ schedule.url }}</td>
<td><a href="{{ schedule.url }}" target="_blank">{{ schedule.url }}</a></td>
<td>
<div class="btn-group">
<a