├── LICENSE.md ├── README.md ├── composer.json ├── config └── failedjobs.php ├── package.json ├── public ├── app-dark.css ├── app.css ├── app.js ├── img │ ├── failedjobs.svg │ ├── favicon.png │ └── sprite.svg └── mix-manifest.json ├── resources ├── img │ └── favicon.png ├── js │ ├── app.js │ ├── base.js │ ├── components │ │ ├── SchemeToggler.vue │ │ └── Stacktrace.vue │ ├── routes.js │ └── screens │ │ └── failedJobs │ │ ├── index.vue │ │ └── job.vue ├── sass │ ├── _colors.scss │ ├── app-dark.scss │ ├── app.scss │ ├── base.scss │ └── syntaxhighlight.scss └── views │ └── layout.blade.php ├── routes └── web.php ├── src ├── Console │ ├── InstallCommand.php │ └── PublishCommand.php ├── Exceptions │ └── ForbiddenException.php ├── FailedJobs.php ├── FailedJobsApplicationServiceProvider.php ├── FailedJobsServiceProvider.php └── Http │ ├── Controllers │ ├── Controller.php │ ├── FailedJobsController.php │ └── HomeController.php │ └── Middleware │ └── Authenticate.php ├── stubs └── FailedJobsServiceProvider.stub ├── testbench.yaml ├── webpack.mix.js └── workbench ├── app └── Providers │ └── FailedJobsServiceProvider.php └── database ├── factories └── .gitkeep ├── migrations └── .gitkeep └── seeders └── DatabaseSeeder.php /LICENSE.md: -------------------------------------------------------------------------------- 1 | Original MIT License (as used in this project): 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) Taylor Otwell 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | 25 | 26 | The MIT License (MIT) 27 | 28 | Copyright (c) Hamed Panjeh 29 | 30 | Permission is hereby granted, free of charge, to any person obtaining a copy 31 | of this software and associated documentation files (the "Software"), to deal 32 | in the Software without restriction, including without limitation the rights 33 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 34 | copies of the Software, and to permit persons to whom the Software is 35 | furnished to do so, subject to the following conditions: 36 | 37 | The above copyright notice and this permission notice shall be included in 38 | all copies or substantial portions of the Software. 39 | 40 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 42 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 43 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 44 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 45 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 46 | THE SOFTWARE. 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Build Status 3 | Latest Stable Version 4 | License 5 |

