Issue fixes (#341)

* Better error handling around ACARS position updates

* Add step for decimals on fuel block/used fields closes #340

* Styling

* Rename AcarsController to LiveMapController; update JS dependencies
This commit is contained in:
Nabeel S
2019-08-05 13:07:22 -04:00
committed by GitHub
parent 9f3ba05880
commit 753804b71b
9 changed files with 1234 additions and 187 deletions

View File

@@ -39,7 +39,7 @@ A full development environment can be brought up using Docker:
```bash
composer install
npm install
yarn install
docker-compose build
docker-compose up
```
@@ -49,3 +49,13 @@ Then go to `http://localhost`. If you're using dnsmasq, the `app` container is l
```
127.0.0.1 phpvms.test
```
## Building JS/CSS assets
Yarn is required, run:
```bash
make build-assets
```
This will build all of the assets according to the webpack file.

View File

@@ -15,10 +15,11 @@ use App\Models\Pirep;
use App\Repositories\AcarsRepository;
use App\Repositories\PirepRepository;
use App\Services\GeoService;
use Auth;
use Carbon\Carbon;
use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Log;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
/**
* Class AcarsController
@@ -157,10 +158,13 @@ class AcarsController extends Controller
}
}
$update = Acars::create($position);
$update->save();
$count++;
try {
$update = Acars::create($position);
$update->save();
$count++;
} catch (QueryException $ex) {
Log::info('Error on adding ACARS position: '.$ex->getMessage());
}
}
// Change the PIREP status if it's as SCHEDULED before
@@ -207,9 +211,13 @@ class AcarsController extends Controller
$log['created_at'] = Carbon::createFromTimeString($log['created_at']);
}
$acars = Acars::create($log);
$acars->save();
$count++;
try {
$acars = Acars::create($log);
$acars->save();
$count++;
} catch (QueryException $ex) {
Log::info('Error on adding ACARS position: '.$ex->getMessage());
}
}
return $this->message($count.' logs added', $count);
@@ -250,9 +258,13 @@ class AcarsController extends Controller
$log['created_at'] = Carbon::createFromTimeString($log['created_at']);
}
$acars = Acars::create($log);
$acars->save();
$count++;
try {
$acars = Acars::create($log);
$acars->save();
$count++;
} catch (QueryException $ex) {
Log::info('Error on adding ACARS position: '.$ex->getMessage());
}
}
return $this->message($count.' logs added', $count);

View File

@@ -7,10 +7,7 @@ use App\Repositories\AcarsRepository;
use App\Services\GeoService;
use Illuminate\Http\Request;
/**
* Class AcarsController
*/
class AcarsController extends Controller
class LiveMapController extends Controller
{
private $acarsRepo;
private $geoSvc;
@@ -39,7 +36,7 @@ class AcarsController extends Controller
$pireps = $this->acarsRepo->getPositions();
$positions = $this->geoSvc->getFeatureForLiveFlights($pireps);
return view('acars.index', [
return view('livemap.index', [
'pireps' => $pireps,
'positions' => $positions,
]);

View File

@@ -13,7 +13,7 @@ Route::group([
Route::get('users', 'UserController@index')->name('users.index');
Route::get('pilots', 'UserController@index')->name('pilots.index');
Route::get('livemap', 'AcarsController@index')->name('livemap.index');
Route::get('livemap', 'LiveMapController@index')->name('livemap.index');
});
/*

View File

@@ -24,6 +24,7 @@
"icheck": "~1.0",
"jquery": "~3.4",
"jquery-pjax": "~2.0",
"js-yaml": "^3.13.1",
"laravel-mix": "^2.1.14",
"leaflet": "^1.3.4",
"leaflet-ajax": "2.1.0",
@@ -48,6 +49,6 @@
"copy-webpack-plugin": "^4.6.0",
"tailwindcss": "^0.5.3",
"webpack-bundle-analyzer": "^3.3",
"webpack-dev-server": ">=3.1.11"
"webpack-dev-server": "^3.1.11"
}
}

View File

@@ -168,7 +168,11 @@
{{ Form::label('block_fuel', 'Block Fuel:') }}
<div class="row">
<div class="col-sm-12">
{{ Form::number('block_fuel', null, ['class' => 'form-control', 'min' => 0]) }}
{{ Form::number('block_fuel', null, [
'class' => 'form-control',
'min' => 0,
'step' => '0.01',
]) }}
<p class="text-danger">{{ $errors->first('block_fuel') }}</p>
</div>
</div>
@@ -179,7 +183,11 @@
{{ Form::label('fuel_used', 'Fuel Used:') }}
<div class="row">
<div class="col-sm-12">
{{ Form::number('fuel_used', null, ['class' => 'form-control', 'min' => 0]) }}
{{ Form::number('fuel_used', null, [
'class' => 'form-control',
'min' => 0,
'step' => '0.01'
]) }}
<p class="text-danger">{{ $errors->first('fuel_used') }}</p>
</div>
</div>

View File

@@ -123,34 +123,6 @@ flight reports that have been filed. You've been warned!
<p class="text-danger">{{ $errors->first('minutes') }}</p>
@endif
</div>
<div class="col-3">
{{--{{ Form::label('submitted_date', __('pireps.dateflown')) }}
{{ Form::text('submmitted_date', null, [
'placeholder' => __('pireps.departuredate'),
'class' => 'form-control',
'readonly' => $pirep->read_only]) }}--}}
</div>
<div class="col-3">
{{--{{ Form::label('departure_time', __('flights.departuretime')) }}
{{ Form::text('departure_time', null, [
'placeholder' => __('flights.departuretime'),
'class' => 'form-control',
'readonly' => $pirep->read_only]) }}--}}
</div>
<div class="col-3">
{{--{{ Form::label('arrival_time', __('flights.arrivaltime')) }}
{{ Form::text('arrival_time', null, [
'placeholder' => __('flights.arrivaltime'),
'class' => 'form-control',
'readonly' => $pirep->read_only]) }}--}}
</div>
</div>
</div>
</div>
@@ -237,6 +209,7 @@ flight reports that have been filed. You've been warned!
{{ Form::number('block_fuel', null, [
'class' => 'form-control',
'min' => '0',
'step' => '0.01',
'readonly' => (!empty($pirep) && $pirep->read_only),
]) }}
</div>
@@ -252,6 +225,7 @@ flight reports that have been filed. You've been warned!
{{ Form::number('fuel_used', null, [
'class' => 'form-control',
'min' => '0',
'step' => '0.01',
'readonly' => (!empty($pirep) && $pirep->read_only),
]) }}
</div>

1319
yarn.lock

File diff suppressed because it is too large Load Diff