From a9027d2897857b2c4fa01891b355d6bfc3896812 Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 25 Oct 2024 12:05:40 +0200 Subject: [PATCH] remove project_details widget --- .../grids/openproject-grids.module.ts | 18 +-- .../project-details-menu.component.ts | 82 ---------- .../project-details.component.html | 19 --- .../project-details.component.ts | 62 -------- .../spec/features/project_details_spec.rb | 149 ------------------ modules/grids/config/locales/js-en.yml | 3 - .../lib/overviews/grid_registration.rb | 12 +- .../contracts/grids/create_contract_spec.rb | 4 +- .../features/managing_overview_page_spec.rb | 20 ++- 9 files changed, 13 insertions(+), 356 deletions(-) delete mode 100644 frontend/src/app/shared/components/grids/widgets/project-details/project-details-menu.component.ts delete mode 100644 frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.html delete mode 100644 frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts delete mode 100644 modules/dashboards/spec/features/project_details_spec.rb diff --git a/frontend/src/app/shared/components/grids/openproject-grids.module.ts b/frontend/src/app/shared/components/grids/openproject-grids.module.ts index baeb77827491..b462966ea91e 100644 --- a/frontend/src/app/shared/components/grids/openproject-grids.module.ts +++ b/frontend/src/app/shared/components/grids/openproject-grids.module.ts @@ -64,12 +64,6 @@ import { WidgetHeaderComponent } from 'core-app/shared/components/grids/widgets/ import { WidgetWpOverviewComponent } from 'core-app/shared/components/grids/widgets/wp-overview/wp-overview.component'; import { WidgetCustomTextComponent } from 'core-app/shared/components/grids/widgets/custom-text/custom-text.component'; import { OpenprojectFieldsModule } from 'core-app/shared/components/fields/openproject-fields.module'; -import { - WidgetProjectDetailsComponent, -} from 'core-app/shared/components/grids/widgets/project-details/project-details.component'; -import { - WidgetProjectDetailsMenuComponent, -} from 'core-app/shared/components/grids/widgets/project-details/project-details-menu.component'; import { WidgetTimeEntriesProjectComponent, } from 'core-app/shared/components/grids/widgets/time-entries/project/time-entries-project.component'; @@ -89,7 +83,7 @@ import { } from './widgets/time-entries/current-user/configuration-modal/configuration.modal'; import { WidgetProjectFavoritesComponent, -} from "core-app/shared/components/grids/widgets/project-favorites/widget-project-favorites.component"; +} from 'core-app/shared/components/grids/widgets/project-favorites/widget-project-favorites.component'; import { IconModule } from 'core-app/shared/components/icon/icon.module'; @NgModule({ @@ -130,7 +124,6 @@ import { IconModule } from 'core-app/shared/components/icon/icon.module'; WidgetWpTableQuerySpaceComponent, WidgetWpGraphComponent, WidgetProjectDescriptionComponent, - WidgetProjectDetailsComponent, WidgetProjectStatusComponent, WidgetSubprojectsComponent, WidgetProjectFavoritesComponent, @@ -138,7 +131,6 @@ import { IconModule } from 'core-app/shared/components/icon/icon.module'; WidgetTimeEntriesProjectComponent, // Widget menus - WidgetProjectDetailsMenuComponent, WidgetMenuComponent, WidgetWpTableMenuComponent, WidgetWpGraphMenuComponent, @@ -331,14 +323,6 @@ export function registerWidgets(injector:Injector) { }, }, }, - { - identifier: 'project_details', - component: WidgetProjectDetailsComponent, - title: i18n.t('js.grid.widgets.project_details.title'), - properties: { - name: i18n.t('js.grid.widgets.project_details.title'), - }, - }, { identifier: 'project_status', component: WidgetProjectStatusComponent, diff --git a/frontend/src/app/shared/components/grids/widgets/project-details/project-details-menu.component.ts b/frontend/src/app/shared/components/grids/widgets/project-details/project-details-menu.component.ts deleted file mode 100644 index 9ee573bdaef3..000000000000 --- a/frontend/src/app/shared/components/grids/widgets/project-details/project-details-menu.component.ts +++ /dev/null @@ -1,82 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See COPYRIGHT and LICENSE files for more details. -//++ - -import { - Component, - OnInit, -} from '@angular/core'; -import { - WidgetAbstractMenuComponent, -} from 'core-app/shared/components/grids/widgets/menu/widget-abstract-menu.component'; -import { OpContextMenuItem } from 'core-app/shared/components/op-context-menu/op-context-menu.types'; -import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator'; -import { PathHelperService } from 'core-app/core/path-helper/path-helper.service'; -import { CurrentProjectService } from 'core-app/core/current-project/current-project.service'; -import { CurrentUserService } from 'core-app/core/current-user/current-user.service'; -import { take } from 'rxjs/operators'; -import { firstValueFrom } from 'rxjs'; - -@Component({ - selector: 'op-widget-project-details-menu', - templateUrl: '../menu/widget-menu.component.html', -}) -export class WidgetProjectDetailsMenuComponent extends WidgetAbstractMenuComponent implements OnInit { - @InjectField() pathHelper:PathHelperService; - - @InjectField() currentProject:CurrentProjectService; - - @InjectField() currentUser:CurrentUserService; - - private capabilityPromise:Promise; - - ngOnInit():void { - this.capabilityPromise = firstValueFrom( - this.currentUser - .hasCapabilities$('activities/read', this.currentProject.id) - .pipe(take(1)), - ); - } - - protected async buildItems():Promise { - const items = [ - this.removeItem, - ]; - if (await this.capabilityPromise) { - items.push(this.projectActivityLinkItem); - } - return items; - } - - protected get projectActivityLinkItem():OpContextMenuItem { - const projectActivityPath = this.pathHelper.projectActivityPath(this.currentProject.identifier as string); - return { - linkText: this.i18n.t('js.project.details_activity'), - href: `${projectActivityPath}?event_types[]=project_attributes`, - }; - } -} diff --git a/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.html b/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.html deleted file mode 100644 index 366d584c04d9..000000000000 --- a/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -
-

