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
remove unnecessary methods from baseline modal component
bsatarnejadd64bedaefc85
diff --git a/frontend/src/app/shared/components/baseline-modal/baseline-modal.component.ts b/frontend/src/app/shared/components/baseline-modal/baseline-modal.component.tsindex 7c1e3561bd6..308cba267f4 100644--- a/frontend/src/app/shared/components/baseline-modal/baseline-modal.component.ts+++ b/frontend/src/app/shared/components/baseline-modal/baseline-modal.component.ts@@ -27,7 +27,6 @@//++import {- AfterViewInit,ChangeDetectionStrategy,Component,HostBinding,@@ -35,15 +34,6 @@ import {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';-import { DayResourceService } from 'core-app/core/state/days/day.service';-import { IDay } from 'core-app/core/state/days/day.model';-import { take } from 'rxjs/operators';-import { TimezoneService } from 'core-app/core/datetime/timezone.service';-import { ConfigurationService } from 'core-app/core/config/configuration.service';@Component({selector: 'op-baseline-modal',@@ -51,88 +41,24 @@ import { ConfigurationService } from 'core-app/core/config/configuration.servicetemplateUrl: './baseline-modal.component.html',styleUrls: ['./baseline-modal.component.sass'],})-export class OpBaselineModalComponent extends UntilDestroyedMixin implements AfterViewInit {+export class OpBaselineModalComponent extends UntilDestroyedMixin {@HostBinding('class.op-baseline-modal') className = true;public opened = false;- public dropDownDescription = '';-- public nonWorkingDays:IDay[] = [];-- public selectedDate = '';-- public selectedTimezoneFormattedTime = '';-- public filterSelected = false;-- public timeZoneSelected = false;-- public daysNumber = 0;-- public tooltipPosition = SpotDropAlignmentOption.BottomRight;-public text = {toggle_title: this.I18n.t('js.show_changes.toggle_title'),header_description: this.I18n.t('js.show_changes.header_description'),clear: this.I18n.t('js.show_changes.clear'),apply: this.I18n.t('js.show_changes.apply'),- show_changes_since: this.I18n.t('js.show_changes.show_changes_since'),- time: this.I18n.t('js.show_changes.time'),- help_description: this.I18n.t('js.show_changes.help_description'),- timeZone: this.configuration.isTimezoneSet() ? moment().tz(this.configuration.timezone()).zoneAbbr() : 'local',- time_description: () => this.I18n.t('js.show_changes.time_description', { time: this.selectedTimezoneFormattedTime, days: this.daysNumber }),};- public baselineModalAvailableValues = [- {- value: '0',- title: this.I18n.t('js.show_changes.drop_down.none'),- },- {- value: '1',- title: this.I18n.t('js.show_changes.drop_down.yesterday'),- },- {- value: '2',- title: this.I18n.t('js.show_changes.drop_down.last_working_day'),- },- {- value: '3',- title: this.I18n.t('js.show_changes.drop_down.last_week'),- },- {- value: '4',- title: this.I18n.t('js.show_changes.drop_down.last_month'),- },- {- value: '5',- title: this.I18n.t('js.show_changes.drop_down.a_specific_date'),- },- {- value: '6',- title: this.I18n.t('js.show_changes.drop_down.between_two_specific_dates'),- },- ];-- public query$ = this.wpTableFilters.querySpace.query.values$();-constructor(readonly I18n:I18nService,- readonly wpTableFilters:WorkPackageViewFiltersService,- readonly halResourceService:HalResourceService,- private weekdaysService:WeekdayService,- private daysService:DayResourceService,- readonly timezoneService:TimezoneService,- private configuration:ConfigurationService,) {super();}- async ngAfterViewInit():Promise<void> {- await this.requireNonWorkingDaysOfTwoYears();- }-public toggleOpen():void {this.opened = !this.opened;}@@ -149,103 +75,4 @@ export class OpBaselineModalComponent extends UntilDestroyedMixin implements Aftpublic close():void {this.opened = false;}-- public yesterdayDate():string {- const today = new Date();- this.daysNumber = -1;-- today.setDate(today.getDate() - 1);- this.selectedDate = moment(today).format('YYYY-MM-DD');- return moment(today).format('ddd, YYYY-MM-DD');- }-- public lastMonthDate():string {- const today = new Date();- const lastMonthDate = new Date(today);-- lastMonthDate.setMonth(today.getMonth() - 1);- this.selectedDate = moment(lastMonthDate).format('YYYY-MM-DD');- this.daysNumber = moment(lastMonthDate).diff(moment(today), 'days');- return moment(today).format('ddd, YYYY-MM-DD');- }-- public lastweekDate():string {- const today = new Date();- this.daysNumber = -7;- today.setDate(today.getDate() - 7);- this.selectedDate = moment(today).format('YYYY-MM-DD');- return moment(today).format('ddd, YYYY-MM-DD');- }-- async requireNonWorkingDaysOfTwoYears() {- const today = new Date();- const lastYear = new Date(today);- lastYear.setFullYear(today.getFullYear() - 1);- this.nonWorkingDays = await this- .daysService- .requireNonWorkingYears$(lastYear, today)- .pipe(take(1))- .toPromise()?? [];- }-- isNonWorkingDay(date:Date|string):boolean {- const formatted = moment(date).format('YYYY-MM-DD');- return (this.nonWorkingDays.findIndex((el) => el.date === formatted) !== -1);- }-- public lastWorkingDate():string {- const today = new Date();- const yesterday = new Date(today);- let lastWorkingDay = '';-- yesterday.setDate(today.getDate() - 1);- while (lastWorkingDay === '') {- if (this.isNonWorkingDay(yesterday) || this.weekdaysService.isNonWorkingDay(yesterday)) {- yesterday.setDate(yesterday.getDate() - 1);- continue;- } else {- lastWorkingDay = moment(yesterday).format('ddd, YYYY-MM-DD');- this.selectedDate = moment(yesterday).format('YYYY-MM-DD');- this.daysNumber = moment(yesterday).diff(moment(today), 'days');- break;- }- }-- return lastWorkingDay;- }-- public timeChange(value:string):void {- const timeZone = this.configuration.isTimezoneSet();- if (timeZone) {- this.timeZoneSelected = true;- const dateTime= `${this.selectedDate} ${value}`;- this.selectedTimezoneFormattedTime = this.timezoneService.formattedTime(dateTime);- }- }-- public filterChange(value:string):void {- if (value !== '0') {- this.filterSelected = true;- switch (value) {- case '1':- this.dropDownDescription = this.yesterdayDate();- break;- case '2':- this.dropDownDescription=this.lastWorkingDate();- break;- case '3':- this.dropDownDescription = this.lastweekDate();- break;- case '4':- this.dropDownDescription = this.lastMonthDate();- break;- default:- this.dropDownDescription = '';- break;- }- } else {- this.filterSelected = false;- this.dropDownDescription = '';- }- }}