6 | 7 | # Laravel Failed Jobs 8 | 9 | ## Introduction: 10 | 11 | If you're running an application with a queue driver other than Redis or dispatch a job to 12 | [a particular connection](https://laravel.com/docs/10.x/queues#dispatching-to-a-particular-connection) 13 | other than Redis, which is exclusively supported by [Laravel Horizon](https://laravel.com/docs/10.x/horizon), 14 | you might be missing out on the elegant features that Horizon offers. 15 | Laravel Horizon is known for its elegance and a wide range of implemented features. 16 | One of its standout features is its ability to present detailed information about failed job payloads 17 | and automatically load new failed jobs. 18 | 19 | In your specific application, if you've been longing for a similar Horizon-like UI to monitor failed jobs, 20 | the Laravel-Failed-Jobs package has got you covered. This package streamlines the visualization of failed jobs, 21 | eliminating the need to connect to a database client and search through `failed_jobs` records to identify 22 | the cause of a job's failure. 23 | 24 | ![Screenshot 2024-02-01 at 7 55 42 PM](https://github.com/HPWebdeveloper/laravel-failed-jobs/assets/16323354/2ec7ebad-1ad9-4927-8bff-5ce4002e1a7c) 25 | 26 | ## Key Benefits: 27 | 28 | - Seamless Integration: You can seamlessly integrate the Laravel-Failed-Jobs package into your project, 29 | even if you are already using Laravel Horizon. There's no conflict between the two. 30 | - While Horizon primarily reads and writes data to Redis, Laravel-Failed-Jobs retrieves 31 | data from the failed_jobs table. 32 | - With Laravel-Failed-Jobs, you can enjoy the convenience of monitoring failed jobs in your application, 33 | regardless of your queue driver. This package brings the elegance 34 | of Laravel Horizon's failed jobs UI to your specific setup. 35 | - Remote Connection Mode: This package offers two operational modes, each with its distinct setup. 36 | The Basic mode setup enabling dashboard authentication mirror that of Laravel Horizon. 37 | Remote mode is particularly beneficial for applications functioning solely as API service providers, 38 | where there is no user model or admin user. 39 | In such scenarios, the Gate definition within `FailedJobsServiceProvider`, 40 | which typically restricts access the Laravel-Failed-Jobs dashboard in non-local environments, 41 | is not applicable. 42 | Remote mode enables access to the main application from a separate Laravel application, 43 | hosted on a distinct URL address, in both local and production environments. 44 | 45 | As you correctly understood, it's important to note that the Laravel-Failed-Jobs package focuses 46 | solely on enhancing the visualization of failed jobs and does not offer managing of failed jobs or 47 | the comprehensive set of robust features found in Laravel Horizon. 48 | 49 | ## I - Installation (basic mode): 50 | If you have already installed Laravel Horizon, you can still install Laravel-Failed-Jobs without any conflict. 51 | Also it follows the same installation process as Laravel Horizon. 52 | 53 | You may install Laravel-Failed-Jobs package into your project using the Composer package manager: 54 | 55 | ```bash 56 | composer require hpwebdeveloper/laravel-failed-jobs 57 | ``` 58 | 59 | After installing Laravel-Failed-Jobs, publish the assets using the `failedjobs:install` Artisan command. 60 | ```bash 61 | php artisan failedjobs:install 62 | ``` 63 | This command will automatically publish the `failedjobs` config file, `FailedJobsServiceProvider` 64 | service provider and also the resource view files into the `public/vendor/failedjobs` directory. 65 | 66 | To upgrade the package, you need to use the following command after upgrading via composer: 67 | 68 | ```bash 69 | php artisan failedjobs:publish 70 | ``` 71 | 72 | You may need to modify the `FailedJobsServiceProvider` to determine 73 | who can access the dashboard in production environment. 74 | 75 | 76 | ## Dashboard 77 | 78 | The Laravel-Failed-Jobs dashboard is accessible through the `/failedjobs` route by default. 79 | However, if you wish to define a new path, you can do so by setting the `FAILEDJOBS_PATH` variable in the `.env` file. 80 | 81 | ## Dashboard Authorization 82 | 83 | The`app/Providers/FailedJobsServiceProvider.php` class applies Laravel `Gate` to determine 84 | who can access FailedJobs in non-local environments. You need to follow the 85 | [same document of Horizon](https://laravel.com/docs/10.x/horizon#dashboard-authorization) 86 | to secure the dashboard in production environment. 87 | 88 | ![Screenshot 2024-02-01 at 7 54 17 PM](https://github.com/HPWebdeveloper/laravel-failed-jobs/assets/16323354/05abc4ab-ede6-4e90-b713-bc540015435d) 89 | 90 | ![Screenshot 2024-02-01 at 7 55 27 PM](https://github.com/HPWebdeveloper/laravel-failed-jobs/assets/16323354/30e1dd9e-316b-4d8e-80a4-ef7df195bbcd) 91 | 92 | ## II - Installation (remote mode): 93 | Remote mode enables access to the main application from a separate Laravel application, 94 | hosted on a distinct URL address, in both local and production environments. 95 | 96 | ### Prepare package in both applications 97 | To use this package in remote mode, you need to install the package in both main and remote applications. 98 | 99 | You may install the Laravel-Failed-Jobs package into your project using the composer package manager: 100 | 101 | Note: currently the remote feature is under `feature/remote-connect` branch. 102 | ```bash 103 | composer require hpwebdeveloper/laravel-failed-jobs:dev-feature/remote-connect 104 | ``` 105 | Then install the assets using the `failedjobs:install` Artisan command. 106 | ```bash 107 | php artisan failedjobs:install 108 | ``` 109 | 110 | ### Prepare the environments variables 111 | 112 | In this mode you need to propertly configure the following environment variables in both applications: 113 | 114 | ```bash 115 | 'axios_base_url' => env('AXIOS_BASE_URL', ''), 116 | 'server_access_token' => env('FAILEDJOBS_SERVER_ACCESS_TOKEN'), 117 | 'dashboard_access_token' => env('FAILEDJOBS_DASHBOARD_ACCESS_TOKEN'), 118 | ``` 119 | 120 | `axios_base_url` is the base URL of the main application which you have to set in the local/remote application. 121 | Setting this variable is mandatory in remote mode. 122 | 123 | `server_access_token` is the access token to access the main application from the remote application. 124 | It is mandatory to set this variable in the main application `.env` file. 125 | It is mandatory to set `dashboard_access_token` variable in the 126 | remote application equal to the value of the `server_access_token` in the main application. 127 | 128 | ### Secure the endpoint 129 | As in the `failedjobs` config file defined, the dashboard is accessible through the `/failedjobs` route 130 | by default. 131 | But it is recommended to change it when using the package in the remote mode. 132 | 133 | It is simply possible by setting the `FAILEDJOBS_PATH` variable in the `.env` 134 | file of both applications with a hash value and then define that value as a path in the `cors` config file 135 | of the main application. 136 | 137 | Modifying the `cors` config file in the main application is required because in the remote mode we are 138 | dealing with two different applications served in two different URLs. 139 | Laravel automatically respond to Cross-Origin Resource Sharing (CORS) 140 | OPTIONS HTTP requests with values that you configure in the `cors` config file. 141 | Read more about [CORS](https://laravel.com/docs/10.x/routing#cors). 142 | 143 | Hence in summary 144 | - Set the `FAILEDJOBS_PATH` variable in the `.env` file of the **main** application 145 | with a hash value like `failedjobs_4a5b6c7d` 146 | - Set the `FAILEDJOBS_PATH` variable in the `.env` file of the **remote** application 147 | with a hash value like `failedjobs_4a5b6c7d` 148 | - Open the `cors.php` config file of the main application and modify the following code accordingly: 149 | ```php 150 | // before 151 | 'paths' => ['api/*', 'sanctum/csrf-cookie'], 152 | // after 153 | 'paths' => ['failedjobs_4a5b6c7d/*', 'api/*', 'sanctum/csrf-cookie'], 154 | ``` 155 | 156 | Then access the dashboard using the following URL: `http://your-local-application.test/failedjobs_4a5b6c7d`. 157 | 158 | As your main application is configured like `APP_ENV=production` 159 | the Failed-Jobs dashboard is not accessible in the production environment. 160 | While you can access the dashboard in the local environment through this URL: `http://your-local-application.test/failedjobs_4a5b6c7d`. 161 | 162 | Of course you can access the dashboard in the main application 163 | if you set the `axios_base_url` variable in the main application `.env` file as well. 164 | 165 | ## Licensing 166 | 167 | This repository uses two licenses: 168 | 169 | - The original codebase is distributed under the MIT License (MIT) (Copyright (c) Taylor Otwell), 170 | which you can find in the [LICENSE](https://github.com/HPWebdeveloper/laravel-failed-jobs/blob/main/LICENSE.md) file. 171 | 172 | - Any modifications made to the original codebase are subject to our own license, 173 | which you can find in the [LICENSE](https://github.com/HPWebdeveloper/laravel-failed-jobs/blob/main/LICENSE.md) file. 174 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hpwebdeveloper/laravel-failed-jobs", 3 | "description": "UI for Laravel failed jobs.", 4 | "keywords": ["laravel", "failed", "jobs"], 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Hamed Panjeh", 9 | "email": "panjeh@gmail.com" 10 | } 11 | ], 12 | "require": { 13 | "php": "^7.3|^8.0", 14 | "ext-json": "*", 15 | "ext-pcntl": "*", 16 | "ext-posix": "*", 17 | "illuminate/contracts": "^8.17|^9.0|^10.0|^11.0", 18 | "illuminate/queue": "^8.17|^9.0|^10.0|^11.0", 19 | "illuminate/support": "^8.17|^9.0|^10.0|^11.0", 20 | "nesbot/carbon": "^2.17", 21 | "ramsey/uuid": "^4.0", 22 | "symfony/process": "^5.0|^6.0|^7.0", 23 | "symfony/error-handler": "^5.0|^6.0|^7.0" 24 | }, 25 | "require-dev": { 26 | "mockery/mockery": "^1.0", 27 | "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0", 28 | "phpstan/phpstan": "^1.10", 29 | "phpunit/phpunit": "^9.0|^10.4", 30 | "predis/predis": "^1.1|^2.0" 31 | }, 32 | "suggest": { 33 | "ext-redis": "Required to use the Redis PHP driver.", 34 | "predis/predis": "Required when not using the Redis PHP driver (^1.1|^2.0)." 35 | }, 36 | "autoload": { 37 | "psr-4": { 38 | "HPWebdeveloper\\LaravelFailedJobs\\": "src/" 39 | } 40 | }, 41 | "autoload-dev": { 42 | "psr-4": { 43 | "HPWebdeveloper\\LaravelFailedJobs\\Tests\\": "tests/", 44 | "Workbench\\App\\": "workbench/app/", 45 | "Workbench\\Database\\Factories\\": "workbench/database/factories/", 46 | "Workbench\\Database\\Seeders\\": "workbench/database/seeders/" 47 | } 48 | }, 49 | "extra": { 50 | "laravel": { 51 | "providers": [ 52 | "HPWebdeveloper\\LaravelFailedJobs\\FailedJobsServiceProvider" 53 | ], 54 | "aliases": { 55 | "FailedJobs": "HPWebdeveloper\\LaravelFailedJobs\\FailedJobs" 56 | } 57 | } 58 | }, 59 | "config": { 60 | "sort-packages": true 61 | }, 62 | "minimum-stability": "dev", 63 | "prefer-stable": true, 64 | "scripts": { 65 | "lint": [ 66 | "@php vendor/bin/phpstan analyse" 67 | ], 68 | "test": [ 69 | "@php vendor/bin/phpunit" 70 | ] 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /config/failedjobs.php: -------------------------------------------------------------------------------- 1 | env('FAILEDJOBS_DOMAIN'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | FailedJobs Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This is the URI path where FailedJobs will be accessible from. Feel free 26 | | to change this path to anything you like. Note that the URI will not 27 | | affect the paths of its internal API that aren't exposed to users. 28 | | 29 | */ 30 | 31 | 'path' => env('FAILEDJOBS_PATH', 'failedjobs'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | FailedJobs Route Middleware 36 | |-------------------------------------------------------------------------- 37 | | 38 | | These middleware will get attached onto each FailedJobs route, giving you 39 | | the chance to add your own middleware to this list or change any of 40 | | the existing middleware. Or, you can simply stick with this list. 41 | | 42 | */ 43 | 44 | 'middleware' => ['web'], 45 | 46 | ]; 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "mix", 6 | "watch": "mix watch", 7 | "watch-poll": "mix watch -- --watch-options-poll=1000", 8 | "hot": "mix watch --hot", 9 | "prod": "npm run production", 10 | "production": "mix --production" 11 | }, 12 | "devDependencies": { 13 | "axios": "^1.6.0", 14 | "bootstrap": "^4.3.1", 15 | "highlight.js": "^10.4.1", 16 | "jquery": "^3.5.0", 17 | "laravel-mix": "^6.0.13", 18 | "md5": "^2.2.1", 19 | "moment": "^2.29.4", 20 | "moment-timezone": "^0.5.35", 21 | "phpunserialize": "1.*", 22 | "popper.js": "^1.12", 23 | "resolve-url-loader": "^5.0.0", 24 | "sass": "^1.26.3", 25 | "sass-loader": "^11.0.1", 26 | "sql-formatter": "^4.0.2", 27 | "vue": "^2.5.7", 28 | "vue-json-pretty": "^1.4.1", 29 | "vue-loader": "^15.9.6", 30 | "vue-router": "^3.0.1", 31 | "vue-template-compiler": "^2.5.21" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /public/img/failedjobs.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /public/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HPWebdeveloper/laravel-failed-jobs/f539156a56c7c83caf93bb5ded3d6a579dc34776/public/img/favicon.png -------------------------------------------------------------------------------- /public/img/sprite.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 801 | 802 | 803 | 805 | 806 | -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/app.js": "/app.js?id=3bbefa933420c320ec2937071af50c33", 3 | "/app-dark.css": "/app-dark.css?id=2f61dc709214cae8cc7a77603b1ba389", 4 | "/app.css": "/app.css?id=43830728727b0f59dc16b9a11f09f077", 5 | "/img/failedjobs.svg": "/img/failedjobs.svg?id=904d5b5185fefb09035384e15bfca765", 6 | "/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f", 7 | "/img/sprite.svg": "/img/sprite.svg?id=afc4952b74895bdef3ab4ebe9adb746f" 8 | } 9 | -------------------------------------------------------------------------------- /resources/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HPWebdeveloper/laravel-failed-jobs/f539156a56c7c83caf93bb5ded3d6a579dc34776/resources/img/favicon.png -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Base from './base'; 3 | import axios from 'axios'; 4 | import Routes from './routes'; 5 | import VueRouter from 'vue-router'; 6 | import VueJsonPretty from 'vue-json-pretty'; 7 | 8 | window.Popper = require('popper.js').default; 9 | 10 | try { 11 | window.$ = window.jQuery = require('jquery'); 12 | 13 | require('bootstrap'); 14 | } catch (e) {} 15 | 16 | let token = document.head.querySelector('meta[name="csrf-token"]'); 17 | 18 | axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 19 | 20 | if (token) { 21 | axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 22 | } 23 | 24 | Vue.use(VueRouter); 25 | 26 | Vue.prototype.$http = axios.create(); 27 | 28 | window.FailedJobs.basePath = '/' + window.FailedJobs.path; 29 | 30 | let routerBasePath = window.FailedJobs.basePath + '/'; 31 | 32 | if (window.FailedJobs.path === '' || window.FailedJobs.path === '/') { 33 | routerBasePath = '/'; 34 | window.FailedJobs.basePath = ''; 35 | } 36 | 37 | const router = new VueRouter({ 38 | routes: Routes, 39 | mode: 'history', 40 | base: routerBasePath, 41 | }); 42 | 43 | Vue.component('vue-json-pretty', VueJsonPretty); 44 | Vue.component('scheme-toggler', require('./components/SchemeToggler.vue').default); 45 | 46 | Vue.mixin(Base); 47 | 48 | Vue.directive('tooltip', function (el, binding) { 49 | $(el).tooltip({ 50 | title: binding.value, 51 | placement: binding.arg, 52 | trigger: 'hover', 53 | }); 54 | }); 55 | 56 | new Vue({ 57 | el: '#failedJobs', 58 | 59 | router, 60 | 61 | data() { 62 | return { 63 | autoLoadsNewEntries: localStorage.autoLoadsNewEntries === '1', 64 | }; 65 | }, 66 | }); 67 | -------------------------------------------------------------------------------- /resources/js/base.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment-timezone'; 2 | 3 | export default { 4 | 5 | methods: { 6 | /** 7 | * Format the given date with respect to timezone. 8 | */ 9 | formatDate(unixTime) { 10 | return moment(unixTime * 1000).add(new Date().getTimezoneOffset() / 60); 11 | }, 12 | 13 | /** 14 | * Format the given date with respect to timezone. 15 | */ 16 | formatDateIso(date) { 17 | return moment(date).add(new Date().getTimezoneOffset() / 60); 18 | }, 19 | 20 | /** 21 | * Autoload new entries in listing screens. 22 | */ 23 | autoLoadNewEntries() { 24 | if (!this.autoLoadsNewEntries) { 25 | this.autoLoadsNewEntries = true; 26 | localStorage.autoLoadsNewEntries = 1; 27 | } else { 28 | this.autoLoadsNewEntries = false; 29 | localStorage.autoLoadsNewEntries = 0; 30 | } 31 | }, 32 | 33 | /** 34 | * Convert to human readable timestamp. 35 | */ 36 | readableTimestamp(timestamp) { 37 | return this.formatDate(timestamp).format('YYYY-MM-DD HH:mm:ss'); 38 | }, 39 | 40 | }, 41 | }; 42 | -------------------------------------------------------------------------------- /resources/js/components/SchemeToggler.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 66 | -------------------------------------------------------------------------------- /resources/js/components/Stacktrace.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 38 | 39 | 42 | -------------------------------------------------------------------------------- /resources/js/routes.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | path: '/', 4 | name: 'dashboard', 5 | component: require('./screens/failedJobs/index').default, 6 | }, 7 | { 8 | path: '/:jobId', 9 | name: 'failed-jobs-preview', 10 | component: require('./screens/failedJobs/job').default, 11 | }, 12 | ]; 13 | -------------------------------------------------------------------------------- /resources/js/screens/failedJobs/index.vue: -------------------------------------------------------------------------------- 1 | 133 | 134 | 198 | -------------------------------------------------------------------------------- /resources/js/screens/failedJobs/job.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 45 | 113 | -------------------------------------------------------------------------------- /resources/sass/_colors.scss: -------------------------------------------------------------------------------- 1 | $white: #ffffff; 2 | $black: #000000; 3 | 4 | $gray-50: #f9fafb; 5 | $gray-100: #f3f4f6; 6 | $gray-200: #e5e7eb; 7 | $gray-300: #d1d5db; 8 | $gray-400: #9ca3af; 9 | $gray-500: #6b7280; 10 | $gray-600: #4b5563; 11 | $gray-700: #374151; 12 | $gray-800: #1f2937; 13 | $gray-900: #111827; 14 | 15 | $red-50: #fef2f2; 16 | $red-100: #fee2e2; 17 | $red-200: #fecaca; 18 | $red-300: #fca5a5; 19 | $red-400: #f87171; 20 | $red-500: #ef4444; 21 | $red-600: #dc2626; 22 | $red-700: #b91c1c; 23 | $red-800: #991b1b; 24 | $red-900: #7f1d1d; 25 | 26 | $amber-50: #fffbeb; 27 | $amber-100: #fef3c7; 28 | $amber-200: #fde68a; 29 | $amber-300: #fcd34d; 30 | $amber-400: #fbbf24; 31 | $amber-500: #f59e0b; 32 | $amber-600: #d97706; 33 | $amber-700: #b45309; 34 | $amber-800: #92400e; 35 | $amber-900: #78350f; 36 | 37 | $emerald-50: #ecfdf5; 38 | $emerald-100: #d1fae5; 39 | $emerald-200: #a7f3d0; 40 | $emerald-300: #6ee7b7; 41 | $emerald-400: #34d399; 42 | $emerald-500: #10b981; 43 | $emerald-600: #059669; 44 | $emerald-700: #047857; 45 | $emerald-800: #065f46; 46 | $emerald-900: #064e3b; 47 | 48 | $blue-50: #eff6ff; 49 | $blue-100: #dbeafe; 50 | $blue-200: #bfdbfe; 51 | $blue-300: #93c5fd; 52 | $blue-400: #60a5fa; 53 | $blue-500: #3b82f6; 54 | $blue-600: #2563eb; 55 | $blue-700: #1d4ed8; 56 | $blue-800: #1e40af; 57 | $blue-900: #1e3a8a; 58 | 59 | $violet-50: #f5f3ff; 60 | $violet-100: #ede9fe; 61 | $violet-200: #ddd6fe; 62 | $violet-300: #c4b5fd; 63 | $violet-400: #a78bfa; 64 | $violet-500: #8b5cf6; 65 | $violet-600: #7c3aed; 66 | $violet-700: #6d28d9; 67 | $violet-800: #5b21b6; 68 | $violet-900: #4c1d95; 69 | -------------------------------------------------------------------------------- /resources/sass/app-dark.scss: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | 3 | $font-family-base: Figtree, sans-serif; 4 | $font-weight-bold: 600; 5 | $font-size-base: 1rem; 6 | $badge-font-size: 0.875rem; 7 | 8 | $primary: $violet-500; 9 | $secondary: $gray-500; 10 | $success: $emerald-500; 11 | $info: $blue-500; 12 | $warning: $amber-500; 13 | $danger: $red-500; 14 | 15 | $body-bg: $gray-900; 16 | $body-color: $gray-100; 17 | 18 | $text-muted: $gray-400; 19 | 20 | $border-radius-lg: 6px; 21 | 22 | $logo-color: $gray-200; 23 | 24 | $link-color: $violet-400; 25 | $link-hover-color: $violet-300; 26 | 27 | $sidebar-nav-color: $gray-400; 28 | $sidebar-nav-hover-color: $gray-300; 29 | $sidebar-nav-hover-bg: $gray-800; 30 | $sidebar-nav-icon-color: $gray-500; 31 | $sidebar-nav-active-bg: $gray-800; 32 | $sidebar-nav-active-color: $violet-400; 33 | $sidebar-nav-active-icon-color: $violet-500; 34 | 35 | $pill-link: $gray-400; 36 | $pill-link-active: $violet-400; 37 | $pill-link-hover: $gray-200; 38 | 39 | $border-color: $gray-600; 40 | $table-border-color: $gray-700; 41 | $table-headers-color: $gray-800; 42 | $table-hover-bg: $gray-700; 43 | 44 | $header-border-color: $table-border-color; 45 | 46 | $input-bg: $gray-800; 47 | $input-color: $gray-200; 48 | $input-border-color: $border-color; 49 | 50 | $card-cap-bg: $gray-700; 51 | $card-bg-secondary: $gray-800; 52 | $card-bg: $gray-800; 53 | $card-border-radius: $border-radius-lg; 54 | 55 | $code-bg: #292d3e; 56 | 57 | $modal-content-bg: $table-headers-color; 58 | $modal-backdrop-bg: $gray-600; 59 | $modal-footer-border-color: $input-border-color; 60 | $modal-header-border-color: $input-border-color; 61 | 62 | $new-entries-bg: $violet-900; 63 | $new-code-entries-bg: $gray-600; 64 | 65 | $control-action-icon-color: $gray-500; 66 | $control-action-icon-hover: $violet-400; 67 | 68 | $nav-pills-link-active-bg: $gray-800; 69 | 70 | $dropdown-bg: $gray-700; 71 | $dropdown-link-color: $white; 72 | 73 | $btn-muted-color: $gray-400; 74 | $btn-muted-bg: $gray-800; 75 | $btn-muted-hover-color: $gray-300; 76 | $btn-muted-hover-bg: $gray-700; 77 | $btn-muted-active-color: $white; 78 | $btn-muted-active-bg: $primary; 79 | 80 | $badge-secondary-bg: $gray-300; 81 | $badge-secondary-color: $gray-700; 82 | $badge-success-bg: $emerald-500; 83 | $badge-success-color: $white; 84 | $badge-info-bg: $blue-500; 85 | $badge-info-color: $white; 86 | $badge-warning-bg: $amber-500; 87 | $badge-warning-color: $white; 88 | $badge-danger-bg: $red-500; 89 | $badge-danger-color: $white; 90 | 91 | $grid-breakpoints: ( 92 | xs: 0, 93 | sm: 2px, 94 | md: 8px, 95 | lg: 9px, 96 | xl: 10px 97 | ) !default; 98 | 99 | $container-max-widths: ( 100 | sm: 1137px, 101 | md: 1138px, 102 | lg: 1139px, 103 | xl: 1140px 104 | ) !default; 105 | 106 | @import 'base'; 107 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | 3 | $font-family-base: Figtree, sans-serif; 4 | $font-weight-bold: 600; 5 | $font-size-base: 1rem; 6 | $badge-font-size: 0.875rem; 7 | 8 | $primary: #7746ec; 9 | $secondary: $gray-500; 10 | $success: $emerald-500; 11 | $info: $blue-500; 12 | $warning: $amber-500; 13 | $danger: $red-500; 14 | 15 | $body-bg: $gray-100; 16 | $body-color: $gray-900; 17 | 18 | $text-muted: $gray-500; 19 | 20 | $border-radius-lg: 6px; 21 | 22 | $btn-focus-width: 0; 23 | 24 | $logo-color: $gray-700; 25 | 26 | $sidebar-nav-color: $gray-600; 27 | $sidebar-nav-hover-color: $primary; 28 | $sidebar-nav-hover-bg: $gray-200; 29 | $sidebar-nav-icon-color: $gray-400; 30 | $sidebar-nav-active-bg: $gray-200; 31 | $sidebar-nav-active-color: $primary; 32 | $sidebar-nav-active-icon-color: $primary; 33 | 34 | $pill-link: $gray-600; 35 | $pill-link-active: $violet-600; 36 | $pill-link-hover: $gray-800; 37 | 38 | $border-color: $gray-300; 39 | $table-headers-color: $gray-100; 40 | $table-border-color: $gray-200; 41 | $table-hover-bg: $gray-100; 42 | 43 | $header-border-color: $table-border-color; 44 | 45 | $input-bg: $white; 46 | $input-color: $gray-800; 47 | $input-border-color: $border-color; 48 | 49 | $card-cap-bg: $white; 50 | $card-bg-secondary: $gray-100; 51 | $card-bg: $white; 52 | $card-border-radius: $border-radius-lg; 53 | 54 | $code-bg: #292d3e; 55 | 56 | $new-entries-bg: $violet-50; 57 | $new-code-entries-bg: $gray-600; 58 | 59 | $control-action-icon-color: $gray-300; 60 | $control-action-icon-hover: $violet-600; 61 | 62 | $nav-pills-link-active-bg: $gray-200; 63 | 64 | $dropdown-bg: $white; 65 | $dropdown-link-color: $gray-700; 66 | 67 | $btn-muted-color: $gray-600; 68 | $btn-muted-bg: $gray-200; 69 | $btn-muted-hover-color: $gray-900; 70 | $btn-muted-hover-bg: $gray-300; 71 | $btn-muted-active-color: $white; 72 | $btn-muted-active-bg: $primary; 73 | 74 | $badge-secondary-bg: $gray-200; 75 | $badge-secondary-color: $gray-600; 76 | $badge-success-bg: $emerald-100; 77 | $badge-success-color: $emerald-600; 78 | $badge-info-bg: $blue-100; 79 | $badge-info-color: $blue-600; 80 | $badge-warning-bg: $amber-100; 81 | $badge-warning-color: $amber-600; 82 | $badge-danger-bg: $red-100; 83 | $badge-danger-color: $red-600; 84 | 85 | $grid-breakpoints: ( 86 | xs: 0, 87 | sm: 2px, 88 | md: 8px, 89 | lg: 9px, 90 | xl: 10px 91 | ) !default; 92 | 93 | $container-max-widths: ( 94 | sm: 1137px, 95 | md: 1138px, 96 | lg: 1139px, 97 | xl: 1140px 98 | ) !default; 99 | 100 | @import 'base'; 101 | -------------------------------------------------------------------------------- /resources/sass/base.scss: -------------------------------------------------------------------------------- 1 | @import 'syntaxhighlight'; 2 | @import 'node_modules/bootstrap/scss/bootstrap'; 3 | 4 | body { 5 | padding-bottom: 20px; 6 | } 7 | 8 | .container { 9 | max-width: 1440px; 10 | } 11 | 12 | html { 13 | min-width: 1140px; 14 | } 15 | 16 | [v-cloak] { 17 | display: none; 18 | } 19 | 20 | svg.icon { 21 | width: 1rem; 22 | height: 1rem; 23 | } 24 | 25 | .header { 26 | border-bottom: solid 1px $header-border-color; 27 | 28 | .logo { 29 | text-decoration: none; 30 | color: $logo-color; 31 | 32 | svg { 33 | width: 2rem; 34 | height: 2rem; 35 | } 36 | } 37 | } 38 | 39 | .sidebar .nav-item { 40 | a { 41 | color: $sidebar-nav-color; 42 | padding: 0.5rem 0.75rem; 43 | margin-bottom: 4px; 44 | border-radius: $border-radius-lg; 45 | 46 | svg { 47 | width: 1.25rem; 48 | height: 1.25rem; 49 | margin-right: 15px; 50 | fill: $sidebar-nav-icon-color; 51 | } 52 | 53 | &:hover { 54 | background-color: $sidebar-nav-hover-bg; 55 | color: $sidebar-nav-hover-color; 56 | } 57 | 58 | &.active { 59 | background-color: $sidebar-nav-active-bg; 60 | color: $sidebar-nav-active-color; 61 | 62 | svg { 63 | fill: $sidebar-nav-active-icon-color; 64 | } 65 | } 66 | } 67 | } 68 | 69 | .card { 70 | box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); 71 | border: none; 72 | 73 | .bottom-radius { 74 | border-bottom-left-radius: $card-border-radius; 75 | border-bottom-right-radius: $card-border-radius; 76 | } 77 | 78 | .card-header { 79 | padding-top: 0.7rem; 80 | padding-bottom: 0.7rem; 81 | background-color: $card-cap-bg; 82 | border-bottom: none; 83 | min-height: 60px; 84 | 85 | .btn-group { 86 | .btn { 87 | padding: 0.2rem 0.5rem; 88 | } 89 | } 90 | 91 | .form-control-with-icon { 92 | position: relative; 93 | 94 | .icon-wrapper { 95 | display: flex; 96 | align-items: center; 97 | jusify-content: center; 98 | position: absolute; 99 | top: 0; 100 | left: 0.75rem; 101 | bottom: 0; 102 | 103 | .icon { 104 | fill: $text-muted; 105 | } 106 | } 107 | 108 | .form-control { 109 | padding-left: 2.25rem; 110 | font-size: 0.875rem; 111 | border-radius: 9999px; 112 | } 113 | } 114 | } 115 | 116 | .table { 117 | th, 118 | td { 119 | padding: 0.75rem 1.25rem; 120 | } 121 | 122 | &.table-sm { 123 | th, 124 | td { 125 | padding: 1rem 1.25rem; 126 | } 127 | } 128 | 129 | th { 130 | background-color: $table-headers-color; 131 | font-size: 0.875rem; 132 | padding: 0.5rem 1.25rem; 133 | border-bottom: 0; 134 | } 135 | 136 | &:not(.table-borderless) { 137 | td { 138 | border-top: 1px solid $table-border-color; 139 | } 140 | } 141 | 142 | &.penultimate-column-right { 143 | th:nth-last-child(2), 144 | td:nth-last-child(2) { 145 | text-align: right; 146 | } 147 | } 148 | 149 | th.table-fit, 150 | td.table-fit { 151 | width: 1%; 152 | white-space: nowrap; 153 | } 154 | } 155 | } 156 | 157 | .fill-text-color { 158 | fill: $body-color; 159 | } 160 | 161 | .fill-danger { 162 | fill: $danger; 163 | } 164 | 165 | .fill-warning { 166 | fill: $warning; 167 | } 168 | 169 | .fill-info { 170 | fill: $info; 171 | } 172 | 173 | .fill-success { 174 | fill: $success; 175 | } 176 | 177 | .fill-primary { 178 | fill: $primary; 179 | } 180 | 181 | button:hover { 182 | .fill-primary { 183 | fill: #fff; 184 | } 185 | } 186 | 187 | .btn-outline-primary.active { 188 | .fill-primary { 189 | fill: $body-bg; 190 | } 191 | } 192 | 193 | .btn-outline-primary:not(:disabled):not(.disabled).active:focus { 194 | box-shadow: none !important; 195 | } 196 | 197 | .btn-muted { 198 | color: $btn-muted-color; 199 | background: $btn-muted-bg; 200 | 201 | &:hover, 202 | &:focus { 203 | color: $btn-muted-hover-color; 204 | background: $btn-muted-hover-bg; 205 | } 206 | 207 | &.active { 208 | color: $btn-muted-active-color; 209 | background: $btn-muted-active-bg; 210 | } 211 | } 212 | 213 | .badge-secondary { 214 | background: $badge-secondary-bg; 215 | color: $badge-secondary-color; 216 | } 217 | 218 | .badge-success { 219 | background: $badge-success-bg; 220 | color: $badge-success-color; 221 | } 222 | 223 | .badge-info { 224 | background: $badge-info-bg; 225 | color: $badge-info-color; 226 | } 227 | 228 | .badge-warning { 229 | background: $badge-warning-bg; 230 | color: $badge-warning-color; 231 | } 232 | 233 | .badge-danger { 234 | background: $badge-danger-bg; 235 | color: $badge-danger-color; 236 | } 237 | 238 | .control-action { 239 | svg { 240 | fill: $control-action-icon-color; 241 | width: 1.2rem; 242 | height: 1.2rem; 243 | 244 | &:hover { 245 | fill: $control-action-icon-hover; 246 | } 247 | } 248 | } 249 | 250 | .info-icon { 251 | fill: $control-action-icon-color; 252 | } 253 | 254 | @-webkit-keyframes spin { 255 | from { 256 | -ms-transform: rotate(0deg); 257 | -moz-transform: rotate(0deg); 258 | -webkit-transform: rotate(0deg); 259 | -o-transform: rotate(0deg); 260 | transform: rotate(0deg); 261 | } 262 | to { 263 | -ms-transform: rotate(360deg); 264 | -moz-transform: rotate(360deg); 265 | -webkit-transform: rotate(360deg); 266 | -o-transform: rotate(360deg); 267 | transform: rotate(360deg); 268 | } 269 | } 270 | 271 | @keyframes spin { 272 | from { 273 | -ms-transform: rotate(0deg); 274 | -moz-transform: rotate(0deg); 275 | -webkit-transform: rotate(0deg); 276 | -o-transform: rotate(0deg); 277 | transform: rotate(0deg); 278 | } 279 | to { 280 | -ms-transform: rotate(360deg); 281 | -moz-transform: rotate(360deg); 282 | -webkit-transform: rotate(360deg); 283 | -o-transform: rotate(360deg); 284 | transform: rotate(360deg); 285 | } 286 | } 287 | 288 | .spin { 289 | -webkit-animation: spin 2s linear infinite; 290 | -moz-animation: spin 2s linear infinite; 291 | -ms-animation: spin 2s linear infinite; 292 | -o-animation: spin 2s linear infinite; 293 | animation: spin 2s linear infinite; 294 | } 295 | 296 | .card { 297 | .nav-pills { 298 | background: $card-cap-bg; 299 | 300 | .nav-link { 301 | font-size: 0.9rem; 302 | border-radius: 0; 303 | padding: 0.75rem 1.25rem; 304 | color: $pill-link; 305 | 306 | &:hover, 307 | &:focus { 308 | color: $pill-link-hover; 309 | } 310 | 311 | &.active { 312 | background: none; 313 | color: $pill-link-active; 314 | border-bottom: solid 2px $pill-link-active; 315 | } 316 | } 317 | } 318 | } 319 | 320 | .list-enter-active:not(.dontanimate) { 321 | transition: background 1s linear; 322 | } 323 | 324 | .list-enter:not(.dontanimate), 325 | .list-leave-to:not(.dontanimate) { 326 | background: $new-entries-bg; 327 | } 328 | 329 | .code-bg .list-enter:not(.dontanimate), 330 | .code-bg .list-leave-to:not(.dontanimate) { 331 | background: $new-code-entries-bg; 332 | } 333 | 334 | .card table { 335 | td { 336 | vertical-align: middle !important; 337 | } 338 | } 339 | 340 | .card-bg-secondary { 341 | background: $card-bg-secondary; 342 | } 343 | 344 | .code-bg { 345 | background: $code-bg; 346 | } 347 | 348 | .disabled-watcher { 349 | padding: 0.75rem; 350 | color: #fff; 351 | background: $danger; 352 | } 353 | 354 | .badge-sm { 355 | font-size: 0.75rem; 356 | } 357 | -------------------------------------------------------------------------------- /resources/sass/syntaxhighlight.scss: -------------------------------------------------------------------------------- 1 | .vjs-tree { 2 | font-family: 'Monaco', 'Menlo', 'Consolas', 'Bitstream Vera Sans Mono', monospace !important; 3 | &.is-root { 4 | position: relative; 5 | } 6 | .vjs-tree-node { 7 | display: flex; 8 | position: relative; 9 | .vjs-indent-unit { 10 | &.has-line { 11 | border-left: 1px dotted rgba(204, 204, 204, 0.28) !important; 12 | } 13 | } 14 | &.has-carets { 15 | padding-left: 15px; 16 | } 17 | .has-carets.has-selector, 18 | .has-selector { 19 | padding-left: 30px; 20 | } 21 | } 22 | .vjs-indent { 23 | display: flex; 24 | position: relative; 25 | } 26 | .vjs-indent-unit { 27 | width: 1em; 28 | } 29 | .vjs-tree-brackets { 30 | cursor: pointer; 31 | &:hover { 32 | color: #20a0ff; 33 | } 34 | } 35 | .vjs-key { 36 | color: #c3cbd3 !important; 37 | padding-right: 10px; 38 | } 39 | .vjs-value-string { 40 | color: #c3e88d !important; 41 | } 42 | .vjs-value-null, 43 | .vjs-value-number, 44 | .vjs-value-boolean, 45 | .vjs-value-undefined { 46 | color: #a291f5 !important; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resources/views/layout.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | FailedJobs{{ config('app.name') ? ' - ' . config('app.name') : '' }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 26 | 27 |
28 |
29 | 38 | 39 |
40 | 41 | 42 | 47 |
48 |
49 | 50 |
51 | 63 | 64 |
65 | @if (! $assetsAreCurrent) 66 |
67 | The published FaildJobs assets are not up-to-date with the installed version. To update, run:
php artisan failedjobs:publish 68 |
69 | @endif 70 | 71 | @if ($isDownForMaintenance) 72 |
73 | This application is in "maintenance mode". Queued jobs may not be processed unless your worker is using the "force" flag. 74 |
75 | @endif 76 | 77 | 78 |
79 |
80 |
81 |
82 | 83 | 84 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | group(function () { 6 | // Job Routes... 7 | Route::get('/', 'FailedJobsController@index')->name('failed-jobs.index'); 8 | Route::get('/{id}', 'FailedJobsController@show')->name('failed-jobs.show'); 9 | }); 10 | 11 | // Catch-all Route... 12 | Route::get('/{view?}', 'HomeController@index')->where('view', '(.*)')->name('failed-jobs'); 13 | -------------------------------------------------------------------------------- /src/Console/InstallCommand.php: -------------------------------------------------------------------------------- 1 | comment('Publishing FailedJobs Service Provider...'); 33 | $this->callSilent('vendor:publish', ['--tag' => 'failedjobs-provider']); 34 | 35 | $this->comment('Publishing FailedJobs Assets...'); 36 | $this->callSilent('vendor:publish', ['--tag' => 'failedjobs-assets']); 37 | 38 | $this->comment('Publishing FailedJobs Configuration...'); 39 | $this->callSilent('vendor:publish', ['--tag' => 'failedjobs-config']); 40 | 41 | $this->registerFailedJobsServiceProvider(); 42 | 43 | $this->info('FailedJobs scaffolding installed successfully.'); 44 | } 45 | 46 | /** 47 | * Register the FailedJobs service provider in the application configuration file. 48 | * 49 | * @return void 50 | */ 51 | protected function registerFailedJobsServiceProvider() 52 | { 53 | $namespace = Str::replaceLast('\\', '', $this->laravel->getNamespace()); 54 | 55 | if (file_exists($this->laravel->bootstrapPath('providers.php'))) { 56 | // @phpstan-ignore-next-line 57 | ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\FailedJobsServiceProvider"); 58 | } else { 59 | $appConfig = file_get_contents(config_path('app.php')); 60 | 61 | if (Str::contains($appConfig, $namespace.'\\Providers\\FailedJobsServiceProvider::class')) { 62 | return; 63 | } 64 | 65 | file_put_contents(config_path('app.php'), str_replace( 66 | "{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL, 67 | "{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\FailedJobsServiceProvider::class,".PHP_EOL, 68 | $appConfig 69 | )); 70 | } 71 | 72 | file_put_contents(app_path('Providers/FailedJobsServiceProvider.php'), str_replace( 73 | "namespace App\Providers;", 74 | "namespace {$namespace}\Providers;", 75 | file_get_contents(app_path('Providers/FailedJobsServiceProvider.php')) 76 | )); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/Console/PublishCommand.php: -------------------------------------------------------------------------------- 1 | call('vendor:publish', [ 31 | '--tag' => 'failedjobs-assets', 32 | '--force' => true, 33 | ]); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Exceptions/ForbiddenException.php: -------------------------------------------------------------------------------- 1 | environment('local'); 39 | })($request); 40 | } 41 | 42 | /** 43 | * Set the callback that should be used to authenticate FailedJobs users. 44 | * 45 | * @param \Closure $callback 46 | * @return static 47 | */ 48 | public static function auth(Closure $callback) 49 | { 50 | static::$authUsing = $callback; 51 | 52 | return new static; 53 | } 54 | 55 | /** 56 | * Specifies that FailedJobs should use the dark theme. 57 | * 58 | * @deprecated 59 | * 60 | * @return static 61 | */ 62 | public static function night() 63 | { 64 | static::$useDarkTheme = true; 65 | 66 | return new static; 67 | } 68 | 69 | /** 70 | * Get the default JavaScript variables for FailedJobs. 71 | * 72 | * @return array 73 | */ 74 | public static function scriptVariables() 75 | { 76 | return [ 77 | 'path' => config('failedjobs.path'), 78 | ]; 79 | } 80 | 81 | /** 82 | * Determine if FailedJobs's published assets are up-to-date. 83 | * 84 | * @return bool 85 | * 86 | * @throws \RuntimeException 87 | */ 88 | public static function assetsAreCurrent() 89 | { 90 | $publishedPath = public_path('vendor/failedjobs/mix-manifest.json'); 91 | 92 | if (! File::exists($publishedPath)) { 93 | throw new RuntimeException('FailedJobs assets are not published. Please run: php artisan failedjobs:publish'); 94 | } 95 | 96 | return File::get($publishedPath) === File::get(__DIR__.'/../public/mix-manifest.json'); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/FailedJobsApplicationServiceProvider.php: -------------------------------------------------------------------------------- 1 | authorization(); 18 | } 19 | 20 | /** 21 | * Configure the FailedJobs authorization services. 22 | * 23 | * @return void 24 | */ 25 | protected function authorization() 26 | { 27 | $this->gate(); 28 | 29 | FailedJobs::auth(function ($request) { 30 | return Gate::check('viewFailedJobs', [$request->user()]) || app()->environment('local'); 31 | }); 32 | } 33 | 34 | /** 35 | * Register the FailedJobs gate. 36 | * 37 | * This gate determines who can access FailedJobs in non-local environments. 38 | * 39 | * @return void 40 | */ 41 | protected function gate() 42 | { 43 | Gate::define('viewFailedJobs', function ($user) { 44 | return in_array($user->email, [ 45 | // 46 | ]); 47 | }); 48 | } 49 | 50 | /** 51 | * Register any application services. 52 | * 53 | * @return void 54 | */ 55 | public function register() 56 | { 57 | // 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/FailedJobsServiceProvider.php: -------------------------------------------------------------------------------- 1 | registerRoutes(); 22 | $this->registerResources(); 23 | $this->defineAssetPublishing(); 24 | $this->offerPublishing(); 25 | $this->registerCommands(); 26 | } 27 | 28 | /** 29 | * Register the FailedJobs routes. 30 | * 31 | * @return void 32 | */ 33 | protected function registerRoutes() 34 | { 35 | if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) { 36 | return; 37 | } 38 | 39 | Route::group([ 40 | 'domain' => config('failedjobs.domain', null), 41 | 'prefix' => config('failedjobs.path'), 42 | 'namespace' => 'HPWebdeveloper\LaravelFailedJobs\Http\Controllers', 43 | 'middleware' => config('failedjobs.middleware', 'web'), 44 | ], function () { 45 | $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); 46 | }); 47 | } 48 | 49 | /** 50 | * Register the FailedJobs resources. 51 | * 52 | * @return void 53 | */ 54 | protected function registerResources() 55 | { 56 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'failedjobs'); 57 | } 58 | 59 | /** 60 | * Define the asset publishing configuration. 61 | * 62 | * @return void 63 | */ 64 | public function defineAssetPublishing() 65 | { 66 | $this->publishes([ 67 | FAILEDJOBS_PATH.'/public' => public_path('vendor/failedjobs'), 68 | ], ['failedjobs-assets', 'laravel-assets']); 69 | } 70 | 71 | /** 72 | * Setup the resource publishing groups for FailedJobs. 73 | * 74 | * @return void 75 | */ 76 | protected function offerPublishing() 77 | { 78 | if ($this->app->runningInConsole()) { 79 | $this->publishes([ 80 | __DIR__.'/../stubs/FailedJobsServiceProvider.stub' => app_path('Providers/FailedJobsServiceProvider.php'), 81 | ], 'failedjobs-provider'); 82 | 83 | $this->publishes([ 84 | __DIR__.'/../config/failedjobs.php' => config_path('failedjobs.php'), 85 | ], 'failedjobs-config'); 86 | } 87 | } 88 | 89 | /** 90 | * Register the FailedJobs Artisan commands. 91 | * 92 | * @return void 93 | */ 94 | protected function registerCommands() 95 | { 96 | if ($this->app->runningInConsole()) { 97 | $this->commands([ 98 | Console\InstallCommand::class, 99 | Console\PublishCommand::class, 100 | ]); 101 | } 102 | } 103 | 104 | /** 105 | * Register any application services. 106 | * 107 | * @return void 108 | */ 109 | public function register() 110 | { 111 | if (! defined('FAILEDJOBS_PATH')) { 112 | define('FAILEDJOBS_PATH', realpath(__DIR__.'/../')); 113 | } 114 | 115 | $this->configure(); 116 | } 117 | 118 | /** 119 | * Setup the configuration for FailedJobs. 120 | * 121 | * @return void 122 | */ 123 | protected function configure() 124 | { 125 | $this->mergeConfigFrom( 126 | __DIR__.'/../config/failedjobs.php', 'failedjobs' 127 | ); 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | middleware(Authenticate::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Http/Controllers/FailedJobsController.php: -------------------------------------------------------------------------------- 1 | orderBy('failed_at', 'desc') 19 | ->paginate($perPage); 20 | 21 | $transformedJobs = $failedJobs->getCollection()->map(function ($job) { 22 | return $this->decodeDatabaseFailedJob($job); 23 | }); 24 | 25 | $failedJobs->setCollection($transformedJobs); 26 | 27 | return response()->json($failedJobs); 28 | } 29 | 30 | /** 31 | * Decode the given failed job from the database. 32 | * 33 | * @param object $job 34 | * @return object 35 | */ 36 | protected function decodeDatabaseFailedJob($job) 37 | { 38 | $job->payload = json_decode($job->payload); 39 | $job->exception = mb_convert_encoding($job->exception, 'UTF-8'); 40 | 41 | return $job; 42 | } 43 | 44 | public function show($uuid) 45 | { 46 | $validator = Validator::make(['uuid' => $uuid], [ 47 | 'uuid' => 'required|uuid', 48 | ]); 49 | 50 | if ($validator->fails()) { 51 | return response()->json(['message' => 'Invalid UUID format'], 400); 52 | } 53 | 54 | $failedJob = DB::table('failed_jobs')->where('uuid', $uuid)->first(); 55 | 56 | if (!$failedJob) { 57 | return response()->json(['message' => 'Job not found'], 404); 58 | } 59 | 60 | return $this->decodeDatabaseJob($failedJob); 61 | } 62 | 63 | /** 64 | * Decode the given job from the database. 65 | * 66 | * @param object $job 67 | * @return object 68 | */ 69 | protected function decodeDatabaseJob($job) 70 | { 71 | $job->payload = json_decode($job->payload); 72 | $job->exception = mb_convert_encoding($job->exception, 'UTF-8'); 73 | 74 | return $job; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | FailedJobs::assetsAreCurrent(), 19 | 'failedJobsScriptVariables' => FailedJobs::scriptVariables(), 20 | 'isDownForMaintenance' => App::isDownForMaintenance(), 21 | ]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | email, [ 21 | // 22 | ]); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /testbench.yaml: -------------------------------------------------------------------------------- 1 | providers: 2 | - HPWebdeveloper\LaravelFailedJobs\FaildJobsServiceProvider 3 | - Workbench\App\Providers\FailedJobsServiceProvider 4 | 5 | env: 6 | - REDIS_CLIENT="predis" 7 | 8 | migrations: true 9 | seeders: 10 | - Workbench\Database\Seeders\DatabaseSeeder 11 | 12 | workbench: 13 | start: '/failedjobs' 14 | user: 'panjeh@gmail.com' 15 | install: true 16 | welcome: true 17 | build: 18 | - asset-publish 19 | - create-sqlite-db 20 | - db-wipe 21 | - migrate-fresh 22 | assets: [] 23 | sync: 24 | - from: ./public 25 | to: public/vendor/failedjobs 26 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | const webpack = require('webpack'); 3 | const path = require('path'); 4 | 5 | /* 6 | |-------------------------------------------------------------------------- 7 | | Mix Asset Management 8 | |-------------------------------------------------------------------------- 9 | | 10 | | Mix provides a clean, fluent API for defining some Webpack build steps 11 | | for your Laravel application. By default, we are compiling the Sass 12 | | file for the application as well as bundling up all the JS files. 13 | | 14 | */ 15 | 16 | mix.options({ 17 | terser: { 18 | terserOptions: { 19 | compress: { 20 | drop_console: true, 21 | }, 22 | }, 23 | }, 24 | }) 25 | .setPublicPath('public') 26 | .js('resources/js/app.js', 'public') 27 | .vue() 28 | .sass('resources/sass/app.scss', 'public') 29 | .sass('resources/sass/app-dark.scss', 'public') 30 | .version() 31 | .copy('resources/img', 'public/img') 32 | .webpackConfig({ 33 | resolve: { 34 | symlinks: false, 35 | alias: { 36 | '@': path.resolve(__dirname, 'resources/js/'), 37 | }, 38 | }, 39 | plugins: [ 40 | new webpack.IgnorePlugin({ 41 | resourceRegExp: /^\.\/locale$/, 42 | contextRegExp: /moment$/, 43 | }), 44 | ], 45 | }); 46 | 47 | mix.disableSuccessNotifications(); 48 | -------------------------------------------------------------------------------- /workbench/app/Providers/FailedJobsServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'Laravel FailedJobs', 19 | 'email' => 'panjeh@gmail.com', 20 | 'password' => $password, 21 | ]); 22 | } 23 | } 24 | --------------------------------------------------------------------------------