Skip to content

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

[#39772] Moved wp-quqery-select to op-query-select

Eric Schubert4a8b5bd15837
diff --git a/app/views/work_packages/_menu_query_select.html.erb b/app/views/work_packages/_menu_query_select.html.erb
index 6b9025e4940..4f99966bdcc 100644
--- a/app/views/work_packages/_menu_query_select.html.erb
+++ b/app/views/work_packages/_menu_query_select.html.erb
@@ -1 +1 @@
-<wp-query-select data-project-identifier="<%= @project ? @project.identifier : '' %>"></wp-query-select>
+<op-query-select data-project-identifier="<%= @project ? @project.identifier : '' %>"></op-query-select>
diff --git a/frontend/src/app/core/setup/global-dynamic-components.const.ts b/frontend/src/app/core/setup/global-dynamic-components.const.ts
index 9766218e887..ebcc94bd920 100644
--- a/frontend/src/app/core/setup/global-dynamic-components.const.ts
+++ b/frontend/src/app/core/setup/global-dynamic-components.const.ts
@@ -98,9 +98,9 @@ import {
wpOverviewGraphSelector,
} from 'core-app/shared/components/work-package-graphs/overview/wp-overview-graph.component';
import {
- WorkPackageQuerySelectDropdownComponent,
- wpQuerySelectSelector,
-} from 'core-app/features/work-packages/components/wp-query-select/wp-query-select-dropdown.component';
+ opQuerySelectSelector,
+ QuerySelectComponent,
+} from 'core-app/shared/components/op-query-select/op-query-select.component';
import {
GlobalSearchTitleComponent,
globalSearchTitleSelector,
@@ -184,7 +184,6 @@ import {
ianMenuSelector,
} from 'core-app/features/in-app-notifications/center/menu/menu.component';
-
export const globalDynamicComponents:OptionalBootstrapDefinition[] = [
{ selector: appBaseSelector, cls: ApplicationBaseComponent },
{ selector: attributeHelpTextSelector, cls: AttributeHelpTextComponent },
@@ -224,7 +223,7 @@ export const globalDynamicComponents:OptionalBootstrapDefinition[] = [
{ selector: projectMenuAutocompleteSelector, cls: ProjectMenuAutocompleteComponent },
{ selector: remoteFieldUpdaterSelector, cls: RemoteFieldUpdaterComponent },
{ selector: wpOverviewGraphSelector, cls: WorkPackageOverviewGraphComponent },
- { selector: wpQuerySelectSelector, cls: WorkPackageQuerySelectDropdownComponent },
+ { selector: opQuerySelectSelector, cls: QuerySelectComponent },
{ selector: triggerActionsEntryComponentSelector, cls: TriggerActionsEntryComponent, embeddable: true },
{ selector: backlogsPageComponentSelector, cls: BacklogsPageComponent },
{ selector: attributeValueMacro, cls: AttributeValueMacroComponent, embeddable: true },
diff --git a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
index 0b49b5c00c2..3ad070d341e 100644
--- a/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
+++ b/frontend/src/app/features/work-packages/openproject-work-packages.module.ts
@@ -42,7 +42,6 @@ import { OpSettingsMenuDirective } from 'core-app/shared/components/op-context-m
import { WorkPackageStatusDropdownDirective } from 'core-app/shared/components/op-context-menu/handlers/wp-status-dropdown-menu.directive';
import { WorkPackageCreateSettingsMenuDirective } from 'core-app/shared/components/op-context-menu/handlers/wp-create-settings-menu.directive';
import { WorkPackageSingleContextMenuDirective } from 'core-app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu';
-import { WorkPackageQuerySelectDropdownComponent } from 'core-app/features/work-packages/components/wp-query-select/wp-query-select-dropdown.component';
import { WorkPackageTimelineHeaderController } from 'core-app/features/work-packages/components/wp-table/timeline/header/wp-timeline-header.directive';
import { WorkPackageTableTimelineRelations } from 'core-app/features/work-packages/components/wp-table/timeline/global-elements/wp-timeline-relations.directive';
import { WorkPackageTableTimelineStaticElements } from 'core-app/features/work-packages/components/wp-table/timeline/global-elements/wp-timeline-static-elements.directive';
@@ -85,7 +84,6 @@ import { ExternalQueryConfigurationComponent } from 'core-app/features/work-pack
import { ExternalQueryConfigurationService } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-query-configuration.service';
import { ExternalRelationQueryConfigurationComponent } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-relation-query-configuration.component';
import { ExternalRelationQueryConfigurationService } from 'core-app/features/work-packages/components/wp-table/external-configuration/external-relation-query-configuration.service';
-import { WorkPackageStaticQueriesService } from 'core-app/features/work-packages/components/wp-query-select/wp-static-queries.service';
import { WorkPackagesListInvalidQueryService } from 'core-app/features/work-packages/components/wp-list/wp-list-invalid-query.service';
import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';
import { WorkPackageWatchersService } from 'core-app/features/work-packages/components/wp-single-view-tabs/watchers-tab/wp-watchers.service';
@@ -213,7 +211,6 @@ import isNewResource from 'core-app/features/hal/helpers/is-new-resource';
// For any service that depends on the isolated query space,
// they should be provided in wp-isolated-query-space.directive instead
QueryFiltersService,
- WorkPackageStaticQueriesService,
WorkPackagesListInvalidQueryService,
// Provide a separate service for creation events of WP Inline create
@@ -298,7 +295,6 @@ import isNewResource from 'core-app/features/hal/helpers/is-new-resource';
WorkPackageStatusDropdownDirective,
WorkPackageCreateSettingsMenuDirective,
WorkPackageSingleContextMenuDirective,
- WorkPackageQuerySelectDropdownComponent,
WorkPackageViewDropdownMenuDirective,
WorkPackageGroupToggleDropdownMenuDirective,
diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
index c8a3c655a4a..d3c2ce3b7a2 100644
--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
@@ -234,7 +234,7 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
if (isPersistedResource(query)) {
this.selectedTitle = query.name;
} else {
- this.selectedTitle = this.wpStaticQueries.getStaticName(query);
+ this.selectedTitle = this.opStaticQueries.getStaticName(query);
}
this.titleEditingEnabled = this.authorisationService.can('query', 'updateImmediately');
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/work-packages-view.base.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/work-packages-view.base.ts
index 7fb5309d794..cd354c22dd0 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/work-packages-view.base.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/work-packages-view.base.ts
@@ -35,7 +35,7 @@ import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/q
import { filter, take, withLatestFrom } from 'rxjs/operators';
import { LoadingIndicatorService } from 'core-app/core/loading-indicator/loading-indicator.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { WorkPackageStaticQueriesService } from 'core-app/features/work-packages/components/wp-query-select/wp-static-queries.service';
+import { StaticQueriesService } from 'core-app/shared/components/op-query-select/op-static-queries.service';
import { WorkPackageViewHighlightingService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-highlighting.service';
import { States } from 'core-app/core/states/states.service';
import { WorkPackageViewColumnsService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service';
@@ -98,7 +98,7 @@ export abstract class WorkPackagesViewBase extends UntilDestroyedMixin implement
@InjectField() I18n!:I18nService;
- @InjectField() wpStaticQueries:WorkPackageStaticQueriesService;
+ @InjectField() opStaticQueries:StaticQueriesService;
@InjectField() wpStatesInitialization:WorkPackageStatesInitializationService;
diff --git a/frontend/src/app/features/work-packages/components/wp-query-select/wp-query-select-dropdown.component.ts b/frontend/src/app/shared/components/op-query-select/op-query-select.component.ts
similarity index 87%
rename from frontend/src/app/features/work-packages/components/wp-query-select/wp-query-select-dropdown.component.ts
rename to frontend/src/app/shared/components/op-query-select/op-query-select.component.ts
index 11af7a9478d..9f8f1a3e8a1 100644
--- a/frontend/src/app/features/work-packages/components/wp-query-select/wp-query-select-dropdown.component.ts
+++ b/frontend/src/app/shared/components/op-query-select/op-query-select.component.ts
@@ -42,16 +42,16 @@ import { MainMenuNavigationService } from 'core-app/core/main-menu/main-menu-nav
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { IOpSidemenuItem } from 'core-app/shared/components/sidemenu/sidemenu.component';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
-import { WorkPackageStaticQueriesService } from 'core-app/features/work-packages/components/wp-query-select/wp-static-queries.service';
+import { StaticQueriesService } from 'core-app/shared/components/op-query-select/op-static-queries.service';
-export const wpQuerySelectSelector = 'wp-query-select';
+export const opQuerySelectSelector = 'op-query-select';
@Component({
- selector: wpQuerySelectSelector,
+ selector: opQuerySelectSelector,
changeDetection: ChangeDetectionStrategy.OnPush,
- templateUrl: './wp-query-select.template.html',
+ templateUrl: './op-query-select.template.html',
})
-export class WorkPackageQuerySelectDropdownComponent extends UntilDestroyedMixin implements OnInit {
+export class QuerySelectComponent extends UntilDestroyedMixin implements OnInit {
public text = {
search: this.I18n.t('js.toolbar.search_query_label'),
label: this.I18n.t('js.toolbar.search_query_label'),
@@ -75,7 +75,7 @@ export class WorkPackageQuerySelectDropdownComponent extends UntilDestroyedMixin
readonly I18n:I18nService,
readonly states:States,
readonly CurrentProject:CurrentProjectService,
- readonly wpStaticQueries:WorkPackageStaticQueriesService,
+ readonly opStaticQueries:StaticQueriesService,
readonly mainMenuService:MainMenuNavigationService,
readonly cdRef:ChangeDetectorRef,
) {
@@ -102,11 +102,12 @@ export class WorkPackageQuerySelectDropdownComponent extends UntilDestroyedMixin
.pipe(
map(([searchText, categories]) => categories
.map((category) => {
- if (this.matchesText(category.title, searchText)) {
+ if (QuerySelectComponent.matchesText(category.title, searchText)) {
return category;
}
- const filteredChildren = category.children?.filter((query) => this.matchesText(query.title, searchText));
+ const filteredChildren = category.children
+ ?.filter((query) => QuerySelectComponent.matchesText(query.title, searchText));
return { title: category.title, children: filteredChildren, collapsible: true };
})
.filter((category) => category.children && category.children.length > 0)),
@@ -131,8 +132,7 @@ export class WorkPackageQuerySelectDropdownComponent extends UntilDestroyedMixin
this.initialized = true;
}
- // noinspection JSMethodCanBeStatic
- private matchesText(text:string, searchText:string):boolean {
+ private static matchesText(text:string, searchText:string):boolean {
return text.toLowerCase().includes(searchText.toLowerCase());
}
@@ -159,12 +159,12 @@ export class WorkPackageQuerySelectDropdownComponent extends UntilDestroyedMixin
cat = 'starred';
}
- categories[cat].push(WorkPackageQuerySelectDropdownComponent.toOpSideMenuItem(query));
+ categories[cat].push(QuerySelectComponent.toOpSideMenuItem(query));
});
this.$queryCategories.next([
{ title: this.text.scope_starred, children: categories.starred, collapsible: true },
- { title: this.text.scope_default, children: this.wpStaticQueries.all, collapsible: true },
+ { title: this.text.scope_default, children: this.opStaticQueries.all, collapsible: true },
{ title: this.text.scope_global, children: categories.public, collapsible: true },
{ title: this.text.scope_private, children: categories.private, collapsible: true },
]);
diff --git a/frontend/src/app/features/work-packages/components/wp-query-select/wp-query-select.template.html b/frontend/src/app/shared/components/op-query-select/op-query-select.template.html
similarity index 94%
rename from frontend/src/app/features/work-packages/components/wp-query-select/wp-query-select.template.html
rename to frontend/src/app/shared/components/op-query-select/op-query-select.template.html
index 4231da272da..c9ed5dac4cf 100644
--- a/frontend/src/app/features/work-packages/components/wp-query-select/wp-query-select.template.html
+++ b/frontend/src/app/shared/components/op-query-select/op-query-select.template.html
@@ -1,4 +1,4 @@
-<div id="querySelectDropdown" class="searchable-menu">
+<div id="querySelect" class="searchable-menu">
<div class="searchable-menu--search-container">
<div class="searchable-menu--search-bar">
<label for="query-title-filter"
diff --git a/frontend/src/app/features/work-packages/components/wp-query-select/wp-static-queries.service.ts b/frontend/src/app/shared/components/op-query-select/op-static-queries.service.ts
similarity index 99%
rename from frontend/src/app/features/work-packages/components/wp-query-select/wp-static-queries.service.ts
rename to frontend/src/app/shared/components/op-query-select/op-static-queries.service.ts
index ab2fdc3539a..c2d389ea268 100644
--- a/frontend/src/app/features/work-packages/components/wp-query-select/wp-static-queries.service.ts
+++ b/frontend/src/app/shared/components/op-query-select/op-static-queries.service.ts
@@ -36,7 +36,7 @@ import { CurrentUserService } from 'core-app/core/current-user/current-user.serv
import { IOpSidemenuItem } from 'core-app/shared/components/sidemenu/sidemenu.component';
@Injectable()
-export class WorkPackageStaticQueriesService {
+export class StaticQueriesService {
constructor(private readonly I18n:I18nService,
private readonly $state:StateService,
private readonly CurrentProject:CurrentProjectService,
diff --git a/frontend/src/app/shared/shared.module.ts b/frontend/src/app/shared/shared.module.ts
index 1d2507eb5db..38348ddff9e 100644
--- a/frontend/src/app/shared/shared.module.ts
+++ b/frontend/src/app/shared/shared.module.ts
@@ -57,6 +57,8 @@ import { EnterpriseBannerBootstrapComponent } from 'core-app/shared/components/e
import { HomescreenNewFeaturesBlockComponent } from 'core-app/features/homescreen/blocks/new-features.component';
import { TablePaginationComponent } from 'core-app/shared/components/table-pagination/table-pagination.component';
import { HookService } from 'core-app/features/plugins/hook-service';
+import { QuerySelectComponent } from 'core-app/shared/components/op-query-select/op-query-select.component';
+import { StaticQueriesService } from 'core-app/shared/components/op-query-select/op-static-queries.service';
import {
highlightColSelector,
OpHighlightColDirective,
@@ -186,8 +188,12 @@ export function bootstrapModule(injector:Injector) {
OpOptionListComponent,
OpSidemenuComponent,
],
+ providers: [
+ StaticQueriesService,
+ ],
declarations: [
OpDateTimeComponent,
+ QuerySelectComponent,
ToastsContainerComponent,
ToastComponent,
diff --git a/spec/support/pages/work_packages/work_packages_table.rb b/spec/support/pages/work_packages/work_packages_table.rb
index 7140cf48fa0..49c0e8c5256 100644
--- a/spec/support/pages/work_packages/work_packages_table.rb
+++ b/spec/support/pages/work_packages/work_packages_table.rb
@@ -123,7 +123,7 @@ module Pages
def expect_query_in_select_dropdown(name)
page.find('.title-container').click
- page.within('#querySelectDropdown') do
+ page.within('#querySelect') do
expect(page).to have_selector('.op-sidemenu--item-action', text: name)
end
end