mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Make project status BETA widget the default one
This commit is contained in:
@@ -71,9 +71,6 @@ import { WidgetMembersComponent } from 'core-app/shared/components/grids/widgets
|
||||
import {
|
||||
WidgetProjectStatusComponent,
|
||||
} from 'core-app/shared/components/grids/widgets/project-status/project-status.component';
|
||||
import {
|
||||
WidgetProjectStatusBetaComponent,
|
||||
} from 'core-app/shared/components/grids/widgets/project-status-beta/project-status-beta.component';
|
||||
import { OpenprojectTimeEntriesModule } from 'core-app/shared/components/time_entries/openproject-time-entries.module';
|
||||
import {
|
||||
WidgetTimeEntriesCurrentUserMenuComponent,
|
||||
@@ -127,7 +124,6 @@ import { OpenprojectEnterpriseModule } from 'core-app/features/enterprise/openpr
|
||||
WidgetWpGraphComponent,
|
||||
WidgetProjectDescriptionComponent,
|
||||
WidgetProjectStatusComponent,
|
||||
WidgetProjectStatusBetaComponent,
|
||||
WidgetSubprojectsComponent,
|
||||
WidgetProjectFavoritesComponent,
|
||||
WidgetTimeEntriesCurrentUserComponent,
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
<widget-header
|
||||
[name]="widgetName"
|
||||
[editable]="isEditable">
|
||||
|
||||
<attribute-help-text slot="prepend"
|
||||
attribute="status"
|
||||
[attributeScope]="'Project'" />
|
||||
|
||||
<widget-menu slot="menu"
|
||||
[resource]="resource" />
|
||||
</widget-header>
|
||||
|
||||
<turbo-frame [id]="frameId" [src]="src" loading="lazy" />
|
||||
-41
@@ -1,41 +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, Component } from '@angular/core';
|
||||
import { AbstractTurboWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-turbo-widget.component';
|
||||
|
||||
@Component({
|
||||
selector: 'op-project-status-beta-widget',
|
||||
templateUrl: './project-status-beta.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: false,
|
||||
})
|
||||
export class WidgetProjectStatusBetaComponent extends AbstractTurboWidgetComponent {
|
||||
override frameId = 'grids-widgets-project-status';
|
||||
override name = 'project_status';
|
||||
}
|
||||
+3
-17
@@ -3,25 +3,11 @@
|
||||
[editable]="isEditable">
|
||||
|
||||
<attribute-help-text slot="prepend"
|
||||
attribute="status"
|
||||
[attributeScope]="'Project'" />
|
||||
attribute="status"
|
||||
[attributeScope]="'Project'" />
|
||||
|
||||
<widget-menu slot="menu"
|
||||
[resource]="resource" />
|
||||
</widget-header>
|
||||
|
||||
<div class="op-widget-box--body -allow-inner-overflow">
|
||||
@if ((project$ | async); as project) {
|
||||
<edit-form [resource]="project">
|
||||
<div class="project-status--container">
|
||||
<op-editable-attribute-field [resource]="project"
|
||||
fieldName="status"
|
||||
wrapperClasses="project-status--display-field" />
|
||||
</div>
|
||||
<div class="project-status-explanation--container">
|
||||
<op-editable-attribute-field [resource]="project"
|
||||
fieldName="statusExplanation" />
|
||||
</div>
|
||||
</edit-form>
|
||||
}
|
||||
</div>
|
||||
<turbo-frame [id]="frameId" [src]="src" loading="lazy" />
|
||||
|
||||
+6
-54
@@ -26,64 +26,16 @@
|
||||
// See COPYRIGHT and LICENSE files for more details.
|
||||
//++
|
||||
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
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 { ProjectResource } from 'core-app/features/hal/resources/project-resource';
|
||||
import { WorkPackageViewHighlightingService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-highlighting.service';
|
||||
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
|
||||
import { Observable } from 'rxjs';
|
||||
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 { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { AbstractTurboWidgetComponent } from 'core-app/shared/components/grids/widgets/abstract-turbo-widget.component';
|
||||
|
||||
@Component({
|
||||
selector: 'op-project-status-widget',
|
||||
templateUrl: './project-status.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
providers: [
|
||||
WorkPackageViewHighlightingService,
|
||||
IsolatedQuerySpace,
|
||||
HalResourceEditingService,
|
||||
],
|
||||
standalone: false,
|
||||
})
|
||||
export class WidgetProjectStatusComponent extends AbstractWidgetComponent implements OnInit {
|
||||
@ViewChild('contentContainer', { static: true }) readonly contentContainer:ElementRef;
|
||||
|
||||
public currentStatusCode = 'not set';
|
||||
|
||||
public explanation = '';
|
||||
|
||||
public project$:Observable<ProjectResource>;
|
||||
|
||||
constructor(protected readonly i18n:I18nService,
|
||||
protected readonly injector:Injector,
|
||||
protected readonly apiV3Service:ApiV3Service,
|
||||
protected readonly currentProject:CurrentProjectService,
|
||||
protected readonly cdRef:ChangeDetectorRef) {
|
||||
super(i18n, injector);
|
||||
}
|
||||
|
||||
ngOnInit():void {
|
||||
if (this.currentProject.id) {
|
||||
this.project$ = this
|
||||
.apiV3Service
|
||||
.projects
|
||||
.id(this.currentProject.id)
|
||||
.get();
|
||||
this.cdRef.detectChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public get isEditable():boolean {
|
||||
return false;
|
||||
}
|
||||
export class WidgetProjectStatusComponent extends AbstractTurboWidgetComponent {
|
||||
override frameId = 'grids-widgets-project-status';
|
||||
override name = 'project_status';
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ import { WidgetCustomTextComponent } from 'core-app/shared/components/grids/widg
|
||||
import {
|
||||
WidgetProjectStatusComponent,
|
||||
} from 'core-app/shared/components/grids/widgets/project-status/project-status.component';
|
||||
import {
|
||||
WidgetProjectStatusBetaComponent,
|
||||
} from 'core-app/shared/components/grids/widgets/project-status-beta/project-status-beta.component';
|
||||
import { WidgetSubprojectsComponent } from 'core-app/shared/components/grids/widgets/subprojects/subprojects.component';
|
||||
import {
|
||||
WidgetProjectFavoritesComponent,
|
||||
@@ -230,14 +227,6 @@ export class GridWidgetsService {
|
||||
name: this.I18n.t('js.grid.widgets.project_status.title'),
|
||||
},
|
||||
},
|
||||
{
|
||||
identifier: 'project_status_beta',
|
||||
component: WidgetProjectStatusBetaComponent,
|
||||
title: this.I18n.t('js.grid.widgets.project_status_beta.title'),
|
||||
properties: {
|
||||
name: this.I18n.t('js.grid.widgets.project_status_beta.title'),
|
||||
},
|
||||
},
|
||||
{
|
||||
identifier: 'subprojects',
|
||||
component: WidgetSubprojectsComponent,
|
||||
|
||||
@@ -27,8 +27,6 @@ en:
|
||||
not_set: 'Not set'
|
||||
finished: 'Finished'
|
||||
discontinued: 'Discontinued'
|
||||
project_status_beta:
|
||||
title: 'Status (BETA)'
|
||||
subprojects:
|
||||
title: 'Subitems'
|
||||
project_favorites:
|
||||
|
||||
@@ -4,7 +4,6 @@ module Grids::Configuration
|
||||
"work_packages_graph",
|
||||
"project_description",
|
||||
"project_status",
|
||||
"project_status_beta",
|
||||
"subprojects",
|
||||
"work_packages_calendar",
|
||||
"work_packages_overview",
|
||||
@@ -27,10 +26,6 @@ module Grids::Configuration
|
||||
user.allowed_in_any_work_package?(:view_work_packages, in_project: project)
|
||||
}
|
||||
|
||||
view_beta_widgets = ->(_user, _project) {
|
||||
OpenProject::FeatureDecisions.beta_widgets_active?
|
||||
}
|
||||
|
||||
widget_strategy "work_packages_table" do
|
||||
after_destroy remove_query_lambda
|
||||
|
||||
@@ -47,10 +42,6 @@ module Grids::Configuration
|
||||
options_representer "::API::V3::Grids::Widgets::ChartOptionsRepresenter"
|
||||
end
|
||||
|
||||
widget_strategy "project_status_beta" do
|
||||
allowed view_beta_widgets
|
||||
end
|
||||
|
||||
widget_strategy "custom_text" do
|
||||
options_representer "::API::V3::Grids::Widgets::CustomTextOptionsRepresenter"
|
||||
end
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# -- 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.
|
||||
# ++
|
||||
|
||||
class RemoveStatusBetaWidgets < ActiveRecord::Migration[8.0]
|
||||
def up
|
||||
remove_status_beta_widgets
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def remove_status_beta_widgets
|
||||
execute <<-SQL.squish
|
||||
DELETE FROM grid_widgets
|
||||
WHERE identifier = 'project_status_beta'
|
||||
SQL
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user