Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.8.0 #143

Merged
merged 32 commits into from
Oct 17, 2024
Merged

1.8.0 #143

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5a0051c
Fix bug in can statement
lieselwd Sep 14, 2024
7b02335
Rewrite of processing and pending tables
lieselwd Sep 14, 2024
ca38aa0
Revert "Rewrite of processing and pending tables"
philsjh Sep 14, 2024
e2a53bf
Readd all of the new pending/processed tables
lieselwd Oct 14, 2024
e27cd3c
Add auto acknowledge basics for CTP 24E
lieselwd Oct 14, 2024
1b9f907
Adjust footer and about page
lieselwd Oct 14, 2024
a231298
Update app/Models/RclMessage.php
lieselwd Oct 14, 2024
7ad3f6c
Update app/Models/RclMessage.php
lieselwd Oct 14, 2024
b0d865a
Adjust wording of RCL messages
lieselwd Oct 14, 2024
1888bf7
UI adjustments to bring in line with CTP site
lieselwd Oct 14, 2024
d3c67d0
Add auto acknowledge basics for CTP 24E
lieselwd Oct 14, 2024
9f7f870
Update app/Models/RclMessage.php
lieselwd Oct 14, 2024
320356d
Update app/Models/RclMessage.php
lieselwd Oct 14, 2024
3e6f6dc
Adjust wording of RCL messages
lieselwd Oct 14, 2024
c77b366
Merge remote-tracking branch 'origin/auto-acknowledge-rcl-ctp24e' int…
lieselwd Oct 14, 2024
d75b7fc
Adjust prune times for rclmessages
lieselwd Oct 15, 2024
0d3bf48
squash! Adjust prune times for rclmessages
lieselwd Oct 15, 2024
3522788
Add bulk delete/fix CLX linking in table
lieselwd Oct 15, 2024
7347ff1
Add settings, user mode option
lieselwd Oct 15, 2024
9e3fe0e
Slight adjustment
lieselwd Oct 15, 2024
f36e739
Update README.md
lieselwd Oct 15, 2024
b2fb8f0
Remove unneeded JS/CSS files
lieselwd Oct 15, 2024
15f7c37
Auto move RCLs from pending to processed
lieselwd Oct 16, 2024
6b3b1db
Merge branch 'development' into auto-acknowledge-rcl-ctp24e
williammck Oct 16, 2024
38cbc89
Merge pull request #142 from vatsimnetwork/auto-acknowledge-rcl-ctp24e
williammck Oct 16, 2024
9c01e89
Merge pull request #145 from vatsimnetwork/qol-improvements-ctp24e
williammck Oct 16, 2024
d72f569
Merge branch 'main' into development
williammck Oct 16, 2024
23a24ff
Revert "Slight adjustment"
williammck Oct 16, 2024
3f8f7bd
Revert "Add settings, user mode option"
williammck Oct 16, 2024
ef310dd
Add permission tables
lieselwd Oct 17, 2024
2aeddbf
Merge pull request #146 from vatsimnetwork/permissions-tables
williammck Oct 17, 2024
eaf0455
UI tweaks
williammck Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 26 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,46 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
<p align="center"><a href="https://nattrak.vatsim.net" target="_blank"><img src="https://github.com/vatsimnetwork/nattrak/blob/1ffe41ca2087844dab75cb0b33ed9f85f96a8c1c/public/images/natTrak_Logo_2000px.png?raw=true" width="200"></a></p>

