Schedule: Make URLs klickable on overview and handle connection errors
This commit is contained in:
parent
700d841a87
commit
d92733f658
|
@ -21,6 +21,7 @@ use Engelsystem\Models\Shifts\ShiftType;
|
||||||
use Engelsystem\Models\User\User;
|
use Engelsystem\Models\User\User;
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
use GuzzleHttp\Client as GuzzleClient;
|
use GuzzleHttp\Client as GuzzleClient;
|
||||||
|
use GuzzleHttp\Exception\ConnectException;
|
||||||
use Illuminate\Database\Connection as DatabaseConnection;
|
use Illuminate\Database\Connection as DatabaseConnection;
|
||||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||||
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
|
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
|
||||||
|
@ -445,7 +446,12 @@ class ImportSchedule extends BaseController
|
||||||
/** @var ScheduleUrl $scheduleUrl */
|
/** @var ScheduleUrl $scheduleUrl */
|
||||||
$scheduleUrl = ScheduleUrl::findOrFail($scheduleId);
|
$scheduleUrl = ScheduleUrl::findOrFail($scheduleId);
|
||||||
|
|
||||||
$scheduleResponse = $this->guzzle->get($scheduleUrl->url);
|
try {
|
||||||
|
$scheduleResponse = $this->guzzle->get($scheduleUrl->url);
|
||||||
|
} catch (ConnectException $e) {
|
||||||
|
throw new ErrorException('schedule.import.request-error');
|
||||||
|
}
|
||||||
|
|
||||||
if ($scheduleResponse->getStatusCode() != 200) {
|
if ($scheduleResponse->getStatusCode() != 200) {
|
||||||
throw new ErrorException('schedule.import.request-error');
|
throw new ErrorException('schedule.import.request-error');
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
{% for schedule in schedules %}
|
{% for schedule in schedules %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ schedule.name }}</td>
|
<td>{{ schedule.name }}</td>
|
||||||
<td>{{ schedule.url }}</td>
|
<td><a href="{{ schedule.url }}" target="_blank">{{ schedule.url }}</a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a
|
<a
|
||||||
|
|
Loading…
Reference in New Issue