Skip to content

[pull] dev from opf:dev #443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,11 @@ GEM
ladle (1.0.1)
open4 (~> 1.0)
language_server-protocol (3.17.0.4)
launchy (3.1.0)
launchy (3.1.1)
addressable (~> 2.8)
childprocess (~> 5.0)
logger (~> 1.6)
lefthook (1.10.10)
lefthook (1.11.0)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
letter_opener_web (3.0.0)
Expand Down Expand Up @@ -1117,7 +1117,7 @@ GEM
securerandom (0.4.1)
selenium-devtools (0.133.0)
selenium-webdriver (~> 4.2)
selenium-webdriver (4.29.0)
selenium-webdriver (4.29.1)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -1670,8 +1670,8 @@ CHECKSUMS
jwt (2.10.1) sha256=e6424ae1d813f63e761a04d6284e10e7ec531d6f701917fadcd0d9b2deaf1cc5
ladle (1.0.1) sha256=e8586964108c798d48bf57d2a65bd5602e8e5223a176b6602a0fb36c0bda90dc
language_server-protocol (3.17.0.4) sha256=c484626478664fd13482d8180947c50a8590484b1258b99b7aedb3b69df89669
launchy (3.1.0) sha256=4964ae775cd802f5a57ae5584fbdb1151a8908cb0c626341563430d614a59572
lefthook (1.10.10) sha256=344ddb720cdcc5ffaefabd47784766d931f4294babb9961f75db19d7765feea7
launchy (3.1.1) sha256=72b847b5cc961589dde2c395af0108c86ff0119f42d4648d25b5440ebb10059e
lefthook (1.11.0) sha256=fb0e39ec4a461f088f2cae78fa0294a92ff09233de57cf2ecf65202295d19f1f
letter_opener (1.10.0) sha256=2ff33f2e3b5c3c26d1959be54b395c086ca6d44826e8bf41a14ff96fdf1bdbb2
letter_opener_web (3.0.0) sha256=3f391efe0e8b9b24becfab5537dfb17a5cf5eb532038f947daab58cb4b749860
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
Expand Down Expand Up @@ -1855,7 +1855,7 @@ CHECKSUMS
secure_headers (7.1.0) sha256=6b1f9d5f9507af2948f4636452c41c09371927836396c2185438ffdf0a731124
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
selenium-devtools (0.133.0) sha256=aba5a5225ac38d235bbc6ebb4e0b8209e973ac7af4226e4304a1417573f73f64
selenium-webdriver (4.29.0) sha256=372143a8172a4f8cf67476967851b5cf6b82d86b14162028cb9b6c446407a9e7
selenium-webdriver (4.29.1) sha256=0a7fe53cc4d2c515adbb89e115c6e786c64e9b98f85939d21071c6e32883a146
semantic (1.6.1) sha256=3cdbb48f59198ebb782a3fdfb87b559e0822a311610db153bae22777a7d0c163
shoulda-context (2.0.0) sha256=7adf45342cd800f507d2a053658cb1cce2884b616b26004d39684b912ea32c34
shoulda-matchers (6.4.0) sha256=9055bb7f4bb342125fb860809798855c630e05ef5e75837b3168b8e6ee1608b0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
resource: 'work_packages',
searchKey: 'subjectOrId',
url:,
relations: true, # Activates relations fetch mode in the autocomplete
openDirectly: false,
focusDirectly: true,
dropdownPosition: 'bottom',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
required: true,
visually_hide_label: false,
autocomplete_options: {
resource: 'work_packages',
resource: "work_packages",
url:,
relations: true, # Activates relations fetch mode in the autocomplete
searchKey: "subjectOrId",
openDirectly: false,
focusDirectly: true,
dropdownPosition: 'bottom',
dropdownPosition: "bottom",
appendTo: "##{DIALOG_ID}",
data: { test_selector: TO_ID_FIELD_TEST_SELECTOR}
}
Expand Down
8 changes: 5 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -123,8 +125,8 @@
Project.project_tree(projects, &)
end

def project_nested_ul(projects, &)

Check warning on line 128 in app/helpers/application_helper.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] reported by reviewdog 🐶 Assignment Branch Condition size for project_nested_ul is too high. [<3, 24, 6> 24.92/17] Raw Output: app/helpers/application_helper.rb:128:3: C: Metrics/AbcSize: Assignment Branch Condition size for project_nested_ul is too high. [<3, 24, 6> 24.92/17]
s = ""
s = +""
if projects.any?
ancestors = []
Project.project_tree(projects) do |project, _level|
Expand Down Expand Up @@ -428,8 +430,8 @@

