From b95783457de74e035ab3563ffa30014d1fae4add Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 19:09:26 +0200 Subject: [PATCH 01/20] Fixed reports not showing correctly #550 --- resources/views/dashboard.blade.php | 36 +++++++++++++------------- resources/views/mentor/index.blade.php | 26 +++++++++++-------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 792d73699..99c940595 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -161,25 +161,25 @@ status]["color"] }}"> {{ $statuses[$training->status]["text"] }}{{ isset($training->paused_at) ? ' (PAUSED)' : '' }} - @if($training->reports->where(['training_id' => $training->id])->count() > 0) - @php - $reportDate = Carbon\Carbon::make($training->reports->where('training_id', $training->id)->get()->sortBy('report_date')->last()->report_date); - $trainingIntervalExceeded = $reportDate->diffInDays() >= Setting::get('trainingInterval'); - @endphp - - @if($reportDate->isToday()) - Today - @elseif($reportDate->isYesterday()) - Yesterday - @elseif($reportDate->diffInDays() <= 7) - {{ $reportDate->diffForHumans(['parts' => 1]) }} - @else - {{ $reportDate->diffForHumans(['parts' => 2]) }} - @endif - - + @if($training->reports->count() > 0) + @php + $reportDate = Carbon\Carbon::make($training->reports->sortBy('report_date')->last()->report_date); + $trainingIntervalExceeded = $reportDate->diffInDays() >= Setting::get('trainingInterval'); + @endphp + + @if($reportDate->isToday()) + Today + @elseif($reportDate->isYesterday()) + Yesterday + @elseif($reportDate->diffInDays() <= 7) + {{ $reportDate->diffForHumans(['parts' => 1]) }} + @else + {{ $reportDate->diffForHumans(['parts' => 2]) }} + @endif + + @else - No registered training yet + No registered training yet @endif diff --git a/resources/views/mentor/index.blade.php b/resources/views/mentor/index.blade.php index a6ab18138..ff4f5c7a7 100644 --- a/resources/views/mentor/index.blade.php +++ b/resources/views/mentor/index.blade.php @@ -72,20 +72,24 @@ @endif - @if($training->reports->where('training_id', $training->id)->count() > 0) + @if($training->reports->count() > 0) @php - $reportDate = Carbon\Carbon::make($training->reports->where('training_id', $training->id)->last()->report_date) + $reportDate = Carbon\Carbon::make($training->reports->last()->report_date); + $trainingIntervalExceeded = $reportDate->diffInDays() >= Setting::get('trainingInterval'); @endphp - @if($reportDate->isToday()) - Today - @elseif($reportDate->isYesterday()) - Yesterday - @elseif($reportDate->diffInDays() <= 7) - {{ $reportDate->diffForHumans(['parts' => 1]) }} - @else - {{ $reportDate->diffForHumans(['parts' => 2]) }} - @endif + + @if($reportDate->isToday()) + Today + @elseif($reportDate->isYesterday()) + Yesterday + @elseif($reportDate->diffInDays() <= 7) + {{ $reportDate->diffForHumans(['parts' => 1]) }} + @else + {{ $reportDate->diffForHumans(['parts' => 2]) }} + @endif + + @else No report yet From 6a98061cb2d6879d9d2193a7d44bc7f70e7f1376 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 19:09:57 +0200 Subject: [PATCH 02/20] Removed unused report counter on dash --- resources/views/dashboard.blade.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 99c940595..40a3b5e7b 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -211,7 +211,6 @@ Area Period State - Reports @@ -243,9 +242,6 @@ status]["color"] }}"> {{ $statuses[$training->status]["text"] }}{{ isset($training->paused_at) ? ' (PAUSED)' : '' }} - -  {{ sizeof($training->reports->toArray()) }} - @endforeach From 3bc9fb4576b9a5ba2fca6ef96cd4549ea2fa9b69 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 19:14:35 +0200 Subject: [PATCH 03/20] Fixed settings visuals #553 --- .../views/admin/globalsettings.blade.php | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/resources/views/admin/globalsettings.blade.php b/resources/views/admin/globalsettings.blade.php index 7afaefd64..b3536a6cc 100644 --- a/resources/views/admin/globalsettings.blade.php +++ b/resources/views/admin/globalsettings.blade.php @@ -34,55 +34,55 @@
-
+
- Link to PDF to display when applying for training + Link to PDF to display when applying for training
@error('trainingSOP') {{ $errors->first('trainingSOP') }} @enderror -
+
- Link to examination template for examiners. Leave blank to disable. + Link to examination template for examiners. Leave blank to disable.
@error('trainingExamTemplate') {{ $errors->first('trainingExamTemplate') }} @enderror -
+
- List subdivisions separated by comma, e.g. SCA, ITA + List subdivisions separated by comma, e.g. SCA, ITA
@error('trainingSubDivisions') {{ $errors->first('trainingSubDivisions') }} @enderror -
+
- Text displayed in FAQ and e-mails. Keep it short. + Text displayed in FAQ and e-mails. Keep it short.
@error('trainingQueue') {{ $errors->first('trainingQueue') }} @enderror -
+
- Input number of days required, used to mark stalled trainings + Input number of days required, used to mark stalled trainings
@error('trainingInterval') {{ $errors->first('trainingInterval') }} @enderror -
+
- Used to confirm solo endorsement creation. + Used to confirm solo endorsement creation.
@error('trainingSoloRequirement') {{ $errors->first('trainingSoloRequirement') }} @@ -100,10 +100,10 @@
-
+
- Input number of months + Input number of months
@error('atcActivityQualificationPeriod') {{ $errors->first('atcActivityQualificationPeriod') }} @@ -111,10 +111,10 @@
-
+
- Input number of months + Input number of months
@error('atcActivityGracePeriod') {{ $errors->first('atcActivityGracePeriod') }} @@ -122,10 +122,10 @@
-
+
- Input number of hours + Input number of hours
@error('atcActivityRequirement') {{ $errors->first('atcActivityRequirement') }} @@ -134,10 +134,10 @@
-
+
- Write who the user should contact regarding refresh or transfer trainings. This text links to your contact list. + Write who the user should contact regarding refresh or transfer trainings. This text links to your contact list.
@error('atcActivityContact') {{ $errors->first('atcActivityContact') }} @@ -149,14 +149,14 @@ - Sends an e-mail to users with copy to admins, when logged in as inactive controller on the network. + Sends an e-mail to users with copy to admins, when logged in as inactive controller on the network.
- + Disabled: Only a training marked as completed will reactivate a controller as ATC Active
Enabled: Same as above and if controller passes activity requirement they will automatically be set as ATC Active.
@@ -172,70 +172,70 @@
-
+
- Enter domain without http or any slashes + Enter domain without http or any slashes
@error('linkDomain') {{ $errors->first('linkDomain') }} @enderror -
+
- Enter full homepage url + Enter full homepage url
@error('linkHome') {{ $errors->first('linkHome') }} @enderror -
+
- Enter link to a page explaining on how to join your division. Shown in FAQ + Enter link to a page explaining on how to join your division. Shown in FAQ
@error('linkJoin') {{ $errors->first('linkJoin') }} @enderror -
+
- Enter link to staff or contact list. Shown in FAQ and inactivity warning + Enter link to staff or contact list. Shown in FAQ and inactivity warning
@error('linkContact') {{ $errors->first('linkContact') }} @enderror -
+
- Enter link to webpage informing about visiting controlling. Shown in FAQ + Enter link to webpage informing about visiting controlling. Shown in FAQ
@error('linkVisiting') {{ $errors->first('linkVisiting') }} @enderror -
+
- Enter Discord invite link. Shown in e-mails to contact mentor on assignment + Enter Discord invite link. Shown in e-mails to contact mentor on assignment
@error('linkDiscord') {{ $errors->first('linkDiscord') }} @enderror -
+
- Enter full link to Moodle or leave blank to disable + Enter full link to Moodle or leave blank to disable
@error('linkMoodle') {{ $errors->first('linkMoodle') }} @@ -259,7 +259,7 @@ - This is used to prioritise development based on stats and who is using Control Center. Telemetry only sends the url, version and division name. + This is used to prioritise development based on stats and who is using Control Center. Telemetry only sends the url, version and division name.
@@ -268,7 +268,7 @@
- +
From 11e29e69cf8966707a05ba704b83132d6eb655c5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 20:28:23 +0200 Subject: [PATCH 04/20] Moved edit training inside card #549 No way it fits inside that header --- resources/views/training/show.blade.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/training/show.blade.php b/resources/views/training/show.blade.php index 226bef367..cc5e4afa3 100644 --- a/resources/views/training/show.blade.php +++ b/resources/views/training/show.blade.php @@ -48,10 +48,6 @@ @endforeach - @can('edit', [\App\Models\Training::class, $training]) -  Edit request - @endcan - @if(\Auth::user()->can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_REPORT_TYPE]) || \Auth::user()->can('create', [\App\Models\OneTimeLink::class, $training, \App\Models\OneTimeLink::TRAINING_EXAMINATION_TYPE]))
From 10f39588aee6db51317f3cdc1b9e7d5d3710e9e8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 20:37:27 +0200 Subject: [PATCH 05/20] #549 Tweaked CTA buttons - Added flex so green CTA's break on mobile - Changed solid to outline buttons to match filter style a bit more --- resources/sass/_global.scss | 22 +++++++++++++++++++ .../views/endorsements/examiners.blade.php | 2 +- resources/views/endorsements/mascs.blade.php | 2 +- .../views/endorsements/trainings.blade.php | 2 +- .../views/endorsements/visiting.blade.php | 2 +- resources/views/layouts/app.blade.php | 4 ++-- resources/views/training/history.blade.php | 2 +- resources/views/training/index.blade.php | 2 +- 8 files changed, 30 insertions(+), 8 deletions(-) diff --git a/resources/sass/_global.scss b/resources/sass/_global.scss index 52354da5f..16cb3bc70 100755 --- a/resources/sass/_global.scss +++ b/resources/sass/_global.scss @@ -15,6 +15,28 @@ p { } } +.page-title{ + + flex-direction: row; + flex-wrap: wrap; + + h3{ + margin-bottom: 1.5rem; + } + + @include media-breakpoint-down(sm) { + + h3{ + margin-bottom: 0.5rem; + margin-right: 1.5rem; + } + + div{ + margin-bottom: 1.5rem; + } + } +} + form { input, select { border-color: $gray-400 !important; diff --git a/resources/views/endorsements/examiners.blade.php b/resources/views/endorsements/examiners.blade.php index 5740f40d9..06a9f448b 100644 --- a/resources/views/endorsements/examiners.blade.php +++ b/resources/views/endorsements/examiners.blade.php @@ -4,7 +4,7 @@ @section('title-flex')
@if (\Auth::user()->isModeratorOrAbove()) - Add new endorsement + Add new endorsement @endif
@endsection diff --git a/resources/views/endorsements/mascs.blade.php b/resources/views/endorsements/mascs.blade.php index 5cd9c21b9..ec6423bf2 100644 --- a/resources/views/endorsements/mascs.blade.php +++ b/resources/views/endorsements/mascs.blade.php @@ -4,7 +4,7 @@ @section('title-flex')
@if (\Auth::user()->isModeratorOrAbove()) - Add new endorsement + Add new endorsement @endif
@endsection diff --git a/resources/views/endorsements/trainings.blade.php b/resources/views/endorsements/trainings.blade.php index 8115ba71f..e1024725b 100644 --- a/resources/views/endorsements/trainings.blade.php +++ b/resources/views/endorsements/trainings.blade.php @@ -4,7 +4,7 @@ @section('title-flex')
@if (\Auth::user()->isModeratorOrAbove()) - Add new endorsement + Add new endorsement @endif
@endsection diff --git a/resources/views/endorsements/visiting.blade.php b/resources/views/endorsements/visiting.blade.php index 0d9720791..5bf069220 100644 --- a/resources/views/endorsements/visiting.blade.php +++ b/resources/views/endorsements/visiting.blade.php @@ -4,7 +4,7 @@ @section('title-flex')
@if (\Auth::user()->isModeratorOrAbove()) - Add new endorsement + Add new endorsement @endif
@endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 13d30b609..238e5d852 100755 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -31,8 +31,8 @@ @if(!Route::is('front')) -
-

