generated from MokoConsulting/Template-Joomla
feat: add Joomla scaffolding — plugin manifest, Extension class, services provider, SQL install/uninstall, language files
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
PLG_SYSTEM_MOKOSUITESIGHT="System - MokoSuite Insight"
|
||||
PLG_SYSTEM_MOKOSUITESIGHT_DESC="Real-time dashboards, KPI monitoring, and alerting with Chart.js 4 rendering."
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
PLG_SYSTEM_MOKOSUITESIGHT="System - MokoSuite Insight"
|
||||
PLG_SYSTEM_MOKOSUITESIGHT_DESC="Real-time dashboards, KPI monitoring, and alerting with Chart.js 4 rendering."
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" group="system" method="upgrade">
|
||||
<name>System - MokoSuite Insight</name>
|
||||
<element>mokosuitesight</element>
|
||||
<author>Moko Consulting</author>
|
||||
<creationDate>2026-06-22</creationDate>
|
||||
<copyright>Copyright (C) 2026 Moko Consulting. All rights reserved.</copyright>
|
||||
<license>GPL-3.0-or-later</license>
|
||||
<authorEmail>hello@mokoconsulting.tech</authorEmail>
|
||||
<authorUrl>https://mokoconsulting.tech</authorUrl>
|
||||
<version>01.00.00</version>
|
||||
<php_minimum>8.3</php_minimum>
|
||||
<description>PLG_SYSTEM_MOKOSUITESIGHT_DESC</description>
|
||||
<namespace path="src">Moko\Plugin\System\MokoSuiteSight</namespace>
|
||||
<files>
|
||||
<folder>src</folder>
|
||||
<folder>services</folder>
|
||||
<folder>language</folder>
|
||||
<folder>sql</folder>
|
||||
</files>
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/plg_system_mokosuitesight.ini</language>
|
||||
<language tag="en-GB">en-GB/plg_system_mokosuitesight.sys.ini</language>
|
||||
</languages>
|
||||
<install><sql><file driver="mysql" charset="utf8">sql/install.mysql.sql</file></sql></install>
|
||||
<uninstall><sql><file driver="mysql" charset="utf8">sql/uninstall.mysql.sql</file></sql></uninstall>
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="Dashboard Defaults">
|
||||
<field name="auto_refresh" type="number" default="60" label="Auto-refresh Interval (seconds, 0=off)" min="0" />
|
||||
<field name="max_dashboards_per_user" type="number" default="10" label="Max Dashboards per User" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Moko\Plugin\System\MokoSuiteSight\Extension\Insight;
|
||||
|
||||
return new class implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Container $container): void
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$dispatcher = $container->get(DispatcherInterface::class);
|
||||
$plugin = new Insight($dispatcher, (array) PluginHelper::getPlugin('system', 'mokosuitesight'));
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,101 @@
|
||||
--
|
||||
-- MokoSuite Insight Tables
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesight_dashboards` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`description` TEXT,
|
||||
`user_id` INT NOT NULL,
|
||||
`is_shared` TINYINT NOT NULL DEFAULT 0,
|
||||
`layout` JSON DEFAULT NULL,
|
||||
`auto_refresh_seconds` INT UNSIGNED NOT NULL DEFAULT 60,
|
||||
`published` TINYINT NOT NULL DEFAULT 1,
|
||||
`ordering` INT NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL,
|
||||
`modified` DATETIME DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_user` (`user_id`),
|
||||
KEY `idx_shared` (`is_shared`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesight_widgets` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`dashboard_id` INT UNSIGNED NOT NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`type` ENUM('counter','line_chart','bar_chart','pie_chart','gauge','table','sparkline','heatmap','funnel') NOT NULL DEFAULT 'counter',
|
||||
`data_source` VARCHAR(255) NOT NULL,
|
||||
`config` JSON DEFAULT NULL,
|
||||
`position_x` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`position_y` INT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`width` INT UNSIGNED NOT NULL DEFAULT 4,
|
||||
`height` INT UNSIGNED NOT NULL DEFAULT 3,
|
||||
`ordering` INT NOT NULL DEFAULT 0,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_dashboard` (`dashboard_id`),
|
||||
KEY `idx_source` (`data_source`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesight_data_sources` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`module` VARCHAR(100) NOT NULL,
|
||||
`type` ENUM('scalar','list','timeseries') NOT NULL DEFAULT 'scalar',
|
||||
`query_class` VARCHAR(500) NOT NULL DEFAULT '',
|
||||
`description` TEXT,
|
||||
`active` TINYINT NOT NULL DEFAULT 1,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `idx_name` (`name`),
|
||||
KEY `idx_module` (`module`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT IGNORE INTO `#__mokosuitesight_data_sources`
|
||||
(`name`, `module`, `type`, `description`, `active`, `created`) VALUES
|
||||
('crm.contact_count', 'crm', 'scalar', 'Total CRM contacts', 1, NOW()),
|
||||
('crm.deals_pipeline', 'crm', 'list', 'Deals by pipeline stage', 1, NOW()),
|
||||
('crm.revenue_monthly', 'crm', 'timeseries', 'Monthly revenue (12 months)', 1, NOW()),
|
||||
('pos.daily_sales', 'pos', 'scalar', 'Today total sales', 1, NOW()),
|
||||
('hrm.headcount', 'hrm', 'scalar', 'Active employee count', 1, NOW());
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesight_alerts` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`data_source` VARCHAR(255) NOT NULL,
|
||||
`operator` ENUM('gt','gte','lt','lte','eq','neq') NOT NULL DEFAULT 'gt',
|
||||
`threshold` DECIMAL(15,2) NOT NULL,
|
||||
`cooldown_minutes` INT UNSIGNED NOT NULL DEFAULT 60,
|
||||
`notify_user_id` INT DEFAULT NULL,
|
||||
`active` TINYINT NOT NULL DEFAULT 1,
|
||||
`last_triggered` DATETIME DEFAULT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_source` (`data_source`),
|
||||
KEY `idx_active` (`active`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesight_alert_log` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`alert_id` INT UNSIGNED NOT NULL,
|
||||
`value` DECIMAL(15,2) NOT NULL,
|
||||
`threshold` DECIMAL(15,2) NOT NULL,
|
||||
`acknowledged` TINYINT NOT NULL DEFAULT 0,
|
||||
`acknowledged_by` INT DEFAULT NULL,
|
||||
`acknowledged_at` DATETIME DEFAULT NULL,
|
||||
`triggered_at` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_alert` (`alert_id`),
|
||||
KEY `idx_ack` (`acknowledged`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `#__mokosuitesight_snapshots` (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`dashboard_id` INT UNSIGNED NOT NULL,
|
||||
`data` JSON NOT NULL,
|
||||
`captured_at` DATETIME NOT NULL,
|
||||
`captured_by` INT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_dashboard` (`dashboard_id`),
|
||||
KEY `idx_date` (`captured_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
@@ -0,0 +1,10 @@
|
||||
--
|
||||
-- MokoSuite Insight — Uninstall
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `#__mokosuitesight_snapshots`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesight_alert_log`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesight_alerts`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesight_data_sources`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesight_widgets`;
|
||||
DROP TABLE IF EXISTS `#__mokosuitesight_dashboards`;
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Moko\Plugin\System\MokoSuiteSight\Extension;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Event\SubscriberInterface;
|
||||
|
||||
class Insight extends CMSPlugin implements SubscriberInterface
|
||||
{
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user