<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
[//]: # (<p align="center">)

## About Laravel
[//]: # (<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>)

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
[//]: # (<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>)

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
[//]: # (<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>)

Laravel is accessible, powerful, and provides tools required for large, robust applications.
[//]: # (<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>)

## Learning Laravel
[//]: # (</p>)

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
## About natTrak

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
natTrak is the web application used by the Atlantic oceanic controll areas of the [VATSIM](https://vatsim.net) network. Pilots submit oceanic clearance requests via the website, and controllers respond to those requests.

## Laravel Sponsors
This project is maintained by the VATSIM Tech Team.

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
natTrak is a [Laravel](https://laravel.com) application using Bootstrap 5.3, Livewire 3.0, and AlpineJS. It also makes use of Soketi for websocket support.

### Premium Partners
### Primary Developers

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
- [Liesel Downes](https://github.com/lieselwd)
- [William McKinnerney](https://github.com/williammck)

## Contributing
### FAQs

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
#### How do I request new features?

## Code of Conduct
Create an Issue in this repository, or let one of us know via Discord if you're unable to. All ideas welcome!

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
#### Is natTrak compatible with Hoppies CPDLC?

## Security Vulnerabilities
Unfortunately it is not and there are no plans for this.

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.
#### Is there an API?

## License
Yes! The endpoints are:

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
- /api/clx-messages - Detailed oceanic clearance messages
- /api/plugins-rcl - Simple oceanic clearance _request_ messages
- /tracks - the tracks currently in use by natTrak.

It is highly recommended that you use the clx-messages endpoint. In future more endpoints will be available.
83 changes: 83 additions & 0 deletions app/Console/Commands/AutoAcknowledgeClearCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace App\Console\Commands;

use App\Enums\DatalinkAuthorities;
use App\Enums\RclResponsesEnum;
use App\Models\ClxMessage;
use App\Models\RclMessage;
use App\Services\CpdlcService;
use Illuminate\Console\Command;

class AutoAcknowledgeClearCommand extends Command
{
protected $signature = 'rcl-messages:clear-auto-acknowledged';

protected $description = 'Move auto acknowledged RCL messages from pending list to processed list';

public function handle(): void
{
$rclMessages = RclMessage::pending()->where('is_acknowledged', false)->get();
foreach ($rclMessages as $rclMessage) {
// Don't interfere with clearances being edited
if ($rclMessage->isEditLocked()) {
continue;
}
$datalinkAuthority = DatalinkAuthorities::SYS;
$cpdlcService = new CpdlcService();
$cpdlcService->sendMessage(
author: $datalinkAuthority,
recipient: $rclMessage->callsign,
recipientAccount: $rclMessage->vatsimAccount,
message: sprintf(RclResponsesEnum::AcknowledgeMoved->value, strtoupper($datalinkAuthority->description())),
caption: RclResponsesEnum::Acknowledge->text()
);

$clxMessage = new ClxMessage([
'vatsim_account_id' => $rclMessage->vatsim_account_id,
'rcl_message_id' => $rclMessage->id,
'flight_level' => $rclMessage->flight_level,
'upper_flight_level' => $rclMessage->upper_flight_level ? $rclMessage->upper_flight_level : null,
'mach' => $rclMessage->mach,
'entry_fix' => $rclMessage->entry_fix,
'entry_time_restriction' => null,
'raw_entry_time_restriction' => $rclMessage->entry_time,
'free_text' => "** AUTO ACKNOWLEDGE **",
'datalink_authority' => $datalinkAuthority,
'is_concorde' => $rclMessage->is_concorde,
'simple_datalink_message' => '** AUTO ACKNOWLEDGED REFER RCL REQUEST **',
'datalink_message' => ['** AUTO ACKNOWLEDGED REFER RCL REQUEST **'],
]);

/**
* Assign track or RR
*/
if ($rclMessage->track) {
$clxMessage->track_id = $rclMessage->track->id;
$clxMessage->random_routeing = null;
} elseif ($rclMessage->random_routeing) {
$clxMessage->random_routeing = $rclMessage->random_routeing;
$clxMessage->track_id = null;
}

/**
* Save
*/
$clxMessage->save();

/**
* Assign Clx message to Rcl
*/
$rclMessage->clx_message_id = $clxMessage->id;
$rclMessage->save();

//ClxIssuedEvent::dispatch($rclMessage->vatsimAccount, $clxMessage);

activity('datalink')
->causedBy($clxMessage->vatsimAccount)
->performedOn($rclMessage)
->withProperties(['datalink' => $clxMessage->data_link_message])
->log('Pending Auto Acknowledge Move');
}
}
}
7 changes: 7 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ protected function schedule(Schedule $schedule)
$schedule->command('model:prune')->hourly();
}

/**
* Move auto acknowledged RCL messages from pending to processed after 15 min
*/
if (config('services.pruning.prune_messages') && config('app.rcl_auto_acknowledgement_enabled')) {
$schedule->command('rcl-messages:clear-auto-acknowledged')->hourly();
}

// Clean activity log
$schedule->command('activitylog:clean')->daily();
}
Expand Down
9 changes: 5 additions & 4 deletions app/Enums/RclResponsesEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ enum RclResponsesEnum: string
case TooEarly = "RCL REJECTED\nRCL SENT TOO EARLY";
case TooLate = "RCL REJECTED\nRCL RECEIVED TOO LATE REVERT TO VOICE PROCEDURES";
case OclServiceNotAvailable = "RCL REJECTED\nOCL SERVICE NOT CURRENTLY AVAILABLE\nREVERT TO VOICE PROCEDURES";
case Negotiation = "RCL/CLA RECEIVED\nNEGOTIATION REQUIRED CONTACT %s BY VOICE";
case Cancelled = "RCL/CLA REJECTED\nCLEARANCE CALLED REVERT TO VOICE PROCEDURES";
case Negotiation = "RCL RECEIVED\nNEGOTIATION REQUIRED CONTACT %s BY VOICE";
case Cancelled = "RCL REJECTED\nCLEARANCE CALLED REVERT TO VOICE PROCEDURES";
case Invalid = "RCL REJECTED\nINVAILD %s\nRESUBMIT YOUR REQUEST";
case Contact = "RCL/CLA RECEIVED\nCONTACT %s BY VOICE";
case Acknowledge = "RCL/CLA RECEIVED\nFLY CURRENT FLIGHT PLAN OR AS AMENDED BY ATC\nCONTINUE TO MONITOR NATTRAK UNTIL ENTERING OCA";
case Contact = "RCL RECEIVED\nCONTACT %s BY VOICE";
case Acknowledge = "RCL RECEIVED\nCONTINUE TO MONITOR NATTRAK UNTIL ENTERING OCA";
case AcknowledgeMoved = "RCL RECEIVED BY %s\nCONTINUE TO MONITOR NATTRAK";

public function text(): string
{
Expand Down
69 changes: 68 additions & 1 deletion app/Http/Controllers/ClxMessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getPending(Request $request)

public function getProcessed(Request $request)
{
return view('controllers.clx.processedPg', [
return view('controllers.clx.processed', [
'displayed' => $request->get('display'),
'tracks' => Track::active()->get(),
'_pageTitle' => $request->get('display') ? 'Tracks '.implode(', ', $request->get('display')) : 'None selected',
Expand Down Expand Up @@ -106,6 +106,11 @@ public function showRclMessage(RclMessage $rclMessage)
]);
}

public function showClxMessage(ClxMessage $clxMessage)
{
return redirect()->route('controllers.clx.show-rcl-message', $clxMessage->rcl_message_id);
}

/**
* Transmits the CLX message to the pilot
* POST /controllers/clx/transmit/{rclMessage:id}
Expand Down Expand Up @@ -289,6 +294,68 @@ public function revertToVoice(Request $request, RclMessage $rclMessage)
return redirect()->route('controllers.clx.show-rcl-message', $rclMessage);
}

public function moveToProcessed(Request $request, RclMessage $rclMessage)
{
$datalinkAuthority = $this->dataService->getActiveControllerAuthority ?? DatalinkAuthorities::NAT;
$this->cpdlcService->sendMessage(
author: $datalinkAuthority,
recipient: $rclMessage->callsign,
recipientAccount: $rclMessage->vatsimAccount,
message: sprintf(RclResponsesEnum::AcknowledgeMoved->value, strtoupper($datalinkAuthority->description())),
caption: RclResponsesEnum::Acknowledge->text()
);

$clxMessage = new ClxMessage([
'vatsim_account_id' => $request->user()->id,
'rcl_message_id' => $rclMessage->id,
'flight_level' => $rclMessage->flight_level,
'upper_flight_level' => $rclMessage->upper_flight_level ? $rclMessage->upper_flight_level : null,
'mach' => $rclMessage->mach,
'entry_fix' => $rclMessage->entry_fix,
'entry_time_restriction' => null,
'raw_entry_time_restriction' => $rclMessage->entry_time,
'free_text' => "** AUTO ACKNOWLEDGE **",
'datalink_authority' => $datalinkAuthority,
'is_concorde' => $rclMessage->is_concorde,
'simple_datalink_message' => '** AUTO ACKNOWLEDGED REFER RCL REQUEST **',
'datalink_message' => ['** AUTO ACKNOWLEDGED REFER RCL REQUEST **'],
]);

/**
* Assign track or RR
*/
if ($rclMessage->track) {
$clxMessage->track_id = $rclMessage->track->id;
$clxMessage->random_routeing = null;
} elseif ($rclMessage->random_routeing) {
$clxMessage->random_routeing = $rclMessage->random_routeing;
$clxMessage->track_id = null;
}

/**
* Save
*/
$clxMessage->save();

/**
* Assign Clx message to Rcl
*/
$rclMessage->clx_message_id = $clxMessage->id;
$rclMessage->save();

//ClxIssuedEvent::dispatch($rclMessage->vatsimAccount, $clxMessage);

activity('datalink')
->causedBy($clxMessage->vatsimAccount)
->performedOn($rclMessage)
->withProperties(['datalink' => $clxMessage->data_link_message])
->log('CLX Message Transmitted By '.$clxMessage->datalink_authority->name);

flashAlert(type: 'success', title: null, message: 'Clearance moved.', toast: true, timer: true);

return redirect()->route('controllers.clx.show-rcl-message', $rclMessage);
}

public function create()
{
return view('controllers.clx.rcl-messages.create', [
Expand Down
3 changes: 3 additions & 0 deletions app/Http/Controllers/RclMessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public function store(RclMessageRequest $request)

// If RCL auto acknowledgement enabled, send CPDLC acknowledgement
if (config('app.rcl_auto_acknowledgement_enabled')) {
$rclMessage->acknowledged_at = now();
$rclMessage->is_acknowledged = true;
$rclMessage->save();
$this->cpdlcService->sendMessage(
author: DatalinkAuthorities::SYS,
recipient: $rclMessage->callsign,
Expand Down
Loading