- Project details have now moved to a column on the right edge of this page. -

-

- Starting with version 14.0, project attributes can be grouped in sections and enabled and disabled at a project level. Learn more -

- This widget can now be removed or replaced. It will be deleted in subsequent versions. -
diff --git a/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts b/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts deleted file mode 100644 index a0b0708b387d..000000000000 --- a/frontend/src/app/shared/components/grids/widgets/project-details/project-details.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -//-- copyright -// OpenProject is an open source project management software. -// Copyright (C) the OpenProject GmbH -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License version 3. -// -// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -// Copyright (C) 2006-2013 Jean-Philippe Lang -// Copyright (C) 2010-2013 the ChiliProject Team -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// See COPYRIGHT and LICENSE files for more details. -//++ - -import { - ChangeDetectionStrategy, - ChangeDetectorRef, - Component, - ElementRef, - Injector, - ViewChild, -} from '@angular/core'; -import { AbstractWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-widget.component'; -import { I18nService } from 'core-app/core/i18n/i18n.service'; -import { CurrentProjectService } from 'core-app/core/current-project/current-project.service'; -import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service'; - -@Component({ - templateUrl: './project-details.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class WidgetProjectDetailsComponent extends AbstractWidgetComponent { - @ViewChild('contentContainer', { static: true }) readonly contentContainer:ElementRef; - - constructor( - protected readonly i18n:I18nService, - protected readonly injector:Injector, - protected readonly apiV3Service:ApiV3Service, - protected readonly currentProject:CurrentProjectService, - protected readonly cdRef:ChangeDetectorRef, - ) { - super(i18n, injector); - } - - public get isEditable():boolean { - return false; - } -} diff --git a/modules/dashboards/spec/features/project_details_spec.rb b/modules/dashboards/spec/features/project_details_spec.rb deleted file mode 100644 index 6b1b4fc3a99c..000000000000 --- a/modules/dashboards/spec/features/project_details_spec.rb +++ /dev/null @@ -1,149 +0,0 @@ -#-- copyright -# OpenProject is an open source project management software. -# Copyright (C) the OpenProject GmbH -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License version 3. -# -# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: -# Copyright (C) 2006-2013 Jean-Philippe Lang -# Copyright (C) 2010-2013 the ChiliProject Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# See COPYRIGHT and LICENSE files for more details. -#++ - -require "spec_helper" - -require_relative "../support/pages/dashboard" - -RSpec.describe "Project details widget on dashboard", :js do - let(:system_version) { create(:version, sharing: "system") } - - let!(:project) do - create(:project, members: { other_user => role }) - end - - let(:permissions) do - %i[view_dashboards - manage_dashboards] - end - - let(:editing_permissions) do - %i[view_dashboards - manage_dashboards - edit_project] - end - - let(:role) do - create(:project_role, permissions:) - end - - let(:read_only_user) do - create(:user, member_with_roles: { project => role }) - end - let(:editing_user) do - create(:user, - member_with_permissions: { project => editing_permissions }, - firstname: "Cool", - lastname: "Guy") - end - let(:other_user) do - create(:user, - firstname: "Other", - lastname: "User") - end - - let(:dashboard_page) do - Pages::Dashboard.new(project) - end - - def add_project_details_widget - dashboard_page.visit! - dashboard_page.add_widget(1, 1, :within, "Project details") - - dashboard_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update") - end - - before do - login_as current_user - add_project_details_widget - end - - context "without editing permissions" do - let(:current_user) { read_only_user } - - it "displays the deprecated message" do - # As the user lacks the manage_public_queries and save_queries permission, no other widget is present - details_widget = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)") - - within(details_widget.area) do - expect(page) - .to have_content("Project details have now moved to a column on the right edge of this page.") - expect(page).to have_content( - <<~TEXT.strip - Starting with version 14.0, project attributes can be grouped \ - in sections and enabled and disabled at a project level. - TEXT - ) - expect(page).to have_content( - <<~TEXT.strip - This widget can now be removed or replaced. \ - It will be deleted in subsequent versions. - TEXT - ) - end - end - end - - context "with editing permissions" do - let(:current_user) { editing_user } - - it "displays the deprecated message" do - # As the user lacks the manage_public_queries and save_queries permission, no other widget is present - details_widget = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)") - - within(details_widget.area) do - expect(page) - .to have_content("Project details have now moved to a column on the right edge of this page.") - expect(page).to have_content( - <<~TEXT.strip - Starting with version 14.0, project attributes can be grouped \ - in sections and enabled and disabled at a project level. - TEXT - ) - expect(page).to have_content( - <<~TEXT.strip - This widget can now be removed or replaced. \ - It will be deleted in subsequent versions. - TEXT - ) - end - end - end - - context "when project has Activity module enabled" do - let(:current_user) { read_only_user } - - it 'has a "Project activity" entry in More menu linking to the project activity page' do - details_widget = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)") - - details_widget.click_menu_item("Project details activity") - expect(page).to have_current_path(project_activity_index_path(project), ignore_query: true) - expect(page).to have_checked_field(id: "event_types_project_attributes") - end - end -end diff --git a/modules/grids/config/locales/js-en.yml b/modules/grids/config/locales/js-en.yml index ffa20d4f2683..dfa0eecf0af4 100644 --- a/modules/grids/config/locales/js-en.yml +++ b/modules/grids/config/locales/js-en.yml @@ -27,9 +27,6 @@ en: project_description: title: 'Project description' no_results: "No description has been written yet. One can be provided in the 'Project settings'." - project_details: - title: 'Project details' - no_results: 'No custom fields have been defined for projects.' project_status: title: 'Project status' not_started: 'Not started' diff --git a/modules/overviews/lib/overviews/grid_registration.rb b/modules/overviews/lib/overviews/grid_registration.rb index 04de8323cf25..cf811904030f 100644 --- a/modules/overviews/lib/overviews/grid_registration.rb +++ b/modules/overviews/lib/overviews/grid_registration.rb @@ -15,7 +15,7 @@ class GridRegistration < ::Grids::Configuration::InProjectBaseRegistration { identifier: "project_description", start_row: 1, - end_row: 2, + end_row: 3, start_column: 1, end_column: 2, options: { @@ -32,16 +32,6 @@ class GridRegistration < ::Grids::Configuration::InProjectBaseRegistration name: I18n.t("js.grid.widgets.project_status.title") } }, - { - identifier: "project_details", - start_row: 2, - end_row: 3, - start_column: 1, - end_column: 2, - options: { - name: I18n.t("js.grid.widgets.project_details.title") - } - }, { identifier: "work_packages_overview", start_row: 3, diff --git a/modules/overviews/spec/contracts/grids/create_contract_spec.rb b/modules/overviews/spec/contracts/grids/create_contract_spec.rb index 225ec352a45b..7e7c95b93db2 100644 --- a/modules/overviews/spec/contracts/grids/create_contract_spec.rb +++ b/modules/overviews/spec/contracts/grids/create_contract_spec.rb @@ -130,13 +130,13 @@ context "(widget added)" do before do grid.row_count = 4 - grid.widgets.build(identifier: "project_details", + grid.widgets.build(identifier: "project_description", start_row: 3, end_row: 4, start_column: 1, end_column: 3, options: { - name: I18n.t("js.grid.widgets.work_packages_overview.title") + name: I18n.t("js.grid.widgets.project_description.title") }) end diff --git a/modules/overviews/spec/features/managing_overview_page_spec.rb b/modules/overviews/spec/features/managing_overview_page_spec.rb index 001ff0292d7f..b05955516e07 100644 --- a/modules/overviews/spec/features/managing_overview_page_spec.rb +++ b/modules/overviews/spec/features/managing_overview_page_spec.rb @@ -73,18 +73,15 @@ it "renders the default view, allows altering and saving" do description_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(1)") status_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(2)") - details_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(3)") - overview_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(4)") - members_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(5)") + overview_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(3)") + members_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(4)") description_area.expect_to_exist status_area.expect_to_exist - details_area.expect_to_exist overview_area.expect_to_exist members_area.expect_to_exist - description_area.expect_to_span(1, 1, 2, 2) + description_area.expect_to_span(1, 1, 3, 2) status_area.expect_to_span(1, 2, 2, 3) - details_area.expect_to_span(2, 1, 3, 2) overview_area.expect_to_span(3, 1, 4, 3) members_area.expect_to_span(2, 2, 3, 3) @@ -107,7 +104,7 @@ overview_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update") - table_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(6)") + table_area = Components::Grids::GridArea.new(".grid--area.-widgeted:nth-of-type(5)") table_area.expect_to_span(1, 1, 2, 2) # A useless resizing shows no message and does not alter the size @@ -138,11 +135,12 @@ overview_page.visit! ## Because of the added column and the resizing the other widgets have moved down + # For unknown, undesired reasons, the project description no longer spans two rows. + # This happens when resizing the table area. description_area.expect_to_span(2, 1, 3, 2) - status_area.expect_to_span(2, 2, 4, 3) - details_area.expect_to_span(3, 1, 4, 2) - overview_area.expect_to_span(5, 1, 6, 3) - members_area.expect_to_span(4, 2, 5, 3) + status_area.expect_to_span(2, 2, 3, 3) + overview_area.expect_to_span(4, 1, 5, 3) + members_area.expect_to_span(3, 2, 4, 3) table_area.expect_to_span(1, 1, 2, 3) end end