Skip to content

Commit

Permalink
Remove the MeController me/token etc actions and REST APIs because th…
Browse files Browse the repository at this point in the history
…is is now a Jetstream function.

Made the blade component dashboard the default instead of the KISSMVC view based one. Removed the feature flag.
Add a warning whenever you use the old style dashboard template.
Fixed validation tooltips on profile editor
Add eslint to validate Vue components
Bump all the php dependencies
Fix PHPStan config for Larastan
  • Loading branch information
mosen committed Dec 28, 2023
1 parent d2316c4 commit 2975b97
Show file tree
Hide file tree
Showing 34 changed files with 1,168 additions and 1,011 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
'plugin:vue/vue3-recommended',
],
rules: {
// override/add rules settings here, such as:
// 'vue/no-unused-vars': 'error'
'vue/multi-word-component-names': 'off'
},
parser: 'vue-eslint-parser',
parserOptions: {
'parser': '@typescript-eslint/parser',
'sourceType': 'module',
}
}
21 changes: 0 additions & 21 deletions app/Http/Controllers/Api/MeController.php

This file was deleted.

36 changes: 29 additions & 7 deletions app/Http/Controllers/DashboardsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Http\Request;
use Inertia\Inertia;
use munkireport\lib\Dashboard;

/**
* This controller provides a staging area for Dashboards V2, and should not be normally visible unless a feature
Expand All @@ -13,25 +14,46 @@
*/
class DashboardsController extends Controller
{
public function index() {
Inertia::setRootView('layouts.inertia');
return Inertia::render('Dashboards/Index', [
'dashboard_default_layout' => config('dashboard.default_layout')
]);
}
/**
* This controller action would have been for a Vue/SPA dashboards layout.
* This is parked for a future release
*/
// public function index() {
// Inertia::setRootView('layouts.inertia');
// return Inertia::render('Dashboards/Index', [
// 'dashboard_default_layout' => config('dashboard.default_layout')
// ]);
// }

/**
* This controller action returns an experimental blade component based dashboard.
* Not sure if we will go forward with this option right now, but did not want to remove it entirely.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|null
*/
public function bladeIndex() {
public function index() {
return view('dashboards.default', [
'dashboard_layout' => config('dashboard.default_layout'),
]);
}

/**
* Show the specified user-configured dashboard.
*
* Supersedes ShowController/dashboard/which method to use more idiomatic Laravel services.
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|null|never
*/
public function show(string $dashboard) {
$dashboard = app(\munkireport\lib\Dashboard::class)->get($dashboard);
if (is_null($dashboard)) {
return abort(404);
}

// TODO: custom dashboards could originally specify their own view
return view('dashboards.default', $dashboard);
}

/**
* Show the default dashboard.
*
Expand Down
32 changes: 0 additions & 32 deletions app/Http/Controllers/MeController.php

This file was deleted.

1 change: 1 addition & 0 deletions app/Http/Controllers/ShowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function index()
*
* The dashboard template defaults to dashboard/dashboard unless overridden.
*
* @deprecated Use DashboardsController show method which can handle blade components.
* @param string $which
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|void
*/
Expand Down
18 changes: 18 additions & 0 deletions app/lib/munkireport/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,22 @@ public function render(string $dashboard): void
mr_view($view, $data);

}

/**
* Get detail about a loaded dashboard.
*
* @since 6.0.0
* @param string $dashboard The name of the dashboard to get information about
* @return array|null Dashboard associative array or null if dashboard did not exist.
*/
public function get(string $dashboard): ?array
{
if (!isset($this->dashboards[$dashboard])) {
return null;
}

return [
'dashboard_layout' => $this->dashboards[$dashboard]['dashboard_layout']
];
}
}
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"larastan/larastan": "^2.7.0",
"mll-lab/laravel-graphiql": "^3.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^6.1",
"nunomaduro/collision": "^7.0",
"phpmd/phpmd": "^2.15",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.3.3",
"spatie/laravel-ignition": "^2.0",
"squizlabs/php_codesniffer": "^3.5"
"squizlabs/php_codesniffer": "^3.8"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -39,13 +40,13 @@
"defuse/php-encryption": "^2.1",
"doctrine/dbal": "^3.0",
"erusev/parsedown": "^1.7",
"guzzlehttp/guzzle": "^7.0.1",
"guzzlehttp/guzzle": "^7.2",
"inertiajs/inertia-laravel": "^0.6.11",
"laravel/fortify": "^1.19",
"laravel/framework": "^10.0",
"laravel/framework": "^10.39",
"laravel/jetstream": "^4.0",
"laravel/legacy-factories": "^1.1",
"laravel/sanctum": "^3.2",
"laravel/sanctum": "^3.3",
"laravel/scout": "^10.6",
"laravel/socialite": "^5.5",
"league/flysystem": "^3.0.16",
Expand Down
2 changes: 0 additions & 2 deletions config/_munkireport.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,6 @@ function (){
| They aren't even guaranteed to work!
*/
'alpha_features' => [
// Enable the Alpha Vue Dashboards
'dashboards' => env('ALPHA_FEATURE_DASHBOARDS', False),
// Enable the Global Search via Scout
'search' => env('ALPHA_FEATURE_SEARCH', False),
// Enable Business Units rewrite
Expand Down
Loading

0 comments on commit 2975b97

Please sign in to comment.