From 3443609da2cbb70e6f30a11050b981ffde5baeee Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 19 Oct 2023 17:54:58 +0000 Subject: [PATCH 1/9] update readme --- CONTRIBUTING.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e237dc9..4f4653b 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ Generally, the development philosophy is result orientated. This means that anyo Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty. -Open tasks can be found in the project overview: [PROJECT.md](https://github.com/Karaka-Management/Organization-Guide/blob/master/Project/PROJECT.md) +Open tasks can be found in the project overview: [PROJECT.md](https://github.com/orgs/Karaka-Management/projects/10) Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task. diff --git a/README.md b/README.md index af4f138..4cb40c2 100755 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Currently Karaka is still developing the first Alpha version. As soon as we have General updates can be found in our info section at https://jingga.app/info and developer updates can be found in our developer section at https://jingga.app/dev. In our developer section you can also check out the automatically generated reports such as code coverage, code style, static analysis etc. as well as our code style guide lines and developer documentation. -* [Project Status](https://github.com/Karaka-Management/Organization-Guide/blob/master/Project/PROJECT.md) +* [Project Status](https://github.com/orgs/Karaka-Management/projects/10) ## Tech stack @@ -62,7 +62,7 @@ General updates can be found in our info section at https://jingga.app/info and ## Become a contributor -Karaka has a very open culture and we always welcome new people who share our philosophy in providing create solutions which just work. You can find the development process description which also describes how to become a contributer in the [Organization documentation](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/Development.md). +Karaka has a very open culture and we always welcome new people who share our philosophy in providing create solutions which just work. You can find the development process description which also describes how to become a contributer in the [Organization documentation](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/01_Development.md). ## Misc From 6db3da2d80e7a841b73abff5e2a22a5063015e31 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 19 Oct 2023 21:44:09 +0000 Subject: [PATCH 2/9] change icon font to google icons --- Admin/Install/Navigation.install.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 61298d5..8a54797 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -7,7 +7,7 @@ "name": "Help", "uri": null, "target": "self", - "icon": "fa fa-question-circle", + "icon": "live_help", "order": 0, "from": "Help", "permission": { "permission": 2, "category": null, "element": null }, From 6d771146cd278c83d36ec40ae9b1b9df082aa54c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 8 Dec 2023 21:52:33 +0000 Subject: [PATCH 3/9] bug fixes --- Controller/SearchController.php | 6 +++--- ICAL.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Controller/SearchController.php b/Controller/SearchController.php index e0ba804..facddcd 100755 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -70,7 +70,7 @@ final class SearchController extends Controller /** @var string[] $toCheck */ $toCheck = Directory::listByExtension($path, 'md'); foreach ($toCheck as $file) { - // @todo: create better matching + // @todo create better matching $content = \file_get_contents($path . '/' . $file); if ($content === false || ($found = \stripos($content, $pattern)) === false) { @@ -121,11 +121,11 @@ final class SearchController extends Controller 'tags' => [], 'type' => 'list_links', ]; - // @todo: add match score for sorted return + // @todo add match score for sorted return } } - // @todo: probably cleanup return for link generation + sort by best match + // @todo probably cleanup return for link generation + sort by best match $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); $response->set($request->uri->__toString(), $files); } diff --git a/ICAL.txt b/ICAL.txt index 019045f..f1b55ed 100755 --- a/ICAL.txt +++ b/ICAL.txt @@ -1,6 +1,6 @@ # Individual Contributor License Agreement ("CLA") 1.0 -Thank you for your interest in Karaka-Management (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose. +Thank you for your interest in Jingga e. K. (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose. By contributing to the Company You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Company. In return, the Company shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the Company and recipients of software distributed by the Company, You reserve all right, title, and interest in and to Your Contributions. From 02333785d530400b7214fa2816ccba796f72f671 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Jan 2024 23:34:17 +0000 Subject: [PATCH 4/9] update --- Controller/BackendController.php | 10 +++++----- Models/PermissionCategory.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 68abc13..4de7d63 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -35,7 +35,7 @@ use Web\Backend\Views\TableView; final class BackendController extends Controller { /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -55,7 +55,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -110,7 +110,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -162,7 +162,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response @@ -249,7 +249,7 @@ final class BackendController extends Controller } /** - * Routing end-point for application behaviour. + * Routing end-point for application behavior. * * @param RequestAbstract $request Request * @param ResponseAbstract $response Response diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index e43f65d..ed6e8ff 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -17,7 +17,7 @@ namespace Modules\Help\Models; use phpOMS\Stdlib\Base\Enum; /** - * Permision state enum. + * Permission category enum. * * @package Modules\Help\Models * @license OMS License 2.0 From 6b97968cc0424c0c5e7de28f22000f29741716c6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 26 Jan 2024 22:53:59 +0000 Subject: [PATCH 5/9] auto fixes + some impl. --- Admin/Install/SearchCommands.php | 8 +- Admin/Routes/Web/Backend.php | 2 +- CONTRIBUTING.md | 164 ++++++++++++++++++---- LICENSE.txt | 2 +- Theme/Backend/help-module-list.tpl.php | 2 +- Theme/Backend/help-module.tpl.php | 2 +- tests/Autoloader.php | 4 +- tests/Bootstrap.php | 71 ++++++---- tests/Controller/SearchControllerTest.php | 17 ++- 9 files changed, 198 insertions(+), 74 deletions(-) diff --git a/Admin/Install/SearchCommands.php b/Admin/Install/SearchCommands.php index 801f67e..1bed59f 100755 --- a/Admin/Install/SearchCommands.php +++ b/Admin/Install/SearchCommands.php @@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType; use phpOMS\Router\RouteVerb; return [ - '^:help .*$' => [ + '^:help (\?.*$|$)' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, @@ -29,7 +29,7 @@ return [ ], ], ], - '^:help :user .*$' => [ + '^:help :user (\?.*$|$)' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, @@ -40,7 +40,7 @@ return [ ], ], ], - '^:help :dev .*$' => [ + '^:help :dev (\?.*$|$)' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, @@ -51,7 +51,7 @@ return [ ], ], ], - '^:help :module .*$' => [ + '^:help :module (\?.*$|$)' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index f556a3b..12ea5d0 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -40,7 +40,7 @@ return [ ], ], ], - '^.*/help/module/single(\?.*)?$' => [ + '^.*/help/module/view(\?.*)?$' => [ [ 'dest' => '\Modules\Help\Controller\BackendController:viewHelpModule', 'verb' => RouteVerb::GET, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f4653b..88c5d9c 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,16 @@ -# Development - ## Development environment - The setup and configuration of the development environment is in the hands of every developer themselves. However, it is recommended to follow the setup instructions in the [Developer-Guide](https://github.com/Karaka-Management/Developer-Guide/blob/develop/general/setup.md). +The setup and configuration of the development environment is in the hands of every developer themselves. However, it is recommended to follow the setup instructions in the [Developer-Guide](https://github.com/Karaka-Management/Developer-Guide/blob/develop/general/setup.md). ## Code of conduct -Every organization member and contributor to the organization must follow the [code of conduct](../Policies & Guidelines/Code of conduct.md). +Every organization member and contributor to the organization must follow the [Code of Conduct](../Policies%20&%20Guidelines/Code%20of%20Conduct.md). + +## Becoming a contributor + +For public repositories you can immediately start by creating forks and pull requests. For private repositories which are necessary to setup the complete developer environment, feel free to request access. Please not that we may not immediately give you access to private repositories and instead will give you smaller tasks regarding public repositories. Please contact info@jingga.app for more details. (**R1**) + +For all contributions our [Contributor License Agreement "CLA"](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/HR/Hiring/Individual%20Contributor%20License%20Agreement.md) comes into effect. (**R2**) ## Code changes @@ -14,58 +18,106 @@ Every organization member and contributor to the organization must follow the [c Generally, the development philosophy is result orientated. This means that anyone can propose tasks, pick up existing tasks or right away implement their code changes. However, implementing code changes without consulting with a senior developer in advance has a much higher risk of code changes not getting admitted. The easiest way to discuss a code change idea in advance are the github [issues](https://github.com/Karaka-Management/Karaka/issues) or [discussions](https://github.com/Karaka-Management/Karaka/discussions). -Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty. +Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty. -Open tasks can be found in the project overview: [PROJECT.md](https://github.com/orgs/Karaka-Management/projects/10) +Open tasks can be found in the project overview: [Todos](https://github.com/orgs/Karaka-Management/projects/10) -Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task. +Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task. -The open tasks are reviewed once a month by a senior developer. The senior developer updates the project overview if necessary and requests feedback regarding development status of important tasks under development. During this process important tasks may also get directly assigned to developers. This review is performed on a judgmental bases of the senior basis. +The open tasks are reviewed once a month by a senior developer. The senior developer updates the project overview if necessary and requests feedback regarding development status of important tasks under development. During this process important tasks may also get directly assigned to developers. This review is performed on a judgmental bases of the senior basis. -### Code style +### Quality -Code changes must follow the [style guidelines](https://github.com/Karaka-Management/Developer-Guide/tree/develop/standards). Additionally, the automatic code style inspection tools must return no errors, failures or warnings. Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. +#### Code style -In rare cases errors, failures or warnings during the automatic inspection are acceptable. Reasons can be changes in the programming language, special cases which cannot, are difficult or must be individually configured in the inspection settings. If this is the case for a code change and if inspection configuration changes are necessary are decided by the senior developer performing the code review. +Code changes must follow the [style guidelines](https://github.com/Karaka-Management/Developer-Guide/tree/develop/standards) (**R3**). Additionally, the automatic code style inspection tools must return no errors, failures or warnings. Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. (**R4**) -Automated checks which are run during the review process: +In rare cases errors, failures or warnings during the automatic inspection are acceptable. Reasons can be for example special cases which are difficult automatize or must be individually configured in the inspection settings. If this is the case for a code change and if inspection configuration changes are necessary are decided by the senior developer performing the code review. (**R5**) + +Automated checks which are run during the review process (**R4**): ```sh -php ./vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" +php ./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" +php ./vendor/bin/php-cs-fixer fix ./ --config=Build/Config/.php-cs-fixer.php --allow-risky=yes +php ./vendor/bin/phpcbf --standard=Build/Config/phpcs.xml ./ +php ./vendor/bin/rector process --dry-run --config Build/Config/rector.php ./ npx eslint ./ -c ./Build/Config/.eslintrc.json ``` -### Tests +#### Tests -Code changes must follow the inspection guidelines (i.e. code coverage) mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md). Developers should check if the code changes comply with the inspection guidelines before submitting them. +Code changes must follow the inspection guidelines (i.e. code coverage) mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) (**R6**). Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. (**R7**) -In rare cases it might be not possible to follow the inspection guidelines. In such cases the senior developer performing the code review may decide if the code change still gets accepted. +In rare cases it might be not possible to follow the inspection guidelines. In such cases the senior developer performing the code review may decide if the code change still gets accepted. (**R8**) -Automated tests which are run during the review process: +Automated tests which are run during the review process (**R7**): ```sh php ./vendor/bin/phpunit -c tests/PHPUnit/phpunit_default.xml -php ./vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 9 -c Build/Config/phpstan.neon ./ +php ./vendor/bin/phpstan analyse --no-progress -l 9 -c Build/Config/phpstan.neon ./ npx jasmine-node ./ ./cOMS/tests/test.sh ``` -Additional inspections which are run but might be ignored during the review depending on the use case are mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) as other checks. +Additional inspections which are run but might be ignored during the review depending on the use case are mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) as other checks. (**R7**) -### Demo +#### Performance -Some code changes may also require changes or extensions in the demo setup scripts. The demo setup script try to simulate a real world use case by generating and modifying mostly random data. This is also a good way to setup and “manually” test the code changes in a larger picture. The demo setup script can be found in the [demoSetup](https://github.com/Karaka-Management/demoSetup) repository. The demo setup script takes a long time due to the large amount of user input simulated data which is generated. Therefore it is recommended to run this only sporadically. +Developers should occasionaly check performance statistics. At this point no target metrics are defined. -### Code review +Since the primary application is a web based application a similar tool as the Google lighthouse tool can be used to inspect the application for best practicies which can significantly improve the application performance. The sitespeed.io tool shows potential performance improvements and slow pages. With the php trace and profiler enabled in the `php.ini` file the VM automatically generates profiling and trace reports for every web request. These can be found in the webgrind logs directory and inspected in webgrind and dropped into the trace visualizer for a flame chart visualization. With mysqldumpslow you can inspect slow sql queries which may need optimization. + +1. Automatic trace and benchmark generation with every web request in `/var/www/html/webgrind/Logs` +2. Webgrind view `http://vm_ip:82` +3. Trace visualization `http://vm_ip:81` + 1. Download the latest trace from `http://vm_ip:82/Logs` + 2. Drag and drop that downloaded `*.xt` file in the trace visualizer +4. `sitespeed.io ./Build/Helper/Scripts/sitespeedDemoUrls.txt -b chrome --outputFolder /var/www/html/sitespeed` +5. Slow query inspection. + +```sh +mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log +mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log +``` + +#### Code review In addition to the automatic code review performed by the various inspection tools such as (phpcs, phpstan, phpunit, eslint and custom scripts) a senior developer must check the proposed code change before it is merged with the respective `develop` branch. Only upon the approval by the reviewer a code change requests gets merged as no other developers have permission in the software to make such code merges. In case a code change request is not approved the reviewer states the reason for the decision, this may include some tips and requests which will allow the contributor to make improvements so that the code change may get approved. -If the code reviewer only finds minor issues with the proposed code change the reviewer may make small changes to the proposed code change and inform the contributor to speed up the implementation process. Code reviewers are encouraged to do this with new contributors to avoid long iteration processes and to not discourage new developers. However, communication is key and severe issues with code change requests or if the contributor already made multiple code change requests in the past the reviewer should not implement the improvements by himself and rather decline the code change requests with his reasoning. +If the code reviewer only finds minor issues with the proposed code change the reviewer may make small changes to the proposed code change and inform the contributor to speed up the implementation process. Code reviewers are encouraged to do this with new contributors to avoid long iteration processes and to not discourage new developers. However, communication is key and severe issues with code change requests or if the contributor already made multiple code change requests in the past the reviewer should not implement the improvements by himself and rather decline the code change requests with his reasoning. (**R5**+**R8**) + +#### Demo + +Some code changes may also require changes or extensions in the demo setup scripts. The demo setup script try to simulate a real world use case by generating and modifying mostly random data. This is also a good way to setup and “manually” test the code changes in a larger picture. The demo setup script can be found in the [demoSetup](https://github.com/Karaka-Management/demoSetup) repository. The demo setup script takes a long time due to the large amount of user input simulated data which is generated. Therefore it is recommended to run this only sporadically. (**R9**) + +```sh +sudo -u www-data php -dxdebug.remote_enable=1 -dxdebug.start_with_request=yes -dxdebug.mode=coverage,develop,debug demoSetup/setup.php +``` + +#### Documentation + +Occasionally new code or code changes also require new documentation or documentation changes. Developers should make sure that the new code is also reflected in the existing documentation ([Developer-Guide](), [User-Guide]() and/or module documentation) or if additional documentation is necessary. + +#### Improvements, features, bugs + +If a developer (or employee in general) has an idea for an improvement, feature or finds a potential bug it should be reported at https://github.com/Karaka-Management/Karaka/issues. A senior developer has to check these issues and decide how to proceed with them. The decision how to proceed with the issue must be explained by the senior developer as a response in the issue. Possible steps are: + +* Accept the issue and put the task into the [Todos](https://github.com/orgs/Karaka-Management/projects/10) +* Dismiss the issue with an explanation ### Release flow +In case SCSS/CSS or JS files got changed they must get re-built locally before comitting the code change: + +```sh +npx esbuild Web/Backend/js/backend.js --bundle --outfile=Install/Application/Backend/js/backend.min.js --minify +scss cssOMS/styles.scss > cssOMS/styles.css +``` + +For JS you may also use the shorthand command `npm run build`. + Code changes must be performed in a new branch. A new branch can be created with: ```sh @@ -75,8 +127,70 @@ git checkout -b new-branch-name The name of the branch can be chosen freely however it is recommended to follow the following branch naming conventions: * `feature-*` for feature implementations +* `hotfix-*` for security related fixes/improvements * `bug-*` for bug fixes * `security-*` for security related fixes/improvements -* `general-*` for general improvements (i.e. code documentation improvements, code style improvements) +* `general-*` for general improvements (i.e. documentation, code style & performance improvements) -The senior developer who performs the code review merges the change request into the `develop` branch upon approval. \ No newline at end of file +```mermaid +%%{init: { 'gitGraph': {'mainBranchName': 'master'}} }%% + gitGraph + commit + branch hotfix-xxx + commit + checkout master + branch develop + checkout master + merge hotfix-xxx + checkout develop + branch bug-xxx + commit + commit + checkout hotfix-xxx + commit + checkout master + merge hotfix-xxx + checkout develop + merge bug-xxx + commit + checkout develop + branch feature-xxx + commit + commit + commit + checkout develop + merge feature-xxx + checkout master + merge develop + checkout develop + branch general-xxx + commit + checkout develop + merge general-xxx + branch security-xxx + commit + commit + checkout develop + merge security-xxx + checkout master + merge develop + +``` + +The senior developer who performs the code review merges the change request into the `develop` branch after their successful code review. Unsuccessful reviews lead to change requests by the original developer, other developers who can make the requested changes, changes by the senior developer who performed the review, or dismissal of the changed code. (**R10**) + +## Approved dependencies + +### Customer dependencies + +Developers may only rely on the dependencies defined in [Approved Customer Software]() when developing a solution. If new software should be added to this list or a different version is required developers should make a request with their team leader/head of department who forwards this requests if appropriate to the CTO and explain the reasoning for the different dependency needs. The CTO can decide if the dependency will be accepted. (**R11**) + +### Developer dependencies + +Developers may only rely on the dependencies defined in [IT Equipment & Software](). If new software should be added to this list or a different version is required developers should make a request with their team leader/head of department who forwards this requests if appropriate to the CTO and explain the reasoning for the different dependency needs. The CTO can decide if the dependency will be accepted. Changing the package managers such as `composer.json` or `package.json` is not allowed by anyone else than the CTO. (**R12**) + +## Other related documents + +* [Confidentiality Policy](../Policies%20&%20Guidelines/Confidentiality%20Policy.md) +* [Organization Activity Policy](../Policies%20&%20Guidelines/Organization%20Activity%20Policy.md) +* [Tutorials](./Development/Tutorials) \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index 18d430e..4ba0161 100755 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -27,7 +27,7 @@ Version 2.0 Subject to the terms and conditions of this License, each Contributor grants to You after purchase a perpetual, worldwide, non-exclusive, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform the Work and such Derivative Works in Source or Object form. You are not allowed to sublicense, reproduce, or distribute the Work and such Derivative Works in Source or Object form. -3. Redistribution. +3. Redistribution You may not reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form. diff --git a/Theme/Backend/help-module-list.tpl.php b/Theme/Backend/help-module-list.tpl.php index 1d3c048..496b5af 100755 --- a/Theme/Backend/help-module-list.tpl.php +++ b/Theme/Backend/help-module-list.tpl.php @@ -57,7 +57,7 @@ $tableView->setObjects($modules); ++$count; $url = UriFactory::build( - '{/lang}/backend/help/module/single?id=' . $module->getInternalName() + '{/lang}/backend/help/module/view?id=' . $module->getInternalName() ); ?> diff --git a/Theme/Backend/help-module.tpl.php b/Theme/Backend/help-module.tpl.php index ad8a4f6..baf66e5 100755 --- a/Theme/Backend/help-module.tpl.php +++ b/Theme/Backend/help-module.tpl.php @@ -13,7 +13,7 @@
data['navigation'] ?? '')) : ?> diff --git a/tests/Autoloader.php b/tests/Autoloader.php index dae30b7..5aca50a 100755 --- a/tests/Autoloader.php +++ b/tests/Autoloader.php @@ -75,8 +75,8 @@ final class Autoloader */ public static function defaultAutoloader(string $class) : void { - $class = \ltrim($class, '\\'); - $class = \strtr($class, '_\\', '//'); + $class = \ltrim($class, '\\'); + $class = \strtr($class, '_\\', '//'); if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) { $class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class); diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index ddc049d..a0e125a 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,4 +1,15 @@ [ + 'db' => [ 'core' => [ 'masters' => [ - 'admin' => [ + 'admin' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -80,7 +91,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -90,7 +101,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -100,7 +111,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -110,7 +121,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -120,7 +131,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -132,7 +143,7 @@ $CONFIG = [ ], ], 'postgresql' => [ - 'admin' => [ + 'admin' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -142,7 +153,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -152,7 +163,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -162,7 +173,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -172,7 +183,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -182,7 +193,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -194,37 +205,37 @@ $CONFIG = [ ], ], 'sqlite' => [ - 'admin' => [ + 'admin' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ @@ -232,7 +243,7 @@ $CONFIG = [ ], ], 'mssql' => [ - 'admin' => [ + 'admin' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -242,7 +253,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -252,7 +263,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -262,7 +273,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -272,7 +283,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -282,7 +293,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -322,16 +333,16 @@ $CONFIG = [ 'password' => '123456', ], ], - 'log' => [ + 'log' => [ 'file' => [ 'path' => __DIR__ . '/Logs', ], ], - 'page' => [ + 'page' => [ 'root' => '/', 'https' => false, ], - 'app' => [ + 'app' => [ 'path' => __DIR__, 'default' => [ 'app' => 'Backend', @@ -350,7 +361,7 @@ $CONFIG = [ ], ], ], - 'socket' => [ + 'socket' => [ 'master' => [ 'host' => '127.0.0.1', 'limit' => 300, @@ -360,7 +371,7 @@ $CONFIG = [ 'language' => [ 'en', ], - 'apis' => [ + 'apis' => [ ], ]; diff --git a/tests/Controller/SearchControllerTest.php b/tests/Controller/SearchControllerTest.php index 598b0a1..6151883 100755 --- a/tests/Controller/SearchControllerTest.php +++ b/tests/Controller/SearchControllerTest.php @@ -27,7 +27,6 @@ use phpOMS\Message\Http\HttpResponse; use phpOMS\Module\ModuleAbstract; use phpOMS\Module\ModuleManager; use phpOMS\Router\WebRouter; -use phpOMS\Uri\HttpUri; use phpOMS\Utils\TestUtils; /** @@ -54,13 +53,13 @@ final class SearchControllerTest extends \PHPUnit\Framework\TestCase protected string $appName = 'Search'; }; - $this->app->dbPool = $GLOBALS['dbpool']; - $this->app->unitId = 1; - $this->app->accountManager = new AccountManager($GLOBALS['session']); - $this->app->appSettings = new CoreSettings(); - $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/'); - $this->app->dispatcher = new Dispatcher($this->app); - $this->app->eventManager = new EventManager($this->app->dispatcher); + $this->app->dbPool = $GLOBALS['dbpool']; + $this->app->unitId = 1; + $this->app->accountManager = new AccountManager($GLOBALS['session']); + $this->app->appSettings = new CoreSettings(); + $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/'); + $this->app->dispatcher = new Dispatcher($this->app); + $this->app->eventManager = new EventManager($this->app->dispatcher); $this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php'); $account = new Account(); @@ -94,7 +93,7 @@ final class SearchControllerTest extends \PHPUnit\Framework\TestCase public function testHelpSearch() : void { $response = new HttpResponse(); - $request = new HttpRequest(new HttpUri('')); + $request = new HttpRequest(); $request->header->account = 1; $request->setData('search', ':help introduction'); From 9fbedbe663bb274e8ad8824d38228e2c3c5d1fa0 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 4 Feb 2024 20:34:12 +0000 Subject: [PATCH 6/9] update --- Admin/Install/SearchCommands.php | 8 ++++---- Controller/SearchController.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Admin/Install/SearchCommands.php b/Admin/Install/SearchCommands.php index 1bed59f..9e8333f 100755 --- a/Admin/Install/SearchCommands.php +++ b/Admin/Install/SearchCommands.php @@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType; use phpOMS\Router\RouteVerb; return [ - '^:help (\?.*$|$)' => [ + '^:help (?!:).+.*?' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, @@ -29,7 +29,7 @@ return [ ], ], ], - '^:help :user (\?.*$|$)' => [ + '^:help :user .*?' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, @@ -40,7 +40,7 @@ return [ ], ], ], - '^:help :dev (\?.*$|$)' => [ + '^:help :dev .*?' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, @@ -51,7 +51,7 @@ return [ ], ], ], - '^:help :module (\?.*$|$)' => [ + '^:help :module .*?' => [ [ 'dest' => '\Modules\Help\Controller\SearchController:searchHelp', 'verb' => RouteVerb::ANY, diff --git a/Controller/SearchController.php b/Controller/SearchController.php index facddcd..0c1a049 100755 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -108,8 +108,8 @@ final class SearchController extends Controller $summaryEnd - $summaryStart ); - $files[$module['name']['internal']][] = [ - 'title' => $module['name']['external'] . ': ' . \trim($headline, " #\r\n\t"), + $files[] = [ + 'title' => \trim($headline, " #\r\n\t"), 'summary' => \trim($summary, " #\r\n\t"), 'link' => $path . '/' . $file, 'account' => '', @@ -127,6 +127,6 @@ final class SearchController extends Controller // @todo probably cleanup return for link generation + sort by best match $response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true); - $response->set($request->uri->__toString(), $files); + $response->add($request->uri->__toString(), $files); } } From 4913145b7ff749a1c609da56c03c04b48b37aff8 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 28 Feb 2024 05:09:11 +0000 Subject: [PATCH 7/9] bump --- .github/dev_bug_report.md | 35 ----- .github/dev_feature_request.md | 18 --- Admin/Install/Navigation.install.json | 2 +- CODE_OF_CONDUCT.md | 46 ------ CONTRIBUTING.md | 196 -------------------------- Controller/BackendController.php | 39 +++-- Controller/Controller.js | 29 ++++ Controller/SearchController.php | 6 + Theme/Backend/help-developer.tpl.php | 2 +- Theme/Backend/help-general.tpl.php | 2 +- Theme/Backend/help-module.tpl.php | 2 +- 11 files changed, 57 insertions(+), 320 deletions(-) delete mode 100755 .github/dev_bug_report.md delete mode 100755 .github/dev_feature_request.md delete mode 100755 CODE_OF_CONDUCT.md delete mode 100755 CONTRIBUTING.md create mode 100644 Controller/Controller.js diff --git a/.github/dev_bug_report.md b/.github/dev_bug_report.md deleted file mode 100755 index ef93e56..0000000 --- a/.github/dev_bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Dev Bug Report -about: Create a report to help us improve -title: '' -labels: stat_backlog, type_bug -assignees: '' - ---- - -# Bug Description -A clear and concise description of what the bug is. - -# How to Reproduce - -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -## Minimal Code Example - -``` -// your code ... -``` - -# Expected Behavior -A clear and concise description of what you expected to happen. - -# Screenshots -If applicable, add screenshots to help explain your problem. - -# Additional Information -Add any other context about the problem here. diff --git a/.github/dev_feature_request.md b/.github/dev_feature_request.md deleted file mode 100755 index 9573c35..0000000 --- a/.github/dev_feature_request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Dev Feature Request -about: Suggest an idea for this project -title: '' -labels: stat_backlog, type_feature -assignees: '' - ---- - -# What is the feature you request -* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -* A clear and concise description of what you want to happen. - -# Alternatives -A clear and concise description of any alternative solutions or features you've considered. - -# Additional Information -Add any other context or screenshots about the feature request here. diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 8a54797..a588614 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -34,7 +34,7 @@ "type": 2, "subtype": 1, "name": "Modules", - "uri": "{/base}/help/module/list", + "uri": "{/base}/help/module/list?{?}", "target": "self", "icon": null, "order": 10, diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100755 index 1b14538..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at spl1nes.com@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100755 index 88c5d9c..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,196 +0,0 @@ -## Development environment - -The setup and configuration of the development environment is in the hands of every developer themselves. However, it is recommended to follow the setup instructions in the [Developer-Guide](https://github.com/Karaka-Management/Developer-Guide/blob/develop/general/setup.md). - -## Code of conduct - -Every organization member and contributor to the organization must follow the [Code of Conduct](../Policies%20&%20Guidelines/Code%20of%20Conduct.md). - -## Becoming a contributor - -For public repositories you can immediately start by creating forks and pull requests. For private repositories which are necessary to setup the complete developer environment, feel free to request access. Please not that we may not immediately give you access to private repositories and instead will give you smaller tasks regarding public repositories. Please contact info@jingga.app for more details. (**R1**) - -For all contributions our [Contributor License Agreement "CLA"](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/HR/Hiring/Individual%20Contributor%20License%20Agreement.md) comes into effect. (**R2**) - -## Code changes - -### Topics / Tasks / Todos - -Generally, the development philosophy is result orientated. This means that anyone can propose tasks, pick up existing tasks or right away implement their code changes. However, implementing code changes without consulting with a senior developer in advance has a much higher risk of code changes not getting admitted. The easiest way to discuss a code change idea in advance are the github [issues](https://github.com/Karaka-Management/Karaka/issues) or [discussions](https://github.com/Karaka-Management/Karaka/discussions). - -Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty. - -Open tasks can be found in the project overview: [Todos](https://github.com/orgs/Karaka-Management/projects/10) - -Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task. - -The open tasks are reviewed once a month by a senior developer. The senior developer updates the project overview if necessary and requests feedback regarding development status of important tasks under development. During this process important tasks may also get directly assigned to developers. This review is performed on a judgmental bases of the senior basis. - -### Quality - -#### Code style - -Code changes must follow the [style guidelines](https://github.com/Karaka-Management/Developer-Guide/tree/develop/standards) (**R3**). Additionally, the automatic code style inspection tools must return no errors, failures or warnings. Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. (**R4**) - -In rare cases errors, failures or warnings during the automatic inspection are acceptable. Reasons can be for example special cases which are difficult automatize or must be individually configured in the inspection settings. If this is the case for a code change and if inspection configuration changes are necessary are decided by the senior developer performing the code review. (**R5**) - -Automated checks which are run during the review process (**R4**): - -```sh -php ./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml" -php ./vendor/bin/php-cs-fixer fix ./ --config=Build/Config/.php-cs-fixer.php --allow-risky=yes -php ./vendor/bin/phpcbf --standard=Build/Config/phpcs.xml ./ -php ./vendor/bin/rector process --dry-run --config Build/Config/rector.php ./ -npx eslint ./ -c ./Build/Config/.eslintrc.json -``` - -#### Tests - -Code changes must follow the inspection guidelines (i.e. code coverage) mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) (**R6**). Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. (**R7**) - -In rare cases it might be not possible to follow the inspection guidelines. In such cases the senior developer performing the code review may decide if the code change still gets accepted. (**R8**) - -Automated tests which are run during the review process (**R7**): - -```sh -php ./vendor/bin/phpunit -c tests/PHPUnit/phpunit_default.xml -php ./vendor/bin/phpstan analyse --no-progress -l 9 -c Build/Config/phpstan.neon ./ -npx jasmine-node ./ -./cOMS/tests/test.sh -``` - -Additional inspections which are run but might be ignored during the review depending on the use case are mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) as other checks. (**R7**) - -#### Performance - -Developers should occasionaly check performance statistics. At this point no target metrics are defined. - -Since the primary application is a web based application a similar tool as the Google lighthouse tool can be used to inspect the application for best practicies which can significantly improve the application performance. The sitespeed.io tool shows potential performance improvements and slow pages. With the php trace and profiler enabled in the `php.ini` file the VM automatically generates profiling and trace reports for every web request. These can be found in the webgrind logs directory and inspected in webgrind and dropped into the trace visualizer for a flame chart visualization. With mysqldumpslow you can inspect slow sql queries which may need optimization. - -1. Automatic trace and benchmark generation with every web request in `/var/www/html/webgrind/Logs` -2. Webgrind view `http://vm_ip:82` -3. Trace visualization `http://vm_ip:81` - 1. Download the latest trace from `http://vm_ip:82/Logs` - 2. Drag and drop that downloaded `*.xt` file in the trace visualizer -4. `sitespeed.io ./Build/Helper/Scripts/sitespeedDemoUrls.txt -b chrome --outputFolder /var/www/html/sitespeed` -5. Slow query inspection. - -```sh -mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log -mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log -``` - -#### Code review - -In addition to the automatic code review performed by the various inspection tools such as (phpcs, phpstan, phpunit, eslint and custom scripts) a senior developer must check the proposed code change before it is merged with the respective `develop` branch. Only upon the approval by the reviewer a code change requests gets merged as no other developers have permission in the software to make such code merges. - -In case a code change request is not approved the reviewer states the reason for the decision, this may include some tips and requests which will allow the contributor to make improvements so that the code change may get approved. - -If the code reviewer only finds minor issues with the proposed code change the reviewer may make small changes to the proposed code change and inform the contributor to speed up the implementation process. Code reviewers are encouraged to do this with new contributors to avoid long iteration processes and to not discourage new developers. However, communication is key and severe issues with code change requests or if the contributor already made multiple code change requests in the past the reviewer should not implement the improvements by himself and rather decline the code change requests with his reasoning. (**R5**+**R8**) - -#### Demo - -Some code changes may also require changes or extensions in the demo setup scripts. The demo setup script try to simulate a real world use case by generating and modifying mostly random data. This is also a good way to setup and “manually” test the code changes in a larger picture. The demo setup script can be found in the [demoSetup](https://github.com/Karaka-Management/demoSetup) repository. The demo setup script takes a long time due to the large amount of user input simulated data which is generated. Therefore it is recommended to run this only sporadically. (**R9**) - -```sh -sudo -u www-data php -dxdebug.remote_enable=1 -dxdebug.start_with_request=yes -dxdebug.mode=coverage,develop,debug demoSetup/setup.php -``` - -#### Documentation - -Occasionally new code or code changes also require new documentation or documentation changes. Developers should make sure that the new code is also reflected in the existing documentation ([Developer-Guide](), [User-Guide]() and/or module documentation) or if additional documentation is necessary. - -#### Improvements, features, bugs - -If a developer (or employee in general) has an idea for an improvement, feature or finds a potential bug it should be reported at https://github.com/Karaka-Management/Karaka/issues. A senior developer has to check these issues and decide how to proceed with them. The decision how to proceed with the issue must be explained by the senior developer as a response in the issue. Possible steps are: - -* Accept the issue and put the task into the [Todos](https://github.com/orgs/Karaka-Management/projects/10) -* Dismiss the issue with an explanation - -### Release flow - -In case SCSS/CSS or JS files got changed they must get re-built locally before comitting the code change: - -```sh -npx esbuild Web/Backend/js/backend.js --bundle --outfile=Install/Application/Backend/js/backend.min.js --minify -scss cssOMS/styles.scss > cssOMS/styles.css -``` - -For JS you may also use the shorthand command `npm run build`. - -Code changes must be performed in a new branch. A new branch can be created with: - -```sh -git checkout -b new-branch-name -``` - -The name of the branch can be chosen freely however it is recommended to follow the following branch naming conventions: - -* `feature-*` for feature implementations -* `hotfix-*` for security related fixes/improvements -* `bug-*` for bug fixes -* `security-*` for security related fixes/improvements -* `general-*` for general improvements (i.e. documentation, code style & performance improvements) - -```mermaid -%%{init: { 'gitGraph': {'mainBranchName': 'master'}} }%% - gitGraph - commit - branch hotfix-xxx - commit - checkout master - branch develop - checkout master - merge hotfix-xxx - checkout develop - branch bug-xxx - commit - commit - checkout hotfix-xxx - commit - checkout master - merge hotfix-xxx - checkout develop - merge bug-xxx - commit - checkout develop - branch feature-xxx - commit - commit - commit - checkout develop - merge feature-xxx - checkout master - merge develop - checkout develop - branch general-xxx - commit - checkout develop - merge general-xxx - branch security-xxx - commit - commit - checkout develop - merge security-xxx - checkout master - merge develop - -``` - -The senior developer who performs the code review merges the change request into the `develop` branch after their successful code review. Unsuccessful reviews lead to change requests by the original developer, other developers who can make the requested changes, changes by the senior developer who performed the review, or dismissal of the changed code. (**R10**) - -## Approved dependencies - -### Customer dependencies - -Developers may only rely on the dependencies defined in [Approved Customer Software]() when developing a solution. If new software should be added to this list or a different version is required developers should make a request with their team leader/head of department who forwards this requests if appropriate to the CTO and explain the reasoning for the different dependency needs. The CTO can decide if the dependency will be accepted. (**R11**) - -### Developer dependencies - -Developers may only rely on the dependencies defined in [IT Equipment & Software](). If new software should be added to this list or a different version is required developers should make a request with their team leader/head of department who forwards this requests if appropriate to the CTO and explain the reasoning for the different dependency needs. The CTO can decide if the dependency will be accepted. Changing the package managers such as `composer.json` or `package.json` is not allowed by anyone else than the CTO. (**R12**) - -## Other related documents - -* [Confidentiality Policy](../Policies%20&%20Guidelines/Confidentiality%20Policy.md) -* [Organization Activity Policy](../Policies%20&%20Guidelines/Organization%20Activity%20Policy.md) -* [Tutorials](./Development/Tutorials) \ No newline at end of file diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 4de7d63..3daa437 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -14,8 +14,7 @@ declare(strict_types=1); namespace Modules\Help\Controller; -use Modules\Admin\Models\SettingsEnum; -use Modules\Media\Models\MediaMapper; +use phpOMS\Asset\AssetType; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; @@ -54,6 +53,16 @@ final class BackendController extends Controller return $view; } + private function loadCodeHighlighting(ResponseAbstract $response) : void + { + $head = $response->data['Content']->head; + $nonce = $this->app->appSettings->getOption('script-nonce'); + + $head->addAsset(AssetType::CSS, 'Resources/highlightjs/styles/a11y-light.min.css?v=' . $this->app->version); + $head->addAsset(AssetType::JSLATE, 'Resources/highlightjs/highlight.min.js?v=' . $this->app->version, ['nonce' => $nonce]); + $head->addAsset(AssetType::JSLATE, 'Modules/Help/Controller/Controller.js?v=' . self::VERSION, ['nonce' => $nonce, 'type' => 'module']); + } + /** * Routing end-point for application behavior. * @@ -68,6 +77,8 @@ final class BackendController extends Controller */ public function viewHelpGeneral(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { + $this->loadCodeHighlighting($response); + $view = new View($this->app->l11nManager, $request, $response); $path = $this->getHelpGeneralPath($request); @@ -128,30 +139,12 @@ final class BackendController extends Controller $view->data['modules'] = $this->app->moduleManager->getInstalledModules(); - /** @var \Model\Setting[] $exportTemplates */ - $exportTemplates = $this->app->appSettings->get( - names: [ - SettingsEnum::DEFAULT_LIST_EXPORTS, - ], - module: 'Admin' - ); - - $templateIds = []; - foreach ($exportTemplates as $template) { - $templateIds[] = (int) $template->content; - } - - /** @var \Modules\Media\Models\Media[] $mediaTemplates */ - $mediaTemplates = MediaMapper::getAll() - ->where('id', $templateIds, 'in') - ->execute(); - $tableView = new TableView($this->app->l11nManager, $request, $response); $tableView->module = 'Help'; $tableView->theme = 'Backend'; $tableView->setTitleTemplate('/Web/Backend/Themes/table-title'); $tableView->setExportTemplate('/Web/Backend/Themes/popup-export-data'); - $tableView->setExportTemplates($mediaTemplates); + $tableView->setExportTemplates([]); $tableView->setColumnHeaderElementTemplate('/Web/Backend/Themes/header-element-table'); $tableView->setFilterTemplate('/Web/Backend/Themes/popup-filter-table'); $tableView->setSortTemplate('/Web/Backend/Themes/sort-table'); @@ -175,6 +168,8 @@ final class BackendController extends Controller */ public function viewHelpModule(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { + $this->loadCodeHighlighting($response); + $active = $this->app->moduleManager->getActiveModules(); if (!$request->hasData('id') || !isset($active[$request->getData('id')])) { @@ -262,6 +257,8 @@ final class BackendController extends Controller */ public function viewHelpDeveloper(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { + $this->loadCodeHighlighting($response); + $view = new View($this->app->l11nManager, $request, $response); $path = $this->getHelpDeveloperPath($request); diff --git a/Controller/Controller.js b/Controller/Controller.js new file mode 100644 index 0000000..d9842ef --- /dev/null +++ b/Controller/Controller.js @@ -0,0 +1,29 @@ +import { Autoloader } from '../../../jsOMS/Autoloader.js'; + +Autoloader.defineNamespace('omsApp.Modules'); + +omsApp.Modules.Help = class { + /** + * @constructor + * + * @since 1.0.0 + */ + constructor (app) + { + this.app = app; + }; + + bind (id) + { + const e = typeof id === 'undefined' ? document.getElementsByTagName('code') : [document.getElementById(id)], + length = e.length; + + hljs.highlightAll(); + }; + + bindElement (code) + { + }; +}; + +window.omsApp.moduleManager.get('Help').bind(); \ No newline at end of file diff --git a/Controller/SearchController.php b/Controller/SearchController.php index 0c1a049..494d90a 100755 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -40,6 +40,12 @@ final class SearchController extends Controller * * @api * + * @todo Improve the searchHelp() function. + * It is slow and uses very stupid search logic + * Solution: Elasticsearch + * https://github.com/Karaka-Management/oms-Help/issues/4 + * https://github.com/Karaka-Management/Karaka/issues/160 + * * @since 1.0.0 */ public function searchHelp(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void diff --git a/Theme/Backend/help-developer.tpl.php b/Theme/Backend/help-developer.tpl.php index 76755a9..6fd5e28 100755 --- a/Theme/Backend/help-developer.tpl.php +++ b/Theme/Backend/help-developer.tpl.php @@ -7,7 +7,7 @@
-
+
data['navigation']; ?> diff --git a/Theme/Backend/help-general.tpl.php b/Theme/Backend/help-general.tpl.php index 76755a9..6fd5e28 100755 --- a/Theme/Backend/help-general.tpl.php +++ b/Theme/Backend/help-general.tpl.php @@ -7,7 +7,7 @@
-
+
data['navigation']; ?> diff --git a/Theme/Backend/help-module.tpl.php b/Theme/Backend/help-module.tpl.php index baf66e5..a0b0f91 100755 --- a/Theme/Backend/help-module.tpl.php +++ b/Theme/Backend/help-module.tpl.php @@ -11,7 +11,7 @@
-
+
From c334075cc7cb2f09a2e8c9344802c16ad2004b77 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 15 Mar 2024 20:24:38 +0000 Subject: [PATCH 8/9] code fixes --- Controller/BackendController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 3daa437..021ffa9 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -53,6 +53,15 @@ final class BackendController extends Controller return $view; } + /** + * Load code highlighting libraries for frontend + * + * @param ResponseAbstract $response Response + * + * @return void + * + * @since 1.0.0 + */ private function loadCodeHighlighting(ResponseAbstract $response) : void { $head = $response->data['Content']->head; From acc0652986548a75977c29ff5f1cc09e14dd29d3 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 15 Mar 2024 22:11:33 +0000 Subject: [PATCH 9/9] remove github files --- .github/user_bug_report.md | 40 --------------------------------- .github/user_feature_request.md | 21 ----------------- 2 files changed, 61 deletions(-) delete mode 100755 .github/user_bug_report.md delete mode 100755 .github/user_feature_request.md diff --git a/.github/user_bug_report.md b/.github/user_bug_report.md deleted file mode 100755 index 4b92a8e..0000000 --- a/.github/user_bug_report.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: User Bug Report -about: Create a report to help us improve -title: '' -labels: stat_backlog, type_bug -assignees: '' - ---- - -# Bug Description - -A clear and concise description of what the bug is. - -# How to Reproduce - -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -# Expected Behavior - -A clear and concise description of what you expected to happen. - -# Screenshots - -If applicable, add screenshots to help explain your problem. - -# System Information - -- System: [e.g. PC or iPhone11, ...] -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- KarakaVersion [e.g. 22] - -# Additional Information - -Add any other context about the problem here. diff --git a/.github/user_feature_request.md b/.github/user_feature_request.md deleted file mode 100755 index c9595e8..0000000 --- a/.github/user_feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: User Feature Request -about: Suggest an idea for this project -title: '' -labels: stat_backlog, type_feature -assignees: '' - ---- - -# What is the feature you request - -* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -* A clear and concise description of what you want to happen. - -# Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -# Additional Information - -Add any other context or screenshots about the feature request here.