Feature/5874#977
Conversation
Rework tests for readability
Hide Popular section when empty
|
| Filename | Overview |
|---|---|
| sources/Application/UI/Base/Component/QuickCreate/QuickCreateHelper.php | Adds permission-filtered popular-class discovery, result limiting, and recent-item de-duplication. |
| templates/base/components/quick-create/layout.html.twig | Renders popular classes but assigns their links an undefined class-code value. |
| datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml | Marks the abstract FunctionalCI class as a popular creation target. |
| tests/php-unit-tests/unitary-tests/sources/Application/UI/Base/Components/QuickCreate/QuickCreateHelperTest.php | Tests popular-class retrieval and removal of classes already present in recent history. |
| tests/php-unit-tests/composer.lock | Refreshes the PHPUnit dependency tree consistently with the repository PHP requirement. |
Reviews (1): Last reviewed commit: "N° 5874 - Quick create: improvement for ..." | Re-trigger Greptile
| </div> | ||
| <div class="ibo-quick-create--compartment-content ibo-quick-create--popular-classes--content" data-role="ibo-quick-create--compartment-content"> | ||
| {% for aClass in oUIBlock.GetPopularClasses() %} | ||
| <a href="{{ aClass.target_url }}" class="ibo-quick-create--compartment-element" data-role="ibo-quick-create--compartment-element" data-class-code="{{ aQuery.class }}"> |
There was a problem hiding this comment.
The popular loop defines aClass, but this attribute reads aQuery.class. Each new popular link therefore receives an undefined or empty data-class-code, so code that identifies the selected class from this attribute receives the wrong value.
| <a href="{{ aClass.target_url }}" class="ibo-quick-create--compartment-element" data-role="ibo-quick-create--compartment-element" data-class-code="{{ aQuery.class }}"> | |
| <a href="{{ aClass.target_url }}" class="ibo-quick-create--compartment-element" data-role="ibo-quick-create--compartment-element" data-class-code="{{ aClass.class }}"> |
There was a problem hiding this comment.
Pull request overview
Improves Quick Create by adding commonly used object classes as default suggestions.
Changes:
- Adds rights-aware “Most Popular” class suggestions and configuration.
- Marks FunctionalCI and UserRequest as popular.
- Adds UI rendering, translations, and unit tests.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
tests/php-unit-tests/unitary-tests/sources/Application/UI/Base/Components/QuickCreate/QuickCreateHelperTest.php |
Tests popular/recent filtering. |
tests/php-unit-tests/composer.lock |
Upgrades PHPUnit dependencies. |
templates/base/components/quick-create/layout.html.twig |
Renders popular classes. |
sources/Application/UI/Base/Component/QuickCreate/QuickCreateHelper.php |
Builds popular class entries. |
sources/Application/UI/Base/Component/QuickCreate/QuickCreate.php |
Exposes popular classes and limits. |
dictionaries/ui/components/quick-create/zh_cn.dictionary.itop.quick-create.php |
Adds Chinese label. |
dictionaries/ui/components/quick-create/tr.dictionary.itop.quick-create.php |
Adds Turkish fallback label. |
dictionaries/ui/components/quick-create/sk.dictionary.itop.quick-create.php |
Adds Slovak fallback label. |
dictionaries/ui/components/quick-create/ru.dictionary.itop.quick-create.php |
Adds Russian label. |
dictionaries/ui/components/quick-create/pt_br.dictionary.itop.quick-create.php |
Adds Portuguese label. |
dictionaries/ui/components/quick-create/pl.dictionary.itop.quick-create.php |
Adds Polish label. |
dictionaries/ui/components/quick-create/nl.dictionary.itop.quick-create.php |
Adds Dutch label. |
dictionaries/ui/components/quick-create/ja.dictionary.itop.quick-create.php |
Adds Japanese fallback label. |
dictionaries/ui/components/quick-create/it.dictionary.itop.quick-create.php |
Adds Italian label. |
dictionaries/ui/components/quick-create/hu.dictionary.itop.quick-create.php |
Adds Hungarian label. |
dictionaries/ui/components/quick-create/fr.dictionary.itop.quick-create.php |
Adds French label. |
dictionaries/ui/components/quick-create/es_cr.dictionary.itop.quick-create.php |
Adds Spanish label. |
dictionaries/ui/components/quick-create/en.dictionary.itop.quick-create.php |
Adds English label. |
dictionaries/ui/components/quick-create/en_gb.dictionary.itop.quick-create.php |
Adds British English label. |
dictionaries/ui/components/quick-create/de.dictionary.itop.quick-create.php |
Adds German label. |
dictionaries/ui/components/quick-create/da.dictionary.itop.quick-create.php |
Adds Danish fallback label. |
dictionaries/ui/components/quick-create/cs.dictionary.itop.quick-create.php |
Adds Czech label. |
datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml |
Marks UserRequest as popular. |
datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml |
Marks ITIL UserRequest as popular. |
datamodels/2.x/itop-config-mgmt/datamodel.itop-config-mgmt.xml |
Marks FunctionalCI as popular. |
core/config.class.inc.php |
Configures popular and history limits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Prevent classes in both Popular and Recent to appear twice | ||
| for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) | ||
| { | ||
| if (($key = array_search($aHistoryEntries[$iIdx]['class'], $aPopularClassesNames)) !== false) { | ||
| unset($aPopularClassesNames[$key]); | ||
| } | ||
| } |
| $aPopularClasses = QuickCreateHelper::GetPopularClasses(); | ||
| $this->AssertPopularClassesMatches(['FunctionalCI'], $aPopularClasses, ""); | ||
| } | ||
| private function GivenRecentClasses(array $aGivenClasses) |
| </div> | ||
| <div class="ibo-quick-create--compartment-title" data-role="ibo-quick-create--compartment-title"> | ||
| {# History section #} | ||
| <div class="ibo-quick-create--compartment-title ibo-quick-create--history-classes--title" data-role="ibo-quick-create--compartment-title"> |
| </div> | ||
| {# Popular classes section #} | ||
| {% if oUIBlock.GetPopularClasses()|length > 0 %} | ||
| <div class="ibo-quick-create--compartment-title ibo-quick-create--popular-classes--title" data-role="ibo-quick-create--compartment-title"> |
| //die(var_dump($aPopularClassesNames)); | ||
| static::Truncate($aPopularClassesNames, 'quick_create.max_popular_results'); |
| } | ||
|
|
||
| /** | ||
| * @see $aMaxPopularClasses |
Base information
Objective (enhancement)
User videos of the SaaS platform showed that the initial use of the "Quick create" button was not intuitive.
When starting out, no default value is suggested, and it is unclear what needs to be typed...
Opening the drop-down menu is extremely difficult because the cursor remains in text-insertion mode, making it hard to target the small "down" arrow.
Proposed solution (bug and enhancement)
Rename the "Recent" section to "Most Popular" (consistent with the "Most Relevant" search criteria).
Change the cursor that appears over the small arrow (which opens the drop-down menu) to a pointer or a finger—something indicating a click—rather than the text-input cursor.
Ensure the classes offered to a new user are relevant: Not the first classes in alphabetical order, but the most popular ones (classes with the "popular" category in the data model).
Checklist before requesting a review