nova-bi / nova-dashboard-manager
Create and manage dynamic dashboards
Installs: 4 092
Dependents: 0
Suggesters: 0
Security: 0
Stars: 21
Watchers: 4
Forks: 8
Open Issues: 7
Requires
- php: >=7.4.0
- davidpiesse/nova-toggle: ^0.0.8
- digital-creative/chartjs-widget: dev-master
- digital-creative/nova-dashboard: dev-master
- digital-creative/nova-data-table: ^0.1.1
- digital-creative/nova-pill-filter: dev-master
- digital-creative/nova-range-input-filter: dev-master
- digital-creative/value-widget: dev-master
- digitalazgroup/nova-plain-text-field: ^0.0.4
- dillingham/nova-attach-many: ^1.0
- dillingham/nova-detail-link: ^1.0
- eminiarts/nova-relationship-selector: ^1.0
- eminiarts/nova-tabs: ^1.0
- epartment/nova-dependency-container: ^1.2.10
- ericlagarda/nova-text-card: ^1.2
- klepak/nova-multiselect-filter: ^1.2
- laramaker/redirect-after-asset: ^1.0
- marispro/nova-inline-morph-to: *
- optimistdigital/nova-sortable: ^2.0
- pdmfc/nova-info-card: ^1.0
- rcknr/nova-multiselect-filter: ^1.3
- spatie/laravel-schemaless-attributes: ^2
- dev-main
- 3.0
- 2.26
- 2.25
- 2.24
- 2.23
- 2.22
- 2.21
- 2.20
- 2.19
- 2.18
- 2.17
- 2.16
- 2.15
- 2.14
- 2.13
- 2.12
- 2.11
- 2.10
- 2.9
- 2.8
- 2.7
- 2.6
- 2.5
- 2.4
- 2.3
- 2.2
- 2.1
- 2.0
- 1.9
- 1.8
- 1.7
- 1.6
- 1.5
- 1.4
- 1.3
- 1.2
- 1.1
- 1.0
- 0.31
- 0.10
- 0.9
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
- 0.3
- 0.2
- 0.1
- 0.0.1
- dev-marispro-patch-1
- dev-cord-patch-8
- dev-cord-patch-7
- dev-cord-patch-6
- dev-cord-patch-5
- dev-cord-patch-4
- dev-cord-patch-3
- dev-cord-patch-2
- dev-cord-patch-1
- dev-reload-app-after-dashboard-creation
- dev-cord-fix
This package is auto-updated.
Last update: 2024-11-15 12:46:24 UTC
README
The Dashboard-Manager for Nova-Dashboard allows you to configure dashboards within your Nova-App
Installation:
You can install the package via composer:
composer require nova-bi/nova-dashboard-manager
If you want to specify your own table names you need to edit the configurations before running the migrations:
nova-dashboard.table_name
nova-dashboard-manager.tables
Recommended: Publish Configuration File for adjusting model and table names of Nova-Dashboard
php artisan vendor:publish --provider="DigitalCreative\NovaDashboard\ToolServiceProvider" --tag="config"
Recommended: Publish Configuration File for all configurations of Nova-Dashboard-Manager
php artisan vendor:publish --provider="NovaBi\NovaDashboardManager\DashboardManagerServiceProvider" --tag="config"
Optional: Publish Migrations
php artisan vendor:publish --provider="NovaBi\NovaDashboardManager\DashboardManagerServiceProvider" --tag="migrations"
Run Migrations
php artisan migrate
Usage
Open NovaServiceProvider.php
to add classes:
use DigitalCreative\NovaDashboard\NovaDashboard; use NovaBi\NovaDashboardManager\DashboardManager;
Enhance the tools() methods like this:
public function tools() { return [ new DashboardManager(), // must be loaded first !!! new NovaDashboard(), ]; }
Start with the Playground
The package comes with working playground examples so you can test the functionality and use the code as an example for your own implementations.
By default the Playground-Setup is configured, which will give you following basic metrics from you Nova installation:
- Users
- Boards
- Widgets
- ActionEvents
- ActionEventTypes
Following visualisations are currently available
- Value
- ChartJS Line
- ChartJS Bar
And these Filters are available:
- DateRange
- ActionEventTypes
Go to the Dashboard-Manager Tools menu and setup some demo widget, filters and dashboards.
After configuration of your dashboard you need to reload Nova to show the new Menu-Item to access the dashboard
Develop and Register your own Metrics, Filters and Visuals
Seperation of metric calculation and visualisation
The Metric classes are the container for all metric calculations. The calculations are adoptable to the supported visualisations, so e.g. within a Users
-metric you can calculate e.g. the total number of users for a Value-Visualisation or provide Trend-Data for a Trend-Visualisation.
configurable and re-usable
With custom configurations you can make your Boards, Metrics, Filters and Visualisations re-usable - check out nova-bi/nova-dashboard-manager/src/Models/Datametricables/users.php
how to use the same metric to show the number of total users and users with verified email.
Code Structure
Following the recommended structure to build your own Metrics, Filters and Visuals. Please check the sources of this package in nova-bi/nova-dashboard-manager/src
for details
/myDashboard
/Calculations All calculations - could be done in metrics as well
/Models
/Datafilterables Models representing filters
/Datametricables Models representing metrics
/Datavisualables Models representing visuals
/Visuals Implementation of visuals,
must extend `DigitalCreative\ValueWidget\Widgets`
must use Trait \NovaBi\NovaDashboardManager\Models\Datavisualables\Visuals\Visuable
/Nova
/Datafilterables Resources for filter models
/Datametricables Resources for metric models
/Datavisualables Resources for visual models
Register your sources in configurations:
nova-dashboard-manager.datafilterables
nova-dashboard-manager.datametricables
nova-dashboard-manager.datavisualables
Now you can create new Filters and Metrics in your Dashboard configuration and attach them to dashboards.
Debugging of Calculations
using Trait \NovaBi\NovaDashboardManager\Calculations\Calculatable you can view the raw SQL using the
debugQuery()` method
dd($calculation->debugQuery($calculationCurrentValue->query()));
Direct Access to Dashboards
The very nice Collapsible Resource Manager package allows you to customize the menu structure.
Configure nova-dashboard-manager.showToolMenu
to false
to hide the tool menue
With the following code the Dashboards and the configurations are directly accessible through the Menu (see know issues below - do you know how to solve this?)
// CollapsibleResourceManager use DigitalCreative\CollapsibleResourceManager\CollapsibleResourceManager; use DigitalCreative\CollapsibleResourceManager\Resources\Group; use DigitalCreative\CollapsibleResourceManager\Resources\NovaResource; use DigitalCreative\CollapsibleResourceManager\Resources\RawResource; use DigitalCreative\CollapsibleResourceManager\Resources\TopLevelResource; // Dashboard use DigitalCreative\NovaDashboard\NovaDashboard; use NovaBi\NovaDashboardManager\DashboardManager; use NovaBi\NovaDashboardManager\DashboardResource; use NovaBi\NovaDashboardManager\Nova\DashboardConfiguration; use NovaBi\NovaDashboardManager\Nova\Datafilter; use NovaBi\NovaDashboardManager\Nova\Datawidget; /** * Get the tools that should be listed in the Nova sidebar. * * @return array */ public function tools() { $analyticsDataboards = []; $dashboards = (new DashboardManager)->dashboards(); foreach ($dashboards as $dboard) { $analyticsDataboards[] = DashboardResource::make($dboard)->label($dboard->resourceLabel())->icon(faIcon('cog')); } return [ new DashboardManager(), // must be loaded first !!! new NovaDashboard(), // must be loaded as well new CollapsibleResourceManager([ 'navigation' => [ TopLevelResource::make([ 'label' => 'Databoards', 'icon' => '<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor" class="sidebar-icon"><path d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg>', 'resources' => $analyticsDataboards ]), TopLevelResource::make([ 'label' => 'Admin', 'icon' => '<svg fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" stroke="currentColor"><path d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>', 'resources' => [ \App\Nova\User::class, Group::make([ 'label' => 'Dashboard Configuration', 'expanded' => false, 'icon' => '', 'resources' => [ NovaResource::make( DashboardConfiguration::class)->index(), NovaResource::make( Datafilter::class)->index(), NovaResource::make( Datawidget::class)->index(), ] ] ) ] ]), ] ]) ]; }
Known issue
- pages of the same route are not updated when navigating directly between views e.g. using Collapsible Resource Manager . Therefor when switching between dashboards they are not updated - we hope to solve this soon.
Contributing
If you would like to contribute please fork the project and submit a PR.
Check out https://github.com/Nova-BI/nova-databoards/issues for open development tasks and issues.
Credits notice
This package is highly depending on following selection of packages from the huge range of excellent packages for laravel and nova.
- Nova-Dashboard
- Collapsible Resource Manager
- Inline MorphTo Field
- Nova Field Dependency Container
- Nova Global Filter
- Nova Sortable
- Nova Text Card
- laravel-schemaless-attributes
License
This software is released under The MIT License (MIT).