Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date Value #35

Merged
merged 67 commits into from Apr 8, 2020
Merged

Date Value #35

merged 67 commits into from Apr 8, 2020

Conversation

tobiasschweizer
Copy link
Contributor

closes #11

Tobias Schweizer added 30 commits February 25, 2020 13:28
# Conflicts:
#	package-lock.json
#	package.json
#	projects/knora-ui/src/lib/viewer/operations/display-edit/display-edit.component.html
#	projects/knora-ui/src/lib/viewer/viewer.module.ts
#	src/app/app.component.ts
@mdelez
Copy link
Contributor

mdelez commented Apr 3, 2020

since you moved the jdn-datepicker to the values folder, can you remove it from the time component since it's redundant now please? Also fix the import in the time-input.component :)

@tobiasschweizer
Copy link
Contributor Author

since you moved the jdn-datepicker to the values folder, can you remove it from the time component since it's redundant now please? Also fix the import in the time-input.component :)

will do!

@tobiasschweizer
Copy link
Contributor Author

tobiasschweizer commented Apr 3, 2020

note to myself: take a look at Guide: Material's component harnesses in your tests and Harness Overview.

Tobias Schweizer added 2 commits April 6, 2020 16:58
# Conflicts:
#	projects/knora-ui/src/lib/viewer/operations/display-edit/display-edit.component.html
#	projects/knora-ui/src/lib/viewer/values/time-value/time-input/time-input.component.html
#	projects/knora-ui/src/lib/viewer/viewer.module.ts
#	src/app/app.component.html
#	src/app/app.component.ts
@tobiasschweizer
Copy link
Contributor Author

since you moved the jdn-datepicker to the values folder, can you remove it from the time component since it's redundant now please? Also fix the import in the time-input.component :)

done in 87462a5

@tobiasschweizer
Copy link
Contributor Author

@mdelez Could you please look at def47c9 and 333b776 to see if these changes are correct?

@mdelez
Copy link
Contributor

mdelez commented Apr 7, 2020

https://github.com/dasch-swiss/knora-ui-ng-lib/blob/720106f54b75c9af94ee8b55d3379b9862defa44/projects/knora-ui/src/lib/viewer/values/date-value/date-input/date-input.component.html#L1

the class name should be adapted to "date-input-container"

That's all I could find, it looks good otherwise! Of course, the css will need to be worked on but that can be another PR once you finish all the logic.

@tobiasschweizer
Copy link
Contributor Author

https://github.com/dasch-swiss/knora-ui-ng-lib/blob/720106f54b75c9af94ee8b55d3379b9862defa44/projects/knora-ui/src/lib/viewer/values/date-value/date-input/date-input.component.html#L1

the class name should be adapted to "date-input-container"

That's all I could find, it looks good otherwise! Of course, the css will need to be worked on but that can be another PR once you finish all the logic.

good catch, done in b243a4b


@Component({
selector: 'kui-calendar-header',
template: `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should move this to the template file to keep it consistent with the way we've been creating all the other components

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in d7e2127

Start date is <strong>required</strong>
</mat-error>
<mat-error *ngIf="startDateControl.hasError('sameCalendarRequired')">
In a period, start and end date must have the same <strong>calendar</strong>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change wording from "must have" to "must use" for a clearer error message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in ec7687d

*
* @param date the given KnoraDate.
*/
createCalendarDate(date: KnoraDate): GregorianCalendarDate | JulianCalendarDate {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving this logic to the js-lib inside a ConvertUtil or CalendarUtil class? Might be nice to have in case we need to convert from a KnoraDate somewhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an excellent idea. I created https://dasch.myjetbrains.com/youtrack/issue/DSP-139.

import {DateInputComponent} from "./date-input/date-input.component";

/** Error when invalid control is dirty, touched, or submitted. */
export class IntervalErrorStateMatcher implements ErrorStateMatcher {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class name should be adapted to "DateErrorStateMatcher"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in f5d7a65


valueChangesSubscription: Subscription;

// TODO: check that both dates have the same calendar in case of a KnoraPeriod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this TODO still relevant? I believe you're checking for the calendar consistency in time-input.component.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in f5d7a65

Tobias Schweizer added 4 commits April 8, 2020 08:11
# Conflicts:
#	projects/knora-ui/src/lib/viewer/operations/display-edit/display-edit.component.spec.ts
#	projects/knora-ui/src/lib/viewer/operations/display-edit/display-edit.component.ts
@tobiasschweizer
Copy link
Contributor Author

tobiasschweizer commented Apr 8, 2020

@mdelez I will have a look at Angular Material Harness (#35 (comment)) to see if this simplifies the access to the HTML elements when using Material Components.

Edit: Often I find myself copying and pasting code from the Material repo to make the tests work because they involve complex async logic, and I think that's unnecessary because we don't want to duplicate their tests for our components.

I created https://dasch.myjetbrains.com/youtrack/issue/DSP-140 and https://dasch.myjetbrains.com/youtrack/issue/DSP-141.

@tobiasschweizer
Copy link
Contributor Author

@mdelez Thanks, I will merge as soon as the tests have passed. Found a small typo in the specs ...

@tobiasschweizer tobiasschweizer merged commit 744d852 into master Apr 8, 2020
@tobiasschweizer tobiasschweizer deleted the wip/11-date-value branch April 8, 2020 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Viewer Value Component: DateValueComponent
2 participants