+
+

@yield('title', 'Page Title')

@yield('title-flex') diff --git a/resources/views/training/history.blade.php b/resources/views/training/history.blade.php index 3396b5943..3725cac9b 100644 --- a/resources/views/training/history.blade.php +++ b/resources/views/training/history.blade.php @@ -4,7 +4,7 @@ @section('title-flex')
@if (\Auth::user()->isModeratorOrAbove()) - Add new request + Add new request @endif
@endsection diff --git a/resources/views/training/index.blade.php b/resources/views/training/index.blade.php index ca4f4638d..1002ab209 100644 --- a/resources/views/training/index.blade.php +++ b/resources/views/training/index.blade.php @@ -4,7 +4,7 @@ @section('title-flex')
@if (\Auth::user()->isModeratorOrAbove()) - Add new request + Add new request @endif
@endsection From 9f97fa8c26dfe83adeb80fc48a634129e8ba87b3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 22:16:35 +0200 Subject: [PATCH 06/20] Give admins all exam access #533 --- app/Policies/TrainingExaminationPolicy.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Policies/TrainingExaminationPolicy.php b/app/Policies/TrainingExaminationPolicy.php index e152842df..d67b6e501 100644 --- a/app/Policies/TrainingExaminationPolicy.php +++ b/app/Policies/TrainingExaminationPolicy.php @@ -29,6 +29,9 @@ public function view(User $user, TrainingExamination $examination) */ public function create(User $user, Training $training) { + + if($user->isAdmin()) return true; + // If one-time link is used if (($link = $this->getOneTimeLink($training)) != null) { return $user->isExaminer($link->training->area) && $user->isNot($training->user); @@ -46,6 +49,7 @@ public function create(User $user, Training $training) */ public function update(User $user, TrainingExamination $examination) { + if($user->isAdmin()) return true; return $examination->draft ? ($user->isModeratorOrAbove($examination->training->area) || $user->isExaminer()) : $user->isModeratorOrAbove($examination->training->area); } @@ -56,7 +60,7 @@ public function update(User $user, TrainingExamination $examination) */ public function delete(User $user, TrainingExamination $trainingExamination) { - return $user->isModeratorOrAbove($trainingExamination->training->area); + return $user->isModeratorOrAbove($trainingExamination->training->area) || $user->isAdmin(); } /** From 4210c8481bd39478c10439ffe85ea0ece5dac82d Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 22:57:31 +0200 Subject: [PATCH 07/20] Added user:makeadmin artisan command --- app/Console/Commands/UserMakeAdmin.php | 63 ++++++++++++++++++++++ app/Policies/TrainingExaminationPolicy.php | 9 +++- 2 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 app/Console/Commands/UserMakeAdmin.php diff --git a/app/Console/Commands/UserMakeAdmin.php b/app/Console/Commands/UserMakeAdmin.php new file mode 100644 index 000000000..c0fa205b4 --- /dev/null +++ b/app/Console/Commands/UserMakeAdmin.php @@ -0,0 +1,63 @@ +ask("What is the user's CID?"); + if ($user = User::find($cid)) { + $this->info('User found: ' . $user->name); + + $areas = Area::all(); + $area = $this->choice('Which area? Practically admin has all access, but an area must be selected regardless.', $areas->pluck('name')->toArray()); + if ($area != null) { + $area = Area::where('name', $area)->first(); + + // Give the user permission to the area + $user->groups()->attach(Group::find(1), ['area_id' => $area->id]); + $this->info('User ' . $user->name . ' has been given admin permissions for ' . $area->name . '.'); + + return Command::SUCCESS; + } else { + $this->error('No area was selected.'); + + return Command::FAILURE; + } + + } else { + $this->error('No records of ' . $cid . ' was found.'); + + return Command::FAILURE; + } + + return Command::FAILURE; + } +} diff --git a/app/Policies/TrainingExaminationPolicy.php b/app/Policies/TrainingExaminationPolicy.php index d67b6e501..99fd10945 100644 --- a/app/Policies/TrainingExaminationPolicy.php +++ b/app/Policies/TrainingExaminationPolicy.php @@ -30,7 +30,9 @@ public function view(User $user, TrainingExamination $examination) public function create(User $user, Training $training) { - if($user->isAdmin()) return true; + if ($user->isAdmin()) { + return true; + } // If one-time link is used if (($link = $this->getOneTimeLink($training)) != null) { @@ -49,7 +51,10 @@ public function create(User $user, Training $training) */ public function update(User $user, TrainingExamination $examination) { - if($user->isAdmin()) return true; + if ($user->isAdmin()) { + return true; + } + return $examination->draft ? ($user->isModeratorOrAbove($examination->training->area) || $user->isExaminer()) : $user->isModeratorOrAbove($examination->training->area); } From e1e0d0f947c0ba30655c76def704d4c0cbbdd84d Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 22:59:28 +0200 Subject: [PATCH 08/20] Created key:get artisan command --- app/Console/Commands/KeyGet.php | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/Console/Commands/KeyGet.php diff --git a/app/Console/Commands/KeyGet.php b/app/Console/Commands/KeyGet.php new file mode 100644 index 000000000..d479ac25f --- /dev/null +++ b/app/Console/Commands/KeyGet.php @@ -0,0 +1,36 @@ +info('Current application key, copy the whole next line:'); + $this->info(config('app.key')); + + return Command::SUCCESS; + } +} From 0545893ed1c4df3e38b8a7047df8b99e0d62815c Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 23:07:40 +0200 Subject: [PATCH 09/20] Tweaked readme's --- CONFIGURE.md | 2 +- README.md | 7 ++++--- UPGRADE.md | 9 ++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CONFIGURE.md b/CONFIGURE.md index c95e99e1d..ab6fa8dc3 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -47,7 +47,7 @@ Table with all the variables, default value and explanation. Override the enviro Control Center supports both VATSIM Connect and other OAuth providers to authenticate and fetch user data. If you're looking for a centrailised login system check out our [Handover](https://github.com/Vatsim-Scandinavia/handover) service. Otherwise you may use VATSIM Connect. -If you use Handover, please use the following values: +If you use Handover, please use the values in the table below. Please note these values will change in a future update of Handover to simplify the process. | Variable | [Handover](https://github.com/Vatsim-Scandinavia/handover) value | Explanation | | ------- | --- | --- | diff --git a/README.md b/README.md index 7852f3e85..47e73cc77 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't want to use Docker, you need: - An environment that can host PHP websites, such as Apache, Ngnix or similar. - Comply with [Laravel 9 Requirements](https://laravel.com/docs/9.x/deployment#server-requirements) -*Remember to build the composer, npm and setting up cron jobs as well.* +*Remember to build the composer, npm and setting up cron jobs and clearing all caches as well.* ## Setup and install @@ -30,12 +30,13 @@ To setup your Docker instance simply follow these steps: 3. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md) 4. Run the container 5. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. -6. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. +6. To ensure that users will not need to login after each time you re-deploy/upgrade the container, enter the container and run `php artisan key:get`. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. +7. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. ## Configuring To have Control Center reflect your division correctly, you need to do some tweaks. -- Give your user admin access by manipulating the database table `permissions`. Set your `group_id` to `1`. Area need to be specified but can be any. +- Give your user admin access by running `php artisan user:makeadmin` inside your container and following the instructions. Area need to be specified but can be any. - You can now access `Administration -> Settings` in the menu to tweak the most basic settings for your division. - You are also required to configure logic and datasets in the MySQL database as described in [CONFIGURE.md](CONFIGURE.md) with examples diff --git a/UPGRADE.md b/UPGRADE.md index 990e80e41..d87363cdf 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,8 +1,10 @@ # Upgrading -## Upgrading from 3.4.0 to 4.0 +## Upgrading from version 3.4 to 4.0 -These are the steps required to migrate from 3.4.0 to 4.0, please make sure you've a backup and upgraded to minimum 3.4.0 before starting this process. +To have the smoothest upgrade experience, we highly recommend that you've upgraded to v3.4.0 before upgrading to v4.0.0. This way it'll be easier to isolate issues that might happen on the way. + +Make sure you have a manual backup of the database before upgrading. ### Breaking change ⚠️ @@ -22,7 +24,8 @@ We now offer a Docker container that can be used to run Control Center, this is 2. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md) 3. Start the container 4. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. -5. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. +5. To ensure that users will not need to login after each time you re-deploy/upgrade the container, enter the container and run `php artisan key:get`. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. +6. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. #### Data Migration From a967576224a246b451e8f943f5b6db432be46b34 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 23:08:14 +0200 Subject: [PATCH 10/20] Version bump --- config/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/app.php b/config/app.php index 5d539dcd1..013a9aa34 100755 --- a/config/app.php +++ b/config/app.php @@ -25,7 +25,7 @@ | */ - 'version' => '4.0.1', + 'version' => '4.0.2', /* |-------------------------------------------------------------------------- From 59e256e3da230abe22150c9e6209d96db0def36a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 26 Jun 2023 23:13:13 +0200 Subject: [PATCH 11/20] Re-added previously removed setup of test db --- CONTRIBUTE.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 8134ca764..ecbbca4ad 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -22,8 +22,15 @@ If you encounter permissions errors you might want to `chown -R www-data:www-dat ### Run unit tests +#### First run + +On first run you might need to setup the testing sqlite database first. +Run the command `php artisan migrate --database sqlite-testing` to setup the database. + +#### Test + To run the PHP unit tests use `./vendor/bin/phpunit --color=always --testdox`\ -The tests are run in a local sqlite database. +The tests are run the local sqlite database, not your development database. #### Quicker feedback during development From c057be22d9409cbf44f437fd3d5f3666b3027854 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 21:36:07 +0200 Subject: [PATCH 12/20] Updated documentation --- README.md | 17 +++++++++++------ UPGRADE.md | 6 +++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 47e73cc77..19eddfb89 100755 --- a/README.md +++ b/README.md @@ -13,9 +13,12 @@ Training Management System created by [Daniel L.](https://github.com/blt950) (13 - MySQL database (or MariaDB) to store data. - Preferably a reverse proxy setup if you plan to host more than one website on the same server. +In the instructions where we use `docker exec` we assume your container is named `control-center`. If you have named differently, please replace this. + ### Manual (Unsupported) If you don't want to use Docker, you need: - An environment that can host PHP websites, such as Apache, Ngnix or similar. +- MySQL database (or MariaDB) to store data. - Comply with [Laravel 9 Requirements](https://laravel.com/docs/9.x/deployment#server-requirements) *Remember to build the composer, npm and setting up cron jobs and clearing all caches as well.* @@ -27,18 +30,20 @@ If you don't want to use Docker, you need: To setup your Docker instance simply follow these steps: 1. Pull the `ghcr.io/vatsim-scandinavia/control-center:v4` Docker image 2. Setup your MySQL database (not included in Docker image) -3. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md) -4. Run the container +3. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md#environment) +4. Run the container and access it with `docker exec -it control-center bash` + - Run `php artisan migrate` to setup the database + - To ensure that users will not need to login after each time you re-deploy/upgrade the container, run `php artisan key:get`. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. 5. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. -6. To ensure that users will not need to login after each time you re-deploy/upgrade the container, enter the container and run `php artisan key:get`. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. -7. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. +6. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. ## Configuring To have Control Center reflect your division correctly, you need to do some tweaks. -- Give your user admin access by running `php artisan user:makeadmin` inside your container and following the instructions. Area need to be specified but can be any. + +- Access your container with `docker exec -it control-center bash` and run give your user admin access by running `php artisan user:makeadmin` and following the instructions. Area need to be specified but can be any. - You can now access `Administration -> Settings` in the menu to tweak the most basic settings for your division. -- You are also required to configure logic and datasets in the MySQL database as described in [CONFIGURE.md](CONFIGURE.md) with examples +- You are also required to configure logic and datasets in the MySQL database as described in [CONFIGURE.md](CONFIGURE.md#database) with examples ## Using the API diff --git a/UPGRADE.md b/UPGRADE.md index d87363cdf..fa52c0910 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -18,13 +18,13 @@ Please note that users need to login again after this update, as it'll create a We now offer a Docker container that can be used to run Control Center, this is the recommended hosting now that ensures correct environement. If you still prefer to run it without Docker, this is still possible by cloning the repo and building the project manually. -*Note: The included docker-compose.yaml is only for development purposes and should not be used in production.* +In the instructions where we use `docker exec` we assume your container is named `control-center`. If you have named differently, please replace this. -1. Pull the `ghcr.io/vatsim-scandinavia/control-center:v4.0.0` Docker image +1. Pull the `ghcr.io/vatsim-scandinavia/control-center:v4.0.2` Docker image 2. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md) 3. Start the container 4. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. -5. To ensure that users will not need to login after each time you re-deploy/upgrade the container, enter the container and run `php artisan key:get`. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. +5. To ensure that users will not need to login after each time you re-deploy/upgrade the container, run `docker exec control-center php artisan key:get` from outside the container. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. 6. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. #### Data Migration From 42bc320b49ce04720b26fce513ec4ab47b32e32b Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 21:39:40 +0200 Subject: [PATCH 13/20] Fixed search result link underline --- resources/sass/navs/_topbar.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/sass/navs/_topbar.scss b/resources/sass/navs/_topbar.scss index 623c0dc91..13f4dd45e 100755 --- a/resources/sass/navs/_topbar.scss +++ b/resources/sass/navs/_topbar.scss @@ -196,6 +196,7 @@ min-height: 25px; line-height: 1.5rem; padding: 0 1rem; + text-decoration: none; } a:hover{ From 9656091dc71323a1878595eadf3b4c8fc35fe971 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:25:16 +0200 Subject: [PATCH 14/20] Update CONTRIBUTE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thor K. Høgås --- CONTRIBUTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index ecbbca4ad..4bfe0e522 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -30,7 +30,7 @@ Run the command `php artisan migrate --database sqlite-testing` to setup the dat #### Test To run the PHP unit tests use `./vendor/bin/phpunit --color=always --testdox`\ -The tests are run the local sqlite database, not your development database. +The tests run with the local SQLite test database, not your development database. #### Quicker feedback during development From cd2bc20e454d63b01b6e1f67d6273f1311b635ca Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:25:27 +0200 Subject: [PATCH 15/20] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thor K. Høgås --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19eddfb89..28c97ee82 100755 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Training Management System created by [Daniel L.](https://github.com/blt950) (13 - MySQL database (or MariaDB) to store data. - Preferably a reverse proxy setup if you plan to host more than one website on the same server. -In the instructions where we use `docker exec` we assume your container is named `control-center`. If you have named differently, please replace this. +In the instructions where we use `docker exec`, we assume your container is named `control-center`. If you have named it differently, please replace this. ### Manual (Unsupported) If you don't want to use Docker, you need: From 20185c2fd6b0f237547a56502acb375430c9580e Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:29:59 +0200 Subject: [PATCH 16/20] Update app/Console/Commands/KeyGet.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thor K. Høgås --- app/Console/Commands/KeyGet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/KeyGet.php b/app/Console/Commands/KeyGet.php index d479ac25f..c4ab3a567 100644 --- a/app/Console/Commands/KeyGet.php +++ b/app/Console/Commands/KeyGet.php @@ -18,7 +18,7 @@ class KeyGet extends Command * * @var string */ - protected $description = 'Get the currenlt application key'; + protected $description = 'Get the current application key'; /** * Execute the console command. From 97fcd1616ce84a8b505f9689cc7778d89ea7f1d3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:30:23 +0200 Subject: [PATCH 17/20] Update app/Console/Commands/UserMakeAdmin.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thor K. Høgås --- app/Console/Commands/UserMakeAdmin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/UserMakeAdmin.php b/app/Console/Commands/UserMakeAdmin.php index c0fa205b4..daa3e6714 100644 --- a/app/Console/Commands/UserMakeAdmin.php +++ b/app/Console/Commands/UserMakeAdmin.php @@ -21,7 +21,7 @@ class UserMakeAdmin extends Command * * @var string */ - protected $description = 'Makes the specificed user an admin'; + protected $description = 'Make the specified user into an admin'; /** * Execute the console command. From 5dd049158d16bf13a3a51ef2a5696f3a90d793e0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:31:57 +0200 Subject: [PATCH 18/20] user:makeadmin prompt rephrase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thor K. Høgås --- app/Console/Commands/UserMakeAdmin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/UserMakeAdmin.php b/app/Console/Commands/UserMakeAdmin.php index daa3e6714..ad034c4e2 100644 --- a/app/Console/Commands/UserMakeAdmin.php +++ b/app/Console/Commands/UserMakeAdmin.php @@ -37,7 +37,7 @@ public function handle() $this->info('User found: ' . $user->name); $areas = Area::all(); - $area = $this->choice('Which area? Practically admin has all access, but an area must be selected regardless.', $areas->pluck('name')->toArray()); + $area = $this->choice('Which area? The admin has access across areas, but an area must be selected regardless.', $areas->pluck('name')->toArray()); if ($area != null) { $area = Area::where('name', $area)->first(); From 99d3115ae6e63eb684b5742707cb9e54554b3feb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:34:06 +0200 Subject: [PATCH 19/20] Doc the `php artisan test` instead --- CONTRIBUTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md index 4bfe0e522..f376e0623 100644 --- a/CONTRIBUTE.md +++ b/CONTRIBUTE.md @@ -29,7 +29,7 @@ Run the command `php artisan migrate --database sqlite-testing` to setup the dat #### Test -To run the PHP unit tests use `./vendor/bin/phpunit --color=always --testdox`\ +To run the PHP unit tests use `php artisan test`\ The tests run with the local SQLite test database, not your development database. #### Quicker feedback during development From 05b3eb874843f9546c08882b8066d02d373851bb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 27 Jun 2023 22:48:18 +0200 Subject: [PATCH 20/20] docker exec -it documentation --- README.md | 22 ++++++++++++++++------ UPGRADE.md | 11 +++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 28c97ee82..bde81685c 100755 --- a/README.md +++ b/README.md @@ -31,17 +31,27 @@ To setup your Docker instance simply follow these steps: 1. Pull the `ghcr.io/vatsim-scandinavia/control-center:v4` Docker image 2. Setup your MySQL database (not included in Docker image) 3. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md#environment) -4. Run the container and access it with `docker exec -it control-center bash` - - Run `php artisan migrate` to setup the database - - To ensure that users will not need to login after each time you re-deploy/upgrade the container, run `php artisan key:get`. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. -5. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. -6. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. +4. Start the container in the background. +5. Setup the database. + ```sh + docker exec -it control-center php artisan migrate + ``` +6. To ensure that users will not need to log in after each time you re-deploy or upgrade the container, you need to create and store an application key in your environment. + ```sh + docker exec -it control-center php artisan key:get + ``` + Copy the key and set it as the `APP_KEY` environment variable in your Docker configuration. +7. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. +8. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. ## Configuring To have Control Center reflect your division correctly, you need to do some tweaks. -- Access your container with `docker exec -it control-center bash` and run give your user admin access by running `php artisan user:makeadmin` and following the instructions. Area need to be specified but can be any. +- Give your user admin access + ```sh + docker exec -it control-center php artisan user:makeadmin + ``` - You can now access `Administration -> Settings` in the menu to tweak the most basic settings for your division. - You are also required to configure logic and datasets in the MySQL database as described in [CONFIGURE.md](CONFIGURE.md#database) with examples diff --git a/UPGRADE.md b/UPGRADE.md index fa52c0910..55828a321 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -24,13 +24,20 @@ In the instructions where we use `docker exec` we assume your container is named 2. Configure the environment variables as described in the [CONFIGURE.md](CONFIGURE.md) 3. Start the container 4. Setup a crontab outside the container to run `* * * * * docker exec --user www-data -i control-center php artisan schedule:run >/dev/null` every minute. This patches into the container and runs the required cronjobs. -5. To ensure that users will not need to login after each time you re-deploy/upgrade the container, run `docker exec control-center php artisan key:get` from outside the container. Copy the key and set it as the `APP_KEY` environment variable in your docker configuration. +5. To ensure that users will not need to log in after each time you re-deploy or upgrade the container, you need to create and store an application key in your environment. + ```sh + docker exec -it control-center php artisan key:get + ``` + Copy the key and set it as the `APP_KEY` environment variable in your Docker configuration. 6. Bind the 8080 (HTTP) and/or 8443 (HTTPS) port to your reverse proxy or similar. #### Data Migration 1. Make sure that `DB_HANDOVER_` database config is present in your environment file or docker configuration. Do not remove this as it's required for the migration. -2. Run the migration with `php artisan migrate` inside the container, this will copy over the required data fields from Handover so CC can run on it's own +2. Run the migration, this will copy over the required data fields from Handover so CC can run on it's own + ```sh + docker exec -it control-center php artisan migrate + ``` 3. If the migration was successful you may now remove the `DB_HANDOVER_*` environment settings as it'll no longer be used. 4. If you don't want to use Handover at all anymore, you can at this point change the OAUTH environment settings to the VATSIM OAuth settings.