From a62af0421e65a9e4190a07940fbbf6bb96cca1cb Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 19 Oct 2023 17:54:59 +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 827c86d6c9af3cbe0af6ef899d5945375ee68f48 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 8 Dec 2023 21:52:33 +0000 Subject: [PATCH 2/9] bug fixes --- ICAL.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 dd492073fce8569d5676c45ac4495cc898f87462 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Jan 2024 23:34:18 +0000 Subject: [PATCH 3/9] update --- Models/PermissionCategory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index 2b3ba1b..f0fd57e 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -17,7 +17,7 @@ namespace Modules\Search\Models; use phpOMS\Stdlib\Base\Enum; /** - * Permision state enum. + * Permission category enum. * * @package Modules\Search\Models * @license OMS License 2.0 From 9bf6b2487d8c9fe558ac47915146ba239c61b0df Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 26 Jan 2024 22:54:00 +0000 Subject: [PATCH 4/9] auto fixes + some impl. --- CONTRIBUTING.md | 164 +++++++++++++++++++++---- LICENSE.txt | 2 +- tests/Autoloader.php | 4 +- tests/Bootstrap.php | 71 ++++++----- tests/Controller/ApiControllerTest.php | 3 +- 5 files changed, 184 insertions(+), 60 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f4653b..5d54d77 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/tests/Autoloader.php b/tests/Autoloader.php index ac516a8..1ff89a2 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..3e10b9e 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/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 74e7217..412a82f 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -29,7 +29,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; /** @@ -102,7 +101,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertGreaterThan(0, \count($searchRoutes)); $response = new HttpResponse(); - $request = new HttpRequest(new HttpUri('')); + $request = new HttpRequest(); $request->header->account = 1; $request->setData('search', ':help introduction'); From f901a40b1e7537fba0fb65eae9c29b8e78d53f83 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 4 Feb 2024 20:34:12 +0000 Subject: [PATCH 5/9] update --- Admin/Routes/Web/Api.php | 2 +- Admin/Routes/Web/Backend.php | 19 ++++- Controller/ApiController.php | 21 +---- Controller/BackendController.php | 77 +++++++++++++++++++ Controller/Controller.php | 36 +++++++++ Theme/Backend/Lang/de.lang.php | 17 ++++ Theme/Backend/Lang/en.lang.php | 17 ++++ Theme/Backend/search-result.tpl.php | 115 ++++++++++++++++++++++++++++ 8 files changed, 285 insertions(+), 19 deletions(-) create mode 100644 Controller/BackendController.php create mode 100644 Theme/Backend/Lang/de.lang.php create mode 100644 Theme/Backend/Lang/en.lang.php create mode 100644 Theme/Backend/search-result.tpl.php diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index 1fd9922..b55d5c9 100755 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -20,7 +20,7 @@ use phpOMS\Router\RouteVerb; return [ '^.*/search(\?.*|$)' => [ [ - 'dest' => '\Modules\Search\Controller\ApiController:routeSearch', + 'dest' => '\Modules\Search\Controller\ApiController:search', 'verb' => RouteVerb::ANY, 'permission' => [ 'module' => ApiController::NAME, diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index 9c9cc0d..c128272 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -12,4 +12,21 @@ */ declare(strict_types=1); -return []; +use Modules\Search\Controller\BackendController; +use Modules\Search\Models\PermissionCategory; +use phpOMS\Account\PermissionType; +use phpOMS\Router\RouteVerb; + +return [ + '^.*/search(\?.*|$)' => [ + [ + 'dest' => '\Modules\Search\Controller\BackendController:search', + 'verb' => RouteVerb::ANY, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::SEARCH, + ], + ], + ], +]; diff --git a/Controller/ApiController.php b/Controller/ApiController.php index aa97d35..e19067c 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -29,8 +29,6 @@ use phpOMS\Router\WebRouter; */ final class ApiController extends Controller { - private $router = null; - /** * {@inheritdoc} */ @@ -49,28 +47,17 @@ final class ApiController extends Controller * @param ResponseAbstract $response Response * @param array $data Generic data * - * @return void + * @return array * * @api * * @since 1.0.0 */ - public function routeSearch(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : void + public function search(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : void { - $this->app->dispatcher->dispatch( - $this->router->route( - $request->getDataString('search') ?? '', - $request->getDataString('CSRF'), - $request->getRouteVerb(), - $this->app->appId, - $this->app->unitId, - $this->app->accountManager->get($request->header->account) - ), - $request, - $response - ); + $data = $this->routeSearch($request, $response, $data); - if (empty($response->data)) { + if (empty($data)) { $this->fillJsonRawResponse($request, $response, []); } } diff --git a/Controller/BackendController.php b/Controller/BackendController.php new file mode 100644 index 0000000..c04a209 --- /dev/null +++ b/Controller/BackendController.php @@ -0,0 +1,77 @@ +router = new WebRouter(); + $this->router->importFromFile(__DIR__ . '/../Admin/SearchCommands.php'); + } + + /** + * Backend method to handle basic search request + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return array + * + * @api + * + * @since 1.0.0 + */ + public function search(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Search/Theme/Backend/search-result'); + + $internalRequest = clone $request; + $internalResponse = clone $response; + + $internalResponse->header = clone $request->header; + + $internalResponse->data = []; + + $temp = empty($request->getDataString('search')) ? [] : $this->routeSearch($internalRequest, $internalResponse, $data); + $view->data = empty($temp) ? [] : \reset($temp); + + return $view; + } +} diff --git a/Controller/Controller.php b/Controller/Controller.php index e76a02b..16f2da6 100755 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -15,7 +15,10 @@ declare(strict_types=1); namespace Modules\Search\Controller; use Modules\Search\Models\Search; +use phpOMS\Message\Http\HttpRequest; +use phpOMS\Message\ResponseAbstract; use phpOMS\Module\ModuleAbstract; +use phpOMS\Router\RouterInterface; /** * Search class. @@ -75,4 +78,37 @@ class Controller extends ModuleAbstract * @since 1.0.0 */ public static array $dependencies = []; + + protected ?RouterInterface $router = null; + + /** + * Api method to handle basic search request + * + * @param HttpRequest $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return array + * + * @api + * + * @since 1.0.0 + */ + public function routeSearch(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : array + { + $this->app->dispatcher->dispatch( + $this->router->route( + $request->getDataString('search') ?? '', + $request->getDataString('CSRF'), + $request->getRouteVerb(), + $this->app->appId, + $this->app->unitId, + $this->app->accountManager->get($request->header->account) + ), + $request, + $response + ); + + return $response->data; + } } diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php new file mode 100644 index 0000000..fbafd47 --- /dev/null +++ b/Theme/Backend/Lang/de.lang.php @@ -0,0 +1,17 @@ + [ + 'NoResults' => 'Keine Surchergebnisse', +]]; \ No newline at end of file diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php new file mode 100644 index 0000000..4e9c000 --- /dev/null +++ b/Theme/Backend/Lang/en.lang.php @@ -0,0 +1,17 @@ + [ + 'NoResults' => 'No search results', +]]; \ No newline at end of file diff --git a/Theme/Backend/search-result.tpl.php b/Theme/Backend/search-result.tpl.php new file mode 100644 index 0000000..d12c219 --- /dev/null +++ b/Theme/Backend/search-result.tpl.php @@ -0,0 +1,115 @@ + +data as $controller) : + if (empty($controller)) { + continue; + } + + $first = \reset($controller); +?> +
+
+

