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
Replace the Project details widget with deprecation message
Dombi Attila0ea5c3f36848
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.htmlindex 5e35609e703..a37c74d9be5 100644--- 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@@ -9,22 +9,11 @@</widget-header><div class="grid--widget-content">- <edit-form *ngIf="(project$ | async) as project"- [resource]="project">- <div class="attributes-map">- <ng-container *ngFor="let cf of customFields">- <div class="attributes-map--key" [attr.title]="cf.label">- {{ cf.label }}- <attribute-help-text [attribute]="cf.key"- [attributeScope]="'Project'"></attribute-help-text>- </div>- <div class="attributes-map--value">- <op-editable-attribute-field- [resource]="project"- [fieldName]="cf.key"- ></op-editable-attribute-field>- </div>- </ng-container>- </div>- </edit-form>+ <p>+ <strong>Project details have now moved to a column on the right edge of this page.</strong>+ </p>+ <p>+ Starting with version 13.4, project attributes can be grouped in sections and enabled and disabled at a project level. <a href="#">Learn more</a>+ </p>+ <i>This widget can now be removed or replaced. It will be deleted in subsequent versions.</i></div>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.tsindex e6caae2e84c..ba1022c6eb0 100644--- 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@@ -32,81 +32,31 @@ import {Component,ElementRef,Injector,- OnInit,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 { SchemaResource } from 'core-app/features/hal/resources/schema-resource';-import { Observable } from 'rxjs';-import { ProjectResource } from 'core-app/features/hal/resources/project-resource';-import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';-import { SchemaAttributeObject } from 'core-app/features/hal/resources/schema-attribute-object';@Component({templateUrl: './project-details.component.html',changeDetection: ChangeDetectionStrategy.OnPush,- providers: [- HalResourceEditingService,- ],})-export class WidgetProjectDetailsComponent extends AbstractWidgetComponent implements OnInit {+export class WidgetProjectDetailsComponent extends AbstractWidgetComponent {@ViewChild('contentContainer', { static: true }) readonly contentContainer:ElementRef;- public customFields:{ key:string, label:string }[] = [];-- public project$:Observable<ProjectResource>;-- constructor(protected readonly i18n:I18nService,+ constructor(+ protected readonly i18n:I18nService,protected readonly injector:Injector,protected readonly apiV3Service:ApiV3Service,protected readonly currentProject:CurrentProjectService,- protected readonly cdRef:ChangeDetectorRef) {+ protected readonly cdRef:ChangeDetectorRef,+ ) {super(i18n, injector);}- ngOnInit():void {- this.loadAndRender();- if (this.currentProject.id) {- this.project$ = this- .apiV3Service- .projects- .id(this.currentProject.id)- .requireAndStream();- }- }-public get isEditable():boolean {return false;}-- private loadAndRender():void {- void Promise.all([- this.loadProjectSchema(),- ])- .then(([schema]) => {- this.setCustomFields(schema);- });- }-- private loadProjectSchema():Promise<SchemaResource> {- return this- .apiV3Service- .projects- .schema- .get()- .toPromise();- }-- private setCustomFields(schema:SchemaResource) {- Object.entries(schema).forEach(([key, keySchema]) => {- if (/customField\d+/.exec(key)) {- this.customFields.push({ key, label: (keySchema as SchemaAttributeObject).name });- }- });-- this.cdRef.detectChanges();- }}diff --git a/modules/dashboards/spec/features/project_details_spec.rb b/modules/dashboards/spec/features/project_details_spec.rbindex 5854a2a3a9d..3957ba2c4cb 100644--- a/modules/dashboards/spec/features/project_details_spec.rb+++ b/modules/dashboards/spec/features/project_details_spec.rb@@ -31,30 +31,10 @@ require 'spec_helper'require_relative '../support/pages/dashboard'RSpec.describe 'Project details widget on dashboard', :js do- let!(:version_cf) { create(:version_project_custom_field) }- let!(:bool_cf) { create(:boolean_project_custom_field) }- let!(:user_cf) { create(:user_project_custom_field) }- let!(:int_cf) { create(:integer_project_custom_field) }- let!(:float_cf) { create(:float_project_custom_field) }- let!(:text_cf) { create(:text_project_custom_field) }- let!(:string_cf) { create(:string_project_custom_field) }- let!(:date_cf) { create(:date_project_custom_field) }-let(:system_version) { create(:version, sharing: 'system') }let!(:project) do- create(:project, members: { other_user => role }).tap do |p|- p.send(int_cf.attribute_setter, 5)- p.send(bool_cf.attribute_setter, true)- p.send(version_cf.attribute_setter, system_version)- p.send(float_cf.attribute_setter, 4.5)- p.send(text_cf.attribute_setter, 'Some **long** text')- p.send(string_cf.attribute_setter, 'Some small text')- p.send(date_cf.attribute_setter, Date.current)- p.send(user_cf.attribute_setter, other_user)-- p.save!(validate: false)- end+ create(:project, members: { other_user => role })endlet(:permissions) do@@ -98,22 +78,6 @@ RSpec.describe 'Project details widget on dashboard', :js dodashboard_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')end- def change_cf_value(cf, old_value, new_value)- # Open description field- cf.activate!- sleep(0.1)-- # Change the value- cf.expect_value(old_value)- cf.set_value new_value- cf.save! unless cf.field_type === 'create-autocompleter'-- # The edit field is toggled and the value saved.- expect(page).to have_content(new_value)- expect(page).to have_selector(cf.selector)- expect(page).to have_no_selector(cf.input_selector)- end-before dologin_as current_useradd_project_details_widget@@ -122,33 +86,25 @@ RSpec.describe 'Project details widget on dashboard', :js docontext 'without editing permissions' dolet(:current_user) { read_only_user }- it 'can add the widget, but not edit the custom fields' do+ it 'displays the deprecated message' do# As the user lacks the manage_public_queries and save_queries permission, no other widget is presentdetails_widget = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')within(details_widget.area) do- # Expect values- expect(page)- .to have_content("#{int_cf.name}\n5")- expect(page)- .to have_content("#{bool_cf.name}\nyes")- expect(page)- .to have_content("#{version_cf.name}\n#{system_version.name}")- expect(page)- .to have_content("#{float_cf.name}\n4.5")- expect(page)- .to have_content("#{text_cf.name}\nSome long text")expect(page)- .to have_content("#{string_cf.name}\nSome small text")- expect(page)- .to have_content("#{date_cf.name}\n#{Date.today.strftime('%m/%d/%Y')}")- expect(page)- .to have_content("#{user_cf.name}\n#{other_user.name.split.map(&:first).join}\n#{other_user.name}")-- # The fields are not editable- field = EditField.new dashboard_page, bool_cf.attribute_name(:camel_case)- field.expect_read_only- field.activate! expect_open: false+ .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 13.4, 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+ )endendend@@ -156,18 +112,26 @@ RSpec.describe 'Project details widget on dashboard', :js docontext 'with editing permissions' dolet(:current_user) { editing_user }- it 'can edit the custom fields' do- int_field = EditField.new dashboard_page, int_cf.attribute_name(:camel_case)- change_cf_value int_field, "5", "3"-- string_field = EditField.new dashboard_page, string_cf.attribute_name(:camel_case)- change_cf_value string_field, 'Some small text', 'Some new text'-- text_field = TextEditorField.new dashboard_page, text_cf.attribute_name(:camel_case)- change_cf_value text_field, 'Some long text', 'Some very long text'+ 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)')- user_field = SelectField.new dashboard_page, user_cf.attribute_name(:camel_case)- change_cf_value user_field, other_user.name, editing_user.name+ 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 13.4, 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+ )+ endendend