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

use a helper method to find the number of changes in baseline legend component

bsatarnejadcd459de8c019
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts
index e094e50d9c5..5632d6c1d57 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts
@@ -45,6 +45,7 @@ import { WorkPackageViewColumnsService } from 'core-app/features/work-packages/r
import {
baselineFilterFromValue,
getPartsFromTimestamp,
+ getBaselineState,
} from 'core-app/features/work-packages/components/wp-baseline/baseline-helpers';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import * as moment from 'moment-timezone';
@@ -196,22 +197,18 @@ export class OpBaselineLegendsComponent extends UntilDestroyedMixin implements O
this.numAdded = 0;
this.numRemoved = 0;
this.numUpdated = 0;
+ let state = '';
const baselineIsActive= this.wpTableBaseline.isActive();
const results = this.querySpace.results.value;
if (baselineIsActive && results && results.elements.length > 0) {
results.elements.forEach((workPackage:WorkPackageResource) => {
- const schema = this.schemaCache.of(workPackage);
- const timestamps = workPackage.attributesByTimestamp || [];
- if (timestamps.length > 1) {
- const base = timestamps[0];
- const compare = timestamps[1];
- if ((!base._meta.exists && compare._meta.exists) || (!base._meta.matchesFilters && compare._meta.matchesFilters)) {
- this.numAdded += 1;
- } else if ((base._meta.exists && !compare._meta.exists) || (base._meta.matchesFilters && !compare._meta.matchesFilters)) {
- this.numRemoved += 1;
- } else if (this.visibleAttributeChanged(base, schema)) {
- this.numUpdated += 1;
- }
+ state = getBaselineState(workPackage, this.schemaCache, this.wpTableColumns);
+ if (state === 'added') {
+ this.numAdded += 1;
+ } else if (state === 'removed') {
+ this.numRemoved += 1;
+ } else if (state === 'updated') {
+ this.numUpdated += 1;
}
});
this.text.maintained_with_changes = `${this.I18n.t('js.baseline.legends.maintained_with_changes')} (${this.numUpdated})`;
diff --git a/frontend/src/app/features/work-packages/routing/wp-list-view/wp-list-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-list-view/wp-list-view.component.ts
index 328171918e7..6c0e93674cf 100644
--- a/frontend/src/app/features/work-packages/routing/wp-list-view/wp-list-view.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-list-view/wp-list-view.component.ts
@@ -70,7 +70,6 @@ import { combineLatest } from 'rxjs';
],
})
export class WorkPackageListViewComponent extends UntilDestroyedMixin implements OnInit {
-
text = {
jump_to_pagination: this.I18n.t('js.work_packages.jump_marks.pagination'),
text_jump_to_pagination: this.I18n.t('js.work_packages.jump_marks.label_pagination'),