def initial_menu_classes(side_displayed, show_decoration)
classes = "can-hide-navigation"
classes << " nosidebar" unless side_displayed
classes << " nomenus" unless show_decoration
classes += " nosidebar" unless side_displayed
classes += " nomenus" unless show_decoration

classes
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/types/patterns/token_property_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def tokenize(custom_field_scope, prefix = nil)
end

def work_package_cfs_for(type)
all_work_package_cfs.where(type: type)
all_work_package_cfs.merge(type.custom_fields)
end

def all_work_package_cfs
Expand Down
4 changes: 3 additions & 1 deletion app/services/notifications/create_from_model_service.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -252,8 +254,8 @@
# to be looked at for mentions of users and groups:
# * only lines added
# * excluding quoted lines
def text_for_mentions

Check warning on line 257 in app/services/notifications/create_from_model_service.rb

View workflow job for this annotation

GitHub Actions / rubocop

[rubocop] reported by reviewdog 🐶 Assignment Branch Condition size for text_for_mentions is too high. [<3, 17, 3> 17.52/17] Raw Output: app/services/notifications/create_from_model_service.rb:257:3: C: Metrics/AbcSize: Assignment Branch Condition size for text_for_mentions is too high. [<3, 17, 3> 17.52/17]
potential_text = ""
potential_text = +""
potential_text << journal.notes if journal.try(:notes)

%i[description subject].each do |field|
Expand Down
104 changes: 98 additions & 6 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ import {
TemplateRef,
Type,
ViewChild,
ViewContainerRef, ViewEncapsulation,
ViewContainerRef,
ViewEncapsulation,
} from '@angular/core';
import { DropdownPosition, NgSelectComponent } from '@ng-select/ng-select';
import { BehaviorSubject, merge, NEVER, Observable, of, Subject } from 'rxjs';
import { debounceTime, distinctUntilChanged, filter, map, switchMap, tap } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged, filter, switchMap, tap } from 'rxjs/operators';
import { AddTagFn, GroupValueFn } from '@ng-select/ng-select/lib/ng-select.component';

import { HalResource } from 'core-app/features/hal/resources/hal-resource';
Expand All @@ -50,9 +51,6 @@ import { ID } from '@datorama/akita';
import { HttpClient } from '@angular/common/http';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import { CollectionResource } from 'core-app/features/hal/resources/collection-resource';
import { ApiV3FilterBuilder } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
import { addFiltersToPath } from 'core-app/core/apiv3/helpers/add-filters-to-path';
import {
IAPIFilter,
IOPAutocompleterOption,
Expand Down Expand Up @@ -236,8 +234,6 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet

@Input() public url:string;

@Input() public relations?:boolean = false;

@Input() public debounceTimeMs:number = 250;

@Output() public open = new EventEmitter<unknown>();
Expand Down Expand Up @@ -478,7 +474,7 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet
}

return this.typeahead.pipe(
filter(() => !!(this.defaultData || this.getOptionsFn)),
filter(() => !!(this.defaultData || this.url || this.getOptionsFn)),
distinctUntilChanged(),
tap(() => this.loading$.next(true)),
debounceTime(this.debounceTimeForCurrentEnvironment),
Expand All @@ -487,8 +483,8 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet
return this.getOptionsFn(queryString);
}

if (this.relations && this.url) {
return this.fetchFromUrl(queryString);
if (this.url) {
return this.opAutocompleterService.loadFromUrl(this.url, queryString, this.resource, this.filters, this.searchKey);
}

if (this.defaultData) {
Expand All @@ -504,39 +500,6 @@ export class OpAutocompleterComponent<T extends IAutocompleteItem = IAutocomplet
);
}

private fetchFromUrl(queryString:string):Observable<unknown> {
// Exit early if the query string is empty as there is no typeahead
if (queryString === null || queryString.length === 0) {
return of([]);
}

// Build filters if provided
const finalFilters = new ApiV3FilterBuilder();
this.filters?.forEach((currentFilter) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
finalFilters.add(currentFilter.name, currentFilter.operator, currentFilter.values);
});

const urlWithFilters = addFiltersToPath(this.url, finalFilters);

// Add default sort parameters if resource is work packages
if (this.resource === 'work_packages') {
urlWithFilters.searchParams.set('sortBy', '[["updatedAt","desc"]]');
}

// Add query string to the url if provided
urlWithFilters.searchParams.set('query', queryString);

const stringifiedBuiltOutUrl = urlWithFilters.toString();

return this
.halResourceService
.get(stringifiedBuiltOutUrl)
.pipe(
map((collection:CollectionResource<T>) => collection.elements),
);
}

private get debounceTimeForCurrentEnvironment():number {
return (window.OpenProject.environment === 'test') ? 0 : this.debounceTimeMs;
}
Expand Down
Loading
Loading