Remove logs, fix wp single date form initializion

feature/42358-standardise-date-pickers-drop-modal-portal
Benjamin Bädorf 2 years ago
parent ba52f73307
commit c218f1c26d
No known key found for this signature in database
GPG Key ID: 069CA2D117AB5CCF
  1. 1
      frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.html
  2. 30
      frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts
  3. 1
      frontend/src/app/shared/directives/focus/autofocus.directive.ts
  4. 3
      spec/features/work_packages/new/new_work_package_spec.rb

@ -44,6 +44,7 @@
</spot-form-field>
<input
#flatpickrTarget
id="flatpickr-input"
hidden
>

@ -67,6 +67,7 @@ import {
} from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { WorkPackageChangeset } from 'core-app/features/work-packages/components/wp-edit/work-package-changeset';
import isNewResource from 'core-app/features/hal/helpers/is-new-resource';
@Component({
selector: 'op-wp-single-date-form',
@ -89,12 +90,14 @@ export class OpWpSingleDateFormComponent extends UntilDestroyedMixin implements
@Input() changeset:ResourceChangeset;
@ViewChild('modalContainer') modalContainer:ElementRef<HTMLElement>;
@Output() cancel = new EventEmitter();
@Output() save = new EventEmitter();
@ViewChild('flatpickrTarget') flatpickrTarget:ElementRef;
@ViewChild('modalContainer') modalContainer:ElementRef<HTMLElement>;
text = {
save: this.I18n.t('js.button_save'),
cancel: this.I18n.t('js.button_cancel'),
@ -132,16 +135,25 @@ export class OpWpSingleDateFormComponent extends UntilDestroyedMixin implements
ngOnInit():void {
this.dateModalRelations.setChangeset(this.changeset as WorkPackageChangeset);
this.dateModalScheduling.setChangeset(this.changeset as WorkPackageChangeset);
if (!moment(this.value).isValid()) {
this.value = '';
this.date = '';
return;
}
this.date = this.timezoneService.formattedISODate(this.value);
}
ngAfterViewInit():void {
this
.dateModalRelations
.getMinimalDateFromPreceeding()
.subscribe((date) => {
this.initializeDatepicker(date);
});
if (isNewResource(this.changeset.pristineResource)) {
this.initializeDatepicker(null);
} else {
this
.dateModalRelations
.getMinimalDateFromPreceeding()
.subscribe((date) => {
this.initializeDatepicker(date);
});
}
this
.dateChangedManually$
@ -234,7 +246,7 @@ export class OpWpSingleDateFormComponent extends UntilDestroyedMixin implements
);
},
},
null,
this.flatpickrTarget.nativeElement,
);
}

@ -28,7 +28,6 @@ export class AutofocusDirective implements AfterViewInit {
// <my-input opAutofocus />
//
if (this.condition || this.condition === '') {
console.log('focus', this.elementRef.nativeElement);
this.FocusHelper.focus(this.elementRef.nativeElement);
}
}

@ -291,7 +291,6 @@ describe 'new work package', js: true do
date_field = wp_page.edit_field(:date)
byebug
date_field.expect_value(I18n.t('js.label_no_date'))
# Set date
@ -340,7 +339,6 @@ describe 'new work package', js: true do
create_work_package_globally(type_bug, project.name)
date_field = wp_page.edit_field(:combinedDate)
byebug
date_field.expect_value("no start date - no finish date")
click_on 'Cancel'
@ -365,7 +363,6 @@ describe 'new work package', js: true do
# Open datepicker
date_field = wp_page.edit_field(:combinedDate)
byebug
date_field.click_to_open_datepicker
# Select date

Loading…
Cancel
Save