OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[58704] Quick wins for top bar search (#18800)
Behrokh Satarnejad5b8b102db2e8
diff --git a/frontend/src/app/core/global_search/input/global-search-input-mobile.component.sass b/frontend/src/app/core/global_search/input/global-search-input-mobile.component.sassindex 70825c6fbc5..c73a9265ee6 100644--- a/frontend/src/app/core/global_search/input/global-search-input-mobile.component.sass+++ b/frontend/src/app/core/global_search/input/global-search-input-mobile.component.sass@@ -2,7 +2,7 @@$search-input-height-mobile: 36px-@media screen and (max-width: $breakpoint-sm)+@media screen and (max-width: $breakpoint-md).top-menu-search&--inputdisplay: none@@ -32,6 +32,9 @@ $search-input-height-mobile: 36px.ng-input inputheight: 36px+ .ng-dropdown-panel+ width: 100% !important+.top-menu-search--back-button@include unset-button-stylesdisplay: initialdiff --git a/frontend/src/app/core/global_search/input/global-search-input.component.html b/frontend/src/app/core/global_search/input/global-search-input.component.htmlindex f91c0674956..f58b092f78d 100644--- a/frontend/src/app/core/global_search/input/global-search-input.component.html+++ b/frontend/src/app/core/global_search/input/global-search-input.component.html@@ -17,8 +17,9 @@[accesskey]="4"class="global-search"[placeholder]="placeholder"+ [dropdownPosition]="'bottom'"[classes]="{'top-menu-search--input': true, '-markable': markable, '-expanded': expanded }"- [inputAttrs]="{ 'class': 'global-search--input', 'name': 'global-search--input' }"+ [inputAttrs]="{ 'class': 'global-search--input', 'name': 'global-search--input', autocomplete: 'off'}"[openOnEnter]="true"[labelRequired]="false"[focusDirectly]="isFocusedDirectly"@@ -44,8 +45,8 @@<ng-template op-autocompleter-option-tmp let-item let-index="index" let-search="searchTerm"><div *ngIf="!item.id; else workPackageItemTemplate"><div tabindex="-1" class="global-search--option" (click)="followItem(item)">- <div class="global-search--search-term"> {{currentValue}}</div>- <div class="global-search--project-scope" title="{{item.projectScope}}">{{item.text}} ↵</div>+ <div class="global-search--search-term">{{ currentValue }}</div>+ <div class="global-search--project-scope" title="{{ item.projectScope }}">{{ item.text }} ↵</div></div></div><ng-template #workPackageItemTemplate>@@ -56,30 +57,28 @@(click)="redirectToWp(item.id, $event)"style="line-height: 1">- <op-principal- [hideName]="true"- [principal]="item.author"- [hoverCard]="true"- class="hidden-for-mobile global-search--principal"- ></op-principal><div class="global-search--option-meta">- <span class="global-search--wp-subject">+ <div class="global-search--wp-line">+ <span [ngClass]="highlighting('type', item.type.id)">+ {{ item.type.name }}+ </span>+ <span>#{{ item.id }}</span>+ <span [ngClass]="statusHighlighting(item.status.id)">+ {{ item.status.name }}+ </span>+ <span>-</span><span- [ngClass]="highlighting('type', item.type.id)"- [textContent]="item.type.name"- ></span>- {{item.subject}}- </span>-- <div class="global-search--wp-content">- <span [textContent]="item.project.name" class="global-search--wp-project"></span>- #{{item.id}}- <span- [textContent]="item.status.name"- [ngClass]="statusHighlighting(item.status.id)"- class="global-search--wp-status"- ></span>+ class="global-search--wp-project"+ [attr.title]="item.project.name"+ >+ {{ item.project.name }}+ </span></div>+ <span+ class="global-search--wp-subject"+ >+ {{ item.subject }}+ </span></div></a></ng-template>diff --git a/frontend/src/app/core/global_search/input/global-search-input.component.sass b/frontend/src/app/core/global_search/input/global-search-input.component.sassindex d3bb6d02f90..9691002e003 100644--- a/frontend/src/app/core/global_search/input/global-search-input.component.sass+++ b/frontend/src/app/core/global_search/input/global-search-input.component.sass@@ -108,6 +108,9 @@ $search-input-height: 30pxmax-height: 80vhheight: auto+ .ng-dropdown-panel+ width: 500px !important+.ng-optionborder-bottom: 1px solid var(--borderColor-default)white-space: normaldiff --git a/frontend/src/app/core/global_search/input/global-search-input.component.ts b/frontend/src/app/core/global_search/input/global-search-input.component.tsindex b20564aad84..c9b778c90fd 100644--- a/frontend/src/app/core/global_search/input/global-search-input.component.ts+++ b/frontend/src/app/core/global_search/input/global-search-input.component.ts@@ -357,7 +357,7 @@ export class GlobalSearchInputComponent implements AfterViewInit, OnDestroy {return this.apiV3Service.work_packages- .filterByTypeaheadOrId(query, idOnly);+ .filterByTypeaheadOrId(query, idOnly, { pageSize: '20' });}private searchResultsToOptions(results:WorkPackageResource[], query:string) {diff --git a/frontend/src/app/core/global_search/input/global-search.component.sass b/frontend/src/app/core/global_search/input/global-search.component.sassindex 56d53a00cc5..3076812a43b 100644--- a/frontend/src/app/core/global_search/input/global-search.component.sass+++ b/frontend/src/app/core/global_search/input/global-search.component.sass@@ -33,7 +33,7 @@flex-grow: 0flex-shrink: 1border: 1px solid var(--button-default-borderColor-rest)- font-size: 13px+ font-size: var(--text-body-size-small)background: var(--button--background-color)border-radius: 2pxpadding: 0 4px@@ -45,33 +45,40 @@margin-left: -5px&--wp-content- display: grid- grid-template-columns: 50% 1fr auto- grid-template-areas: "project idlink status"+ display: flex+ flex-direction: columnfont-size: 0.8rem- padding: 5px 0 5px 0px+ padding: 5px 0++ &--wp-line+ display: flex+ flex-wrap: nowrap+ gap: var(--base-size-8)+ font-size: var(--text-body-size-small)+ white-space: nowrap+ overflow: hidden+ margin-bottom: var(--base-size-4)&--wp-project- grid-area: project+ flex-shrink: 1+ min-width: 0+ max-width: 100%@include text-shortener&--wp-id- grid-area: idlinkplace-self: rightfont-style: italiccolor: var(--fgColor-muted)- font-size: 13px+ font-size: var(--text-body-size-small)white-space: nowrap&--wp-status- grid-area: statusoverflow: hiddenfont-style: italic&--wp-subjectfont-weight: var(--base-text-weight-bold)display: inline-block- overflow: hidden- white-space: nowrap- text-overflow: ellipsis+ white-space: normal+ overflow-wrap: break-wordline-height: 1.5diff --git a/spec/features/search/search_spec.rb b/spec/features/search/search_spec.rbindex 25d6fa581fd..cfe8cb32f23 100644--- a/spec/features/search/search_spec.rb+++ b/spec/features/search/search_spec.rb@@ -34,7 +34,7 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"shared_let(:admin) { create(:admin) }shared_let(:project) { create(:project) }shared_let(:work_packages) do- (1..12).map do |n|+ (1..22).map do |n|Timecop.freeze("2016-11-21 #{n}:00".to_datetime) dosubject = "Subject No. #{n} WP"create(:work_package,@@ -108,7 +108,7 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"global_search.search(query, submit: false)# Suggestions shall show latest WPs first.- global_search.expect_work_package_option(work_packages[11])+ global_search.expect_work_package_option(work_packages[21])# and show maximum 10 suggestions.global_search.expect_work_package_option(work_packages[2])global_search.expect_no_work_package_option(work_packages[1])@@ -311,8 +311,8 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"table = Pages::EmbeddedWorkPackagesTable.new(find(".work-packages-embedded-view--container"))table.expect_work_package_count(5) # because we set the page size to this# Expect order to be from newest to oldest.- table.expect_work_package_listed(*work_packages[7..12]) # This line ensures that the table is completely rendered.- table.expect_work_package_order(*work_packages[7..12].map { |wp| wp.id.to_s }.reverse)+ table.expect_work_package_listed(*work_packages[17..22]) # This line ensures that the table is completely rendered.+ table.expect_work_package_order(*work_packages[17..22].map { |wp| wp.id.to_s }.reverse)# Expect that "Advanced filters" can refine the search:filters.expect_closed@@ -565,14 +565,14 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"describe "pagination" docontext "for project wide search" doit "works" do- expect_range 3, 12+ expect_range 13, 22click_on "Next", match: :first- expect_range 1, 2+ expect_range 11, 12expect(page).to have_current_path /\/projects\/#{project.identifier}\/search/click_on "Previous", match: :first- expect_range 3, 12+ expect_range 13, 22expect(page).to have_current_path /\/projects\/#{project.identifier}\/search/endend@@ -585,13 +585,13 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"endit "works" do- expect_range 3, 12+ expect_range 13, 22click_on "Next", match: :first- expect_range 1, 2+ expect_range 11, 12click_on "Previous", match: :first- expect_range 3, 12+ expect_range 13, 22endendend