Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
adrenth committed Apr 16, 2022
2 parents 056ca2d + 5a7e309 commit 33a4555
Show file tree
Hide file tree
Showing 11 changed files with 171 additions and 67 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
54 changes: 54 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PHP Composer

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [ 8.0, 8.1 ]
stability: [ prefer-lowest, prefer-stable ]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: Add HTTP basic auth credentials
run: echo '${{ secrets.VDLP_OCTOBER_CMS_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Run test suite
# run: composer run-script test
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.0] - 2022-04-16

- Upgrade to Horizon 5.0 (requires October CMS 3.0)
- Checkout the README.md file for installation and configuration instructions.

### Added
- Add GitHub WorkFlow configuration.

### Changed
- Changed minimum PHP requirement to PHP 8.0.2
- Changed minimum October CMS version requirement to 3.0
- Use `horizon:install` instead of `horizon:assets` to publish the required assets for the Horizon Dashboard.
- Compare changes in the `config/horizon.php` file with `vendor/laravel/horizon/config/horizon.php`.

## [2.0.2] - 2022-03-08

### Changed
Expand Down
9 changes: 3 additions & 6 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Backend\Classes\AuthManager;
use Backend\Helpers\Backend;
use Backend\Models\User;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Notifications\NotificationServiceProvider;
use Laravel\Horizon\Horizon;
use System\Classes\PluginBase;
Expand Down Expand Up @@ -68,8 +67,6 @@ public function register(): void
{
$this->app->register(HorizonServiceProvider::class);
$this->app->register(NotificationServiceProvider::class);

AliasLoader::getInstance()->alias('Horizon', 'Laravel\Horizon\Horizon');
}

public function registerSchedule($schedule): void
Expand Down Expand Up @@ -110,20 +107,20 @@ public function registerMailTemplates(): array

