diff --git a/LICENSE.md b/LICENSE.md index 777e1d86..1efb017e 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 - 2024 DotKernel (https://www.dotkernel.com) +Copyright (c) 2020 - 2024 Dotkernel (https://www.dotkernel.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 02eab711..4f4e3767 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,12 @@ Documentation is available at: https://docs.dotkernel.org/admin-documentation/ [![Qodana](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/qodana_code_quality.yml) [![PHPStan](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/admin/actions/workflows/static-analysis.yml) -## Installing DotKernel `admin` +## Installing Dotkernel `admin` ## Tools -DotKernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/). Because of that, -Composer is required to install DotKernel `admin`. +Dotkernel can be installed through a single command that utilizes [Composer](https://getcomposer.org/). Because of that, +Composer is required to install Dotkernel `admin`. ### Composer @@ -44,19 +44,19 @@ Installation instructions: >If you have never used composer before make sure you read >the [`Composer Basic Usage`](https://getcomposer.org/doc/01-basic-usage.md) section in Composer's documentation -## Choosing an installation path for DotKernel `admin` +## Choosing an installation path for Dotkernel `admin` Example: - absolute path `/var/www/dk-admin` - or relative path `dk-admin` (equivalent with `./dk-admin`) -## Installing DotKernel `admin` +## Installing Dotkernel `admin` -After choosing the path for DotKernel (`dk-admin` will be used for the remainder of this example) it must be installed. +After choosing the path for Dotkernel (`dk-admin` will be used for the remainder of this example) it must be installed. There are two installation methods. -### I. Installing DotKernel `admin` using composer +### I. Installing Dotkernel `admin` using composer >please use the below CLI commands in terminal, do NOT use the PhpStorm buttons @@ -73,7 +73,7 @@ The setup script prompts for some configuration settings, for example the lines [1] config/config.php Make your selection (default is 1): -Simply select `[0] Do not inject`, because DotKernel includes its own configProvider which already contains the prompted +Simply select `[0] Do not inject`, because Dotkernel includes its own configProvider which already contains the prompted configurations. If you choose `[1] config/config.php` Laminas's `ConfigProvider` from `session` will be injected. @@ -84,7 +84,7 @@ The next question is: Type `y` here, and hit `enter` -### II. Installing DotKernel `admin` using git clone +### II. Installing Dotkernel `admin` using git clone This method requires more manual input, but it ensures that the default branch is installed, even if it is not released. Run the following command: @@ -95,7 +95,7 @@ The dependencies have to be installed separately, by running this command composer install -Just like for `II Installing DotKernel admin using composer` (see above), the setup asks for configuration settings +Just like for `II Installing Dotkernel admin using composer` (see above), the setup asks for configuration settings regarding injections (type `0` and hit `enter`) and a confirmation to use this setting for other packages (type `y` and hit `enter`) @@ -248,7 +248,7 @@ If you are still getting exceptions or errors regarding some missing services, t - Open a web browser and visit `http://localhost:8080/` -You should see the `DotKernel admin` login page. +You should see the `Dotkernel admin` login page. If you ran the migrations you will have an admin user in the database with the following credentials: diff --git a/composer.json b/composer.json index c39543af..fde9cd0d 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "authors": [ { - "name": "DotKernel Team", + "name": "Dotkernel Team", "email": "team@dotkernel.com" } ], @@ -31,7 +31,6 @@ "ext-gettext": "*", "dotkernel/dot-cache": "^4.0", "dotkernel/dot-cli": "^3.5.0", - "dotkernel/dot-controller": "^3.4.3", "dotkernel/dot-data-fixtures": "^1.1.3", "dotkernel/dot-dependency-injection": "^1.0", "dotkernel/dot-errorhandler": "^4.0.0", @@ -72,6 +71,8 @@ "psr-4": { "Admin\\App\\": "src/App/src/", "Admin\\Admin\\": "src/Admin/src/", + "Admin\\Page\\": "src/Page/src/", + "Admin\\Dashboard\\": "src/Dashboard/src/", "Admin\\Setting\\": "src/Setting/src/" } }, @@ -92,7 +93,6 @@ "development-disable": "laminas-development-mode disable", "development-enable": "laminas-development-mode enable", "development-status": "laminas-development-mode status", - "mezzio": "mezzio --ansi", "check": [ "@cs-check", "@test", @@ -104,7 +104,6 @@ "serve": "php -S 0.0.0.0:8080 -t public/", "static-analysis": "phpstan analyse --memory-limit 1G", "test": "phpunit --colors=always", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", "twig-cs-check": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php", "twig-cs-fix": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php --fix" } diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 455334fc..bebe88da 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -30,6 +30,11 @@ return [ 'name' => $app['name'] ?? '', 'url' => $baseUrl, ], + 'routes' => [ + 'page' => [ + 'component' => 'components', + ], + ], 'databases' => $databases, 'doctrine' => [ 'connection' => [ diff --git a/config/autoload/navigation.global.php b/config/autoload/navigation.global.php index 6ab78998..542f94f1 100644 --- a/config/autoload/navigation.global.php +++ b/config/autoload/navigation.global.php @@ -14,9 +14,8 @@ [ 'options' => [ 'label' => 'Dashboard', - 'uri' => '/', 'route' => [ - 'route_name' => 'dashboard', + 'route_name' => 'dashboard::dashboard-view', ], 'icon' => 'c-blue-500 ti-home', ], @@ -31,13 +30,17 @@ [ 'options' => [ 'label' => 'Admins', - 'uri' => '/admin/list', + 'route' => [ + 'route_name' => 'admin::admin-list', + ], ], ], [ 'options' => [ 'label' => 'Logins', - 'uri' => '/admin/logins', + 'route' => [ + 'route_name' => 'admin::admin-login-list', + ], ], ], ], @@ -45,9 +48,8 @@ [ 'options' => [ 'label' => 'Components', - 'uri' => '/page/components', 'route' => [ - 'route_name' => 'page', + 'route_name' => 'page::components', ], 'icon' => 'c-pink-500 ti-palette', ], @@ -63,10 +65,7 @@ 'options' => [ 'label' => 'Profile', 'route' => [ - 'route_name' => 'admin', - 'route_params' => [ - 'action' => 'account', - ], + 'route_name' => 'admin::account-edit-form', ], 'icon' => 'ti-user', ], @@ -75,10 +74,7 @@ 'options' => [ 'label' => 'Logout', 'route' => [ - 'route_name' => 'admin', - 'route_params' => [ - 'action' => 'logout', - ], + 'route_name' => 'admin::admin-logout', ], 'icon' => 'ti-power-off', ], diff --git a/config/config.php b/config/config.php index 29772f62..f134cc64 100644 --- a/config/config.php +++ b/config/config.php @@ -51,6 +51,8 @@ Admin\App\ConfigProvider::class, Admin\Admin\ConfigProvider::class, Admin\Setting\ConfigProvider::class, + Admin\Page\ConfigProvider::class, + Admin\Dashboard\ConfigProvider::class, // Load application config in a pre-defined order in such a way that local settings // overwrite global settings. (Loaded as first to last): diff --git a/data/doctrine/fixtures/AdminLoader.php b/data/doctrine/fixtures/AdminLoader.php index 8dd78b91..d374d188 100644 --- a/data/doctrine/fixtures/AdminLoader.php +++ b/data/doctrine/fixtures/AdminLoader.php @@ -21,7 +21,7 @@ public function load(ObjectManager $manager): void $admin = (new Admin()) ->setIdentity('admin') ->setPassword(password_hash('dotadmin', PASSWORD_DEFAULT)) - ->setFirstName('DotKernel') + ->setFirstName('Dotkernel') ->setLastName('Admin') ->addRole( $manager->getRepository(AdminRole::class)->findOneBy(['name' => AdminRole::ROLE_SUPERUSER]) diff --git a/package.json b/package.json index 2cb0a2fe..56ab43e0 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "keywords": [], "author": { - "name": "DotKernel Team", + "name": "Dotkernel Team", "email": "team@dotkernel.com" }, "license": "ISC", diff --git a/phpstan.neon b/phpstan.neon index 6a112ddb..2ee1ec0a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -21,8 +21,8 @@ parameters: path: src - message: '#Call to an undefined method Laminas\\Authentication\\AuthenticationServiceInterface::getAdapter\(\)#' - path: src/Admin/src/Controller/AdminController.php + path: src/Admin/src/Handler/Account/PostAccountLoginHandler.php - message: '#Call to an undefined method Laminas\\Authentication\\AuthenticationServiceInterface::getStorage\(\)#' - path: src/Admin/src/Controller/AdminController.php + path: src/Admin/src/Handler/Account/PostAccountLoginHandler.php diff --git a/public/js/table_settings.js b/public/js/table_settings.js index 43c96dc7..48b507cb 100644 --- a/public/js/table_settings.js +++ b/public/js/table_settings.js @@ -1 +1 @@ -$((function(){if(!storeSettingsUrl)return void console.error("Invalid or no storeSettingsUrl provided.");if(!columnsSettings)return void console.error("Invalid or no column settings provided.");if(!tableId)return void console.error("Invalid or no tableId provided.");const e=(e,o)=>{o?$(`.column-${e}`).show():$(`.column-${e}`).hide()};$(document).on("click",".ui-checkbox",(()=>{o()}));const o=()=>{const e=$("#btn-edit-admin"),o=$("#btn-delete-admin");e&&o&&(1===$(".ui-checkbox:checked").length?(e?.prop("disabled",!1),o?.prop("disabled",!1)):(e?.prop("disabled",!0),o?.prop("disabled",!0)))};((e,o)=>{const c=$(e);$(".table-column").map(((e,o)=>({text:$(o).text().trim(),column:$(o).data("column")}))).each(((e,n)=>{c.append($("
  • ").append($("
    ").addClass("dropdown-item pT-0 pB-0").append($("").prop("type","checkbox").prop("id",`column-selector-${n.column}`).prop("checked",o.includes(n.column)||0===o.length).addClass("toggle-column-checkbox").data("column",n.column)).append($("
  • ").append($("
    ").addClass("dropdown-item pT-0 pB-0").append($("").prop("type","checkbox").prop("id",`column-selector-${c.column}`).prop("checked",o.includes(c.column)||0===o.length).addClass("toggle-column-checkbox").data("column",c.column)).append($("
    diff --git a/src/Admin/templates/admin/list-logins.html.twig b/src/Admin/templates/admin/list-logins.html.twig index 83f49db7..e6d1a7f9 100644 --- a/src/Admin/templates/admin/list-logins.html.twig +++ b/src/Admin/templates/admin/list-logins.html.twig @@ -10,7 +10,7 @@
    -
    + @@ -41,7 +41,7 @@ - + Reset
    @@ -69,58 +69,58 @@ - {{ sortableColumn('admin', {action: 'logins'}, params, 'identity', 'Identity') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'identity', 'Identity') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'adminIp', 'Ip Address') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'adminIp', 'Ip Address') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'loginStatus', 'Status') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'loginStatus', 'Status') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'country', 'Country') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'country', 'Country') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'continent', 'Continent') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'continent', 'Continent') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'organization', 'Organization') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'organization', 'Organization') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'deviceType', 'Device Type') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'deviceType', 'Device Type') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'deviceBrand', 'Device Brand') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'deviceBrand', 'Device Brand') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'deviceModel', 'Device Model') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'deviceModel', 'Device Model') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'isMobile', 'Is Mobile') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'isMobile', 'Is Mobile') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'osName', 'Os Name') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'osName', 'Os Name') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'osVersion', 'Os Version') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'osVersion', 'Os Version') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'osPlatform', 'Os Platform') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'osPlatform', 'Os Platform') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'clientType', 'Client Type') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'clientType', 'Client Type') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'clientName', 'Client Name') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'clientName', 'Client Name') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'clientEngine', 'Client Engine') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'clientEngine', 'Client Engine') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'clientVersion', 'Client Version') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'clientVersion', 'Client Version') }} - {{ sortableColumn('admin', {action: 'logins'}, params, 'created', 'Created') }} + {{ sortableColumn('admin::admin-login-list', {}, params, 'created', 'Created') }} @@ -164,14 +164,14 @@ {% if pagination.isOutOfBounds() %} {% endif %}
    - {{ include('@partial/pagination.html.twig', {pagination: pagination, path: 'admin', action: 'logins', params: params}, false) }} + {{ include('@partial/pagination.html.twig', {pagination: pagination, path: 'admin::admin-login-list', params: params}, false) }}
    @@ -182,8 +182,8 @@ {{ parent() }} {% endblock %} diff --git a/src/Admin/templates/admin/list.html.twig b/src/Admin/templates/admin/list.html.twig index 62aff0b3..a8704add 100644 --- a/src/Admin/templates/admin/list.html.twig +++ b/src/Admin/templates/admin/list.html.twig @@ -10,7 +10,7 @@
    - + @@ -33,7 +33,7 @@ - + Reset
    @@ -58,22 +58,22 @@ - {{ sortableColumn('admin', {action: 'list'}, params, 'identity', 'Identity') }} + {{ sortableColumn('admin::admin-list', {}, params, 'identity', 'Identity') }} - {{ sortableColumn('admin', {action: 'list'}, params, 'firstName', 'First Name') }} + {{ sortableColumn('admin::admin-list', {}, params, 'firstName', 'First Name') }} - {{ sortableColumn('admin', {action: 'list'}, params, 'lastName', 'Last Name') }} + {{ sortableColumn('admin::admin-list', {}, params, 'lastName', 'Last Name') }} - {{ sortableColumn('admin', {action: 'list'}, params, 'roles', 'Roles') }} + {{ sortableColumn('admin::admin-list', {}, params, 'roles', 'Roles') }} - {{ sortableColumn('admin', {action: 'list'}, params, 'status', 'Status') }} + {{ sortableColumn('admin::admin-list', {}, params, 'status', 'Status') }} - {{ sortableColumn('admin', {action: 'list'}, params, 'created', 'Created') }} + {{ sortableColumn('admin::admin-list', {}, params, 'created', 'Created') }} @@ -85,8 +85,8 @@ @@ -106,19 +106,19 @@ {% if pagination.isOutOfBounds() %} {% endif %}
    - {{ include('@partial/pagination.html.twig', {pagination: pagination, params: params, path: 'admin', action: 'list'}, false) }} + {{ include('@partial/pagination.html.twig', {pagination: pagination, params: params, path: 'admin::admin-list'}, false) }}
    - diff --git a/src/App/templates/error/404.html.twig b/src/App/templates/error/404.html.twig index 61342fef..e730ba39 100644 --- a/src/App/templates/error/404.html.twig +++ b/src/App/templates/error/404.html.twig @@ -12,7 +12,7 @@

    Oops Page Not Found

    The page you are looking for does not exist or has been moved.

    - Home + Home
    diff --git a/src/App/templates/error/error.html.twig b/src/App/templates/error/error.html.twig index 8277676e..7b88b60d 100644 --- a/src/App/templates/error/error.html.twig +++ b/src/App/templates/error/error.html.twig @@ -18,7 +18,7 @@ Internal Server Error

    - Home + Home
    diff --git a/src/App/templates/partial/left-menu.html.twig b/src/App/templates/partial/left-menu.html.twig index 69d29d34..85dee9ad 100644 --- a/src/App/templates/partial/left-menu.html.twig +++ b/src/App/templates/partial/left-menu.html.twig @@ -3,7 +3,7 @@
  • {% else %}