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

Incompatible columns display

Oliver Günther782712857989
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index ea5bacc7923..8e8e0b7c75c 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -994,6 +994,7 @@ en:
addition_label: 'Added to view within the comparison time period'
removal_label: 'Removed from view within the comparison time period'
modification_label: 'Modified within the comparison time period'
+ column_incompatible: 'This attribute is not compatible with baseline and will not show differences.'
filters:
title: 'Filter work packages'
baseline_incompatible: 'This filter is not compatible with baseline and will not be included in the comparison.'
diff --git a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html
index f0efe67973d..6ebe2dce1a3 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html
+++ b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.html
@@ -36,7 +36,6 @@
</span>
<span class="draggable-table--sort-header"
- [attr.title]="text.sortColumn"
*ngSwitchCase="'sort'">
</span>
@@ -52,6 +51,13 @@
<a *ngIf="!sortable">{{headerColumn.name}}</a>
+ <span
+ *ngIf="baselineIncompatible"
+ [attr.title]="text.baselineIncompatible"
+ class="spot-icon spot-icon_1_25 spot-icon_warning"
+ >
+ </span>
+
<op-icon icon-classes="dropdown-indicator icon-small icon-pulldown"
icon-title="{{ text.openMenu }}"
*ngIf="displayDropdownIcon"></op-icon>
diff --git a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts
index 6b471a9e6b1..52cf287194f 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/sort-header/sort-header.directive.ts
@@ -35,6 +35,7 @@ import {
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import {
+ QueryColumn,
RelationQueryColumn,
TypeRelationQueryColumn,
} from 'core-app/features/work-packages/components/wp-query/query-column';
@@ -56,7 +57,7 @@ import { WorkPackageViewBaselineService } from 'core-app/features/work-packages/
templateUrl: './sort-header.directive.html',
})
export class SortHeaderDirective extends UntilDestroyedMixin implements AfterViewInit {
- @Input() headerColumn:any;
+ @Input() headerColumn:QueryColumn;
@Input() locale:string;
@@ -69,7 +70,7 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie
public text = {
toggleHierarchy: this.I18n.t('js.work_packages.hierarchy.show'),
openMenu: this.I18n.t('js.label_open_menu'),
- sortColumn: 'Sorting column', // TODO
+ baselineIncompatible: this.I18n.t('js.work_packages.baseline.column_incompatible'),
};
isHierarchyColumn:boolean;
@@ -82,7 +83,7 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie
isHierarchyDisabled:boolean;
- private element:JQuery;
+ baselineIncompatible = false;
private currentSortDirection:any;
@@ -92,7 +93,7 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie
private wpTableGroupBy:WorkPackageViewGroupByService,
private wpTableBaseline:WorkPackageViewBaselineService,
private wpTableRelationColumns:WorkPackageViewRelationColumnsService,
- private elementRef:ElementRef,
+ private elementRef:ElementRef<HTMLElement>,
private cdRef:ChangeDetectorRef,
private I18n:I18nService,
) {
@@ -104,8 +105,6 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie
}
private initialize():void {
- this.element = jQuery(this.elementRef.nativeElement);
-
combineLatest([
this.wpTableSortBy.onReadyWithAvailable(),
this.wpTableSortBy.live$(),
@@ -176,6 +175,16 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie
this.setHierarchyIcon();
}
+ this
+ .wpTableBaseline
+ .live$()
+ .pipe(
+ this.untilDestroyed(),
+ )
+ .subscribe(() => {
+ this.baselineIncompatible = this.wpTableBaseline.isActive() && this.wpTableBaseline.isIncompatibleColumn(this.headerColumn.id);
+ });
+
this.cdRef.detectChanges();
}
@@ -224,6 +233,10 @@ export class SortHeaderDirective extends UntilDestroyedMixin implements AfterVie
}
setActiveColumnClass() {
- this.element.toggleClass('active-column', !!this.currentSortDirection);
+ if (this.currentSortDirection) {
+ this.elementRef.nativeElement.classList.add('active-column');
+ } else {
+ this.elementRef.nativeElement.classList.remove('active-column');
+ }
}
}
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts
index f5deb8405c3..9a11af9c535 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts
@@ -52,6 +52,20 @@ export const BASELINE_INCOMPATIBLE_FILTERS = [
'comment',
];
+export const BASELINE_INCOMPATIBLE_COLUMNS = [
+ 'category',
+ 'updatedAt',
+ 'estimatedHours',
+ 'remainingTime',
+ 'spentTime',
+ 'percentageDone',
+ 'duration',
+ 'budget',
+ 'materialCosts',
+ 'laborCosts',
+ 'overallCosts',
+];
+
@Injectable()
export class WorkPackageViewBaselineService extends WorkPackageQueryStateService<string[]> {
constructor(
@@ -79,10 +93,13 @@ export class WorkPackageViewBaselineService extends WorkPackageQueryStateService
return BASELINE_INCOMPATIBLE_FILTERS.includes(filter);
}
+ public isIncompatibleColumn(column:string):boolean {
+ return BASELINE_INCOMPATIBLE_COLUMNS.includes(column);
+ }
+
public yesterdayDate():string {
return moment().subtract(1, 'days').format('YYYY-MM-DD');
}
-
public lastMonthDate():string {
return moment().subtract(1, 'month').format('YYYY-MM-DD');
}