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

Wire up value selection with baseline service

Oliver Günther33be0897521d
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html
index 6b30dbfe9b3..52845e07535 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-modal/baseline-modal.component.html
@@ -24,5 +24,8 @@
<span class="spot-body-small">{{ text.header_description }}</span>
</div>
</ng-container>
- <op-baseline slot="body"></op-baseline>
+ <op-baseline
+ slot="body"
+ (submitted)="opened = false"
+ ></op-baseline>
</spot-drop-modal>
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
index 62a1b22c0c6..4eae1c891c7 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.html
@@ -15,7 +15,9 @@
[value]=""></option>
<option
*ngFor="let availableValue of baselineAvailableValues"
- [value]="availableValue.value">
+ [value]="availableValue.value"
+ [selected]="availableValue.value === selectedFilter"
+ >
{{availableValue.title}}
</option>
</select>
@@ -31,6 +33,7 @@
<input
slot="input"
+ [value]="selectedTime"
(change)="timeChange($event.target.value)"
type="time"
class="op-baseline--time-input"/>
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
index 6fb9533c215..11d8697cb04 100644
--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts
@@ -29,12 +29,14 @@
import {
ChangeDetectionStrategy,
Component,
+ EventEmitter,
HostBinding,
+ OnInit,
+ Output,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
-import { WorkPackageViewFiltersService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service';
import { HalResourceService } from 'core-app/features/hal/services/hal-resource.service';
import SpotDropAlignmentOption from 'core-app/spot/drop-alignment-options';
import { WeekdayService } from 'core-app/core/days/weekday.service';
@@ -43,6 +45,10 @@ import { IDay } from 'core-app/core/state/days/day.model';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
import { Observable } from 'rxjs';
+import {
+ DEFAULT_TIMESTAMP,
+ WorkPackageViewBaselineService,
+} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service';
@Component({
selector: 'op-baseline',
@@ -50,10 +56,10 @@ import { Observable } from 'rxjs';
templateUrl: './baseline.component.html',
styleUrls: ['./baseline.component.sass'],
})
-export class OpBaselineComponent extends UntilDestroyedMixin {
+export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
@HostBinding('class.op-baseline') className = true;
- public opened = false;
+ @Output() submitted = new EventEmitter<void>();
public dropDownDescription = '';
@@ -63,7 +69,7 @@ export class OpBaselineComponent extends UntilDestroyedMixin {
public selectedDate = '';
- public selectedTime = '';
+ public selectedTime = '00:00';
public selectedFilter = '';
@@ -119,20 +125,31 @@ export class OpBaselineComponent extends UntilDestroyedMixin {
constructor(
readonly I18n:I18nService,
- readonly wpTableFilters:WorkPackageViewFiltersService,
+ readonly wpTableBaseline:WorkPackageViewBaselineService,
readonly halResourceService:HalResourceService,
- private weekdaysService:WeekdayService,
- private daysService:DayResourceService,
+ readonly weekdaysService:WeekdayService,
+ readonly daysService:DayResourceService,
readonly timezoneService:TimezoneService,
- private configuration:ConfigurationService,
+ readonly configuration:ConfigurationService,
) {
super();
}
+ public ngOnInit():void {
+ if (this.wpTableBaseline.isActive()) {
+ const value = this.wpTableBaseline.current[0];
+ const [date, time] = value.split('@');
+
+ this.filterChange(date);
+ this.selectedTime = time || '00:00';
+ this.filterSelected = true;
+ }
+ }
+
public clearSelection():void {
this.filterSelected = false;
- this.timeZoneSelected =false;
- this.selectedTime = '';
+ this.timeZoneSelected = false;
+ this.selectedTime = '0:00';
this.selectedDate = '';
this.selectedFilter = '';
this.dropDownDescription = '';
@@ -140,8 +157,9 @@ export class OpBaselineComponent extends UntilDestroyedMixin {
public onSubmit(e:Event):void {
e.preventDefault();
- // TODO: string should be sent to the server
const filterString = `${this.selectedFilter}@${this.selectedTime}`;
+ this.wpTableBaseline.update([filterString, DEFAULT_TIMESTAMP]);
+ this.submitted.emit();
}
public yesterdayDate():string {
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 3920f036289..b66372a4e12 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
@@ -56,7 +56,7 @@ export class WorkPackageViewBaselineService extends WorkPackageQueryStateService
}
public valueFromQuery(query:QueryResource):string[] {
- return query.timestamps as string[];
+ return query.timestamps;
}
public hasChanged(query:QueryResource) {