private function bootNotificationSettings(): void
{
if ((bool) config('vdlp.horizon::mail_notifications_enabled', false)) {
if (config('vdlp.horizon::mail_notifications_enabled', false) === true) {
Horizon::routeMailNotificationsTo(
config('vdlp.horizon::mail_notifications_to')
);
}

if ((bool) config('vdlp.horizon::slack_notifications_enabled', false)) {
if (config('vdlp.horizon::slack_notifications_enabled', false) === true) {
Horizon::routeSlackNotificationsTo(
config('vdlp.horizon::slack_notifications_webhook_url'),
config('vdlp.horizon::slack_notifications_channel')
);
}

if ((bool) config('vdlp.horizon::sms_notifications_enabled', false)) {
if (config('vdlp.horizon::sms_notifications_enabled', false) === true) {
Horizon::routeSmsNotificationsTo(
config('vdlp.horizon::sms_notifications_to')
);
Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Vdlp.Horizon

Provides a seamless integration of [Laravel Horizon 3.0](https://laravel.com/docs/6.x/horizon) inside October CMS.
Provides a seamless integration of [Laravel Horizon 5.0](https://laravel.com/docs/9.x/horizon) inside October CMS.

![Laravel Horizon Logo](https://plugins.vdlp.nl/octobercms/oc-horizon-plugin/logo.png)

Expand All @@ -18,10 +18,10 @@ Horizon is 100% open source, so you're free to dig through the source to see exa

## Requirements

* October CMS 1.0 or higher
* PHP 7.4 or PHP 8.0+
* October CMS 3.0
* PHP 8.0.2 or higher
* PHP extensions: `ext-pcntl`, `ext-posix` and `ext-redis`.
* Supervisor, see [Laravel 6.x supervisor configuration](https://laravel.com/docs/6.x/queues#supervisor-configuration).
* Supervisor, see [Laravel 9.x supervisor configuration](https://laravel.com/docs/9.x/queues#supervisor-configuration).

## Installation

Expand All @@ -38,9 +38,6 @@ You should add the `dont-discover` option to your projects `composer.json` file

```
"extra": {
"merge-plugin": {
...
},
"laravel": {
"dont-discover": [
"laravel/horizon"
Expand All @@ -64,10 +61,10 @@ php artisan horizon:install
To update the Horizon Assets you can use the following command:

```
php artisan horizon:assets
php artisan horizon:publish
```

> IMPORTANT: Add the above command to your deployment logic. This way the assets will always be up to date on your staging or production environment.
> IMPORTANT: Add the above command to your deployment logic or composer update scripts. This way the assets will always be up to date on your staging or production environment.
* Configure Laravel Horizon settings file at `config/horizon.php`, please make sure `use` contains `horizon` (see the configuration snippet below).

Expand Down Expand Up @@ -226,7 +223,7 @@ php artisan vdlp:horizon:push-example-jobs

Please go to the Laravel website for detailed documentation about Laravel Horizon.

[Horizon for Laravel 6.x](https://laravel.com/docs/6.x/horizon)
[Horizon for Laravel 9.x](https://laravel.com/docs/9.x/horizon)

## Questions

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
"email": "octobercms@vdlp.nl"
},
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0.2",
"ext-pcntl": "*",
"ext-posix": "*",
"ext-redis": "*",
"composer/installers": "^1.0 || ^2.0",
"laravel/horizon": "^3.0",
"october/system": "^1.0 || ^2.0"
"laravel/horizon": "^5.0",
"october/system": "^3.0"
},
"archive": {
"exclude": [
Expand Down
28 changes: 28 additions & 0 deletions http/controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Vdlp\Horizon\Http\Controllers;

use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\App;
use Illuminate\View\View;
use Laravel\Horizon\Horizon;
use Laravel\Horizon\Http\Controllers\Controller;
use Vdlp\Horizon\Classes\PathHelper;

final class HomeController extends Controller
{
/**
* Single page application catch-all route.
*/
public function index(PathHelper $pathHelper): Factory|View
{
return view('horizon::layout', [
'assetsAreCurrent' => $pathHelper->assetsAreCurrent(),
'cssFile' => Horizon::$useDarkTheme ? 'app-dark.css' : 'app.css',
'horizonScriptVariables' => Horizon::scriptVariables(),
'isDownForMaintenance' => App::isDownForMaintenance(),
]);
}
}
43 changes: 0 additions & 43 deletions routes.php

This file was deleted.

17 changes: 17 additions & 0 deletions serviceproviders/HorizonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Vdlp\Horizon\ServiceProviders;

use Illuminate\Support\Facades\Route;
use Laravel\Horizon;
use Laravel\Horizon\HorizonServiceProvider as HorizonServiceProviderBase;
use Vdlp\Horizon\Listeners\SendNotification;
Expand All @@ -30,4 +31,20 @@ protected function registerResources(): void
{
$this->loadViewsFrom(plugins_path('vdlp/horizon/views'), 'horizon');
}

protected function registerRoutes(): void
{
parent::registerRoutes();

Route::group([
'domain' => config('horizon.domain'),
'prefix' => config('horizon.path'),
'namespace' => 'Vdlp\Horizon\Http\Controllers',
'middleware' => config('horizon.middleware', 'web'),
], static function (): void {
Route::get('/{view?}', 'HomeController@index')
->where('view', '(.*)')
->name('horizon.index');
});
}
}
1 change: 1 addition & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ v1.0.0: "First version of Vdlp.Horizon"
v2.0.0: "Removed the dependency of the October CMS module. Moved Horizon Assets. See CHANGELOG for more details."
v2.0.1: "Update plugin documentation"
v2.0.2: "Maintenance release"
v3.0.0: "Upgrade to Horizon 5.x"
38 changes: 33 additions & 5 deletions views/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
<path class="fill-primary" d="M5.26176342 26.4094389C2.04147988 23.6582233 0 19.5675182 0 15c0-4.1421356 1.67893219-7.89213562 4.39339828-10.60660172C7.10786438 1.67893219 10.8578644 0 15 0c8.2842712 0 15 6.71572875 15 15 0 8.2842712-6.7157288 15-15 15-3.716753 0-7.11777662-1.3517984-9.73823658-3.5905611zM4.03811305 15.9222506C5.70084247 14.4569342 6.87195416 12.5 10 12.5c5 0 5 5 10 5 3.1280454 0 4.2991572-1.9569336 5.961887-3.4222502C25.4934253 8.43417206 20.7645408 4 15 4 8.92486775 4 4 8.92486775 4 15c0 .3105915.01287248.6181765.03811305.9222506z"/>
</svg>

<h4 class="mb-0 ml-2"><strong>Laravel</strong> Horizon{{ config('app.name') ? ' - ' . config('app.name') : '' }}</h4>
<h4 class="mb-0 ml-2">
<strong>Laravel</strong> Horizon{{ config('app.name') ? ' - ' . config('app.name') : '' }}</h4>

<button class="btn btn-outline-primary ml-auto" :class="{active: autoLoadsNewEntries}" v-on:click.prevent="autoLoadNewEntries" title="Auto Load Entries">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" class="icon fill-primary">
Expand Down Expand Up @@ -66,11 +67,27 @@
</router-link>
</li>
<li class="nav-item">
<router-link active-class="active" to="/recent-jobs" class="nav-link d-flex align-items-center">
<router-link active-class="active" to="/batches" class="nav-link d-flex align-items-center">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M3.94 6.5L2.22 3.64l1.42-1.42L6.5 3.94c.52-.3 1.1-.54 1.7-.7L9 0h2l.8 3.24c.6.16 1.18.4 1.7.7l2.86-1.72 1.42 1.42-1.72 2.86c.3.52.54 1.1.7 1.7L20 9v2l-3.24.8c-.16.6-.4 1.18-.7 1.7l1.72 2.86-1.42 1.42-2.86-1.72c-.52.3-1.1.54-1.7.7L11 20H9l-.8-3.24c-.6-.16-1.18-.4-1.7-.7l-2.86 1.72-1.42-1.42 1.72-2.86c-.3-.52-.54-1.1-.7-1.7L0 11V9l3.24-.8c.16-.6.4-1.18.7-1.7zM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"></path>
<path d="M1 1h18v2H1V1zm0 8h18v2H1V9zm0 8h18v2H1v-2zM1 5h18v2H1V5zm0 8h18v2H1v-2z"/>
</svg>
<span>Recent Jobs</span>
<span>Batches</span>
</router-link>
</li>
<li class="nav-item">
<router-link active-class="active" to="/jobs/pending" class="nav-link d-flex align-items-center">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM7 6h2v8H7V6zm4 0h2v8h-2V6z"/>
</svg>
<span>Pending Jobs</span>
</router-link>
</li>
<li class="nav-item">
<router-link active-class="active" to="/jobs/completed" class="nav-link d-flex align-items-center">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM6.7 9.29L9 11.6l4.3-4.3 1.4 1.42L9 14.4l-3.7-3.7 1.4-1.42z"></path>
</svg>
<span>Completed Jobs</span>
</router-link>
</li>
<li class="nav-item">
Expand All @@ -85,6 +102,18 @@
</div>

<div class="col-10">
@if (! $assetsAreCurrent)
<div class="alert alert-warning">
The published Horizon assets are not up-to-date with the installed version. To update, run:<br/><code>php artisan horizon:publish</code>
</div>
@endif

@if ($isDownForMaintenance)
<div class="alert alert-warning">
This application is in "maintenance mode". Queued jobs may not be processed unless your worker is using the "force" flag.
</div>
@endif

<router-view></router-view>
</div>
</div>
Expand All @@ -97,6 +126,5 @@
</script>

<script src="{!! $helper->getAssetsUrlPath('app.js') !!}"></script>

</body>
</html>

0 comments on commit 33a4555

Please sign in to comment.