+
+
+ + +
+
+
+ + +
printHtml(\trim($data['title'])); ?>
+
+ + +
printHtml(\trim($data['title'])); ?>
+
+ + +
+ + +
+ + + icon) ? '' : ''; ?> + printHtml($tag->getL11n()); ?> + + +
+ +
+
+
+ + +
+ +
+
+ +
+
+ +
printHtml($data['email']); ?> +
printHtml($data['phone']); ?> +
printHtml($data['city']); ?> +
+
+
+
+
+ +
+ + + + +
+
+
+
getHtml('NoResults'); ?>
+
+
+
+ \ No newline at end of file From 1a54a8642d545b1f8fefa125e2f0ceda877ecab1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 28 Feb 2024 05:09:12 +0000 Subject: [PATCH 6/9] bump --- .github/dev_bug_report.md | 35 ----- .github/dev_feature_request.md | 18 --- CODE_OF_CONDUCT.md | 46 ------- CONTRIBUTING.md | 196 ---------------------------- Theme/Backend/search-result.tpl.php | 34 ++--- 5 files changed, 14 insertions(+), 315 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 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/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 5d54d77..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/Theme/Backend/search-result.tpl.php b/Theme/Backend/search-result.tpl.php index d12c219..0498a6d 100644 --- a/Theme/Backend/search-result.tpl.php +++ b/Theme/Backend/search-result.tpl.php @@ -31,6 +31,10 @@ foreach ($this->data as $controller) : +
+
+
+ data as $controller) : $summary = $data['summary']; $summary = \trim($summary, " #\n"); ?> - +
+ + printHtml(\trim($data['title'])); ?> + + -
icon) ? '' : ''; ?> printHtml($tag->getL11n()); ?> - -
+ - + +
+
-
Date: Sun, 10 Mar 2024 02:24:57 +0000 Subject: [PATCH 7/9] bump --- Theme/Backend/search-result.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Theme/Backend/search-result.tpl.php b/Theme/Backend/search-result.tpl.php index 0498a6d..a4186a3 100644 --- a/Theme/Backend/search-result.tpl.php +++ b/Theme/Backend/search-result.tpl.php @@ -54,7 +54,7 @@ foreach ($this->data as $controller) : - icon) ? '' : ''; ?> + icon) ? '' : '' . $this->printHtml($tag->icon) . ''; ?> printHtml($tag->getL11n()); ?> From f4c2ed4a9c430c87e6ca31a246ca4376c15dbd4f Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 15 Mar 2024 20:24:39 +0000 Subject: [PATCH 8/9] code fixes --- Controller/ApiController.php | 2 +- Controller/BackendController.php | 10 ++++------ Controller/Controller.php | 4 ++++ Theme/Backend/Lang/de.lang.php | 4 ++-- Theme/Backend/Lang/en.lang.php | 4 ++-- Theme/Backend/search-result.tpl.php | 1 - 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index e19067c..e4cbc4f 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -47,7 +47,7 @@ final class ApiController extends Controller * @param ResponseAbstract $response Response * @param array $data Generic data * - * @return array + * @return void * * @api * diff --git a/Controller/BackendController.php b/Controller/BackendController.php index c04a209..fabddb7 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -16,12 +16,10 @@ namespace Modules\Search\Controller; use phpOMS\Application\ApplicationAbstract; use phpOMS\Contract\RenderableInterface; -use phpOMS\Message\Http\HttpRequest; -use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; -use phpOMS\Views\View; use phpOMS\Router\WebRouter; +use phpOMS\Views\View; /** * Backend controller @@ -51,18 +49,18 @@ final class BackendController extends Controller * @param ResponseAbstract $response Response * @param array $data Generic data * - * @return array + * @return RenderableInterface * * @api * * @since 1.0.0 */ - public function search(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface + public function search(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Search/Theme/Backend/search-result'); - $internalRequest = clone $request; + $internalRequest = clone $request; $internalResponse = clone $response; $internalResponse->header = clone $request->header; diff --git a/Controller/Controller.php b/Controller/Controller.php index 16f2da6..1c7581e 100755 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -96,6 +96,10 @@ class Controller extends ModuleAbstract */ public function routeSearch(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : array { + if ($this->router === null) { + return []; + } + $this->app->dispatcher->dispatch( $this->router->route( $request->getDataString('search') ?? '', diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index fbafd47..63aa0b6 100644 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -13,5 +13,5 @@ declare(strict_types=1); return ['Search' => [ - 'NoResults' => 'Keine Surchergebnisse', -]]; \ No newline at end of file + 'NoResults' => 'Keine Surchergebnisse', +]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 4e9c000..ac13327 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -13,5 +13,5 @@ declare(strict_types=1); return ['Search' => [ - 'NoResults' => 'No search results', -]]; \ No newline at end of file + 'NoResults' => 'No search results', +]]; diff --git a/Theme/Backend/search-result.tpl.php b/Theme/Backend/search-result.tpl.php index a4186a3..abafdc2 100644 --- a/Theme/Backend/search-result.tpl.php +++ b/Theme/Backend/search-result.tpl.php @@ -13,7 +13,6 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; -use phpOMS\Utils\Parser\Markdown\Markdown; $isEmpty = true; ?> From f744f9f9caa82f589506a9064d1333a3d94ab146 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.