-
Notifications
You must be signed in to change notification settings - Fork 32
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
[ME] spatial extents field #941
Conversation
Affected libs:
|
📷 Screenshots are here! |
0226510
to
6c9291c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LHBruneton-C2C for your help on this!
Please feel free to review and leave comments.
I already left some comments to not forget what still needs to be done.
Another ting that I was unsure about, is where to place the components that have been created. Namely "GenericFormFieldKeywordsComponent" and "FormFieldMapContainerComponent" and about their naming.
Thanks in advance!
libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts
Outdated
Show resolved
Hide resolved
...rd-form/form-field/form-field-keywords-generic/form-field-keywords-generic.component.spec.ts
Outdated
Show resolved
Hide resolved
.../record-form/form-field/form-field-keywords-generic/form-field-keywords-generic.component.ts
Outdated
Show resolved
Hide resolved
.../record-form/form-field/form-field-keywords-generic/form-field-keywords-generic.component.ts
Outdated
Show resolved
Hide resolved
|
||
import { FormFieldMapContainerComponent } from './form-field-map-container.component'; | ||
|
||
describe('FormFieldMapContainerComponent', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do: write tests for this component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be moved to feature/editor/src/lib too, to split things a bit more.
...record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.spec.ts
Show resolved
Hide resolved
libs/feature/editor/src/lib/components/record-form/record-form.component.ts
Outdated
Show resolved
Hide resolved
libs/feature/editor/src/lib/components/record-form/record-form.component.ts
Outdated
Show resolved
Hide resolved
...onents/record-form/form-field/form-field-map-container/form-field-map-container.component.ts
Outdated
Show resolved
Hide resolved
...onents/record-form/form-field/form-field-map-container/form-field-map-container.component.ts
Outdated
Show resolved
Hide resolved
@Input() keywordsWithSpatialExtents: { | ||
[key: string]: { | ||
placeKeyword?: Keyword | ||
spatialExtents?: DatasetSpatialExtent | ||
} | ||
}[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not critical, but this component doesn't need to know anything about keywords, so it would be better if you only gave it an array of spatial extents as input. This could be done by reducing/flattening your keywordsWithSpatialExtents from the parent component before sending it to the child component.
...ents/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts
Outdated
Show resolved
Hide resolved
...ents/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts
Outdated
Show resolved
Hide resolved
bboxCoordsToGeometry(bbox: [number, number, number, number]): Geometry { | ||
const geometry = new Polygon([ | ||
[ | ||
[bbox[2], bbox[3]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is original, why not start with 0 - 1?
...ents/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts
Outdated
Show resolved
Hide resolved
...ents/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts
Outdated
Show resolved
Hide resolved
...ents/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work already! Not tested yet, will try tomorrow.
cf67074
to
0978a24
Compare
dde0774
to
54a114b
Compare
@LHBruneton-C2C @Angi-Kinas I finally managed to rework this, I have rewritten the commit history to make it more readable and hopefully easier to review. Things I added to the original work:
This is ready for review, I hope I didn't miss anything. edit: Coveralls is down which explains the failure in the CI, but the rest works |
3b92553
to
2e2cd38
Compare
this component will be used in the geographical coverage as well
Tests are moved to ng-mocks for convenience
2e2cd38
to
321ae56
Compare
This required adding TranslateModule to some tests in return
This fixes an issue where we can't match a deleted keywords with the array of shown keywords because the array would be recreated on each subscription The generic-keywords component is also not mutating its input array (this was causing a bug as well)
321ae56
to
ebe9333
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! Thanks @Angi-Kinas and @jahow for this huge feature.
Tested draft and publishing, working as it should.
}, | ||
]) | ||
}) | ||
it('returns an empty array of the thesaurus is unknown', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('returns an empty array of the thesaurus is unknown', async () => { | |
it('returns an empty array if the thesaurus is unknown', async () => { |
.overrideComponent(FormFieldSpatialExtentComponent, { | ||
set: { | ||
changeDetection: ChangeDetectionStrategy.Default, | ||
}, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary anymore with the MockBuilder.
TranslateModule.forRoot(), | ||
HttpClientTestingModule, | ||
], | ||
schemas: [NO_ERRORS_SCHEMA], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't wait to see more of those disappear!
@@ -17,6 +17,7 @@ export interface FormFieldConfig { | |||
} | |||
|
|||
export interface EditorField { | |||
id?: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed anymore, since you used the facade to retrieve multiple fields.
|
||
ngMocks.globalKeep(CommonModule, true) | ||
ngMocks.globalKeep(BrowserModule, true) | ||
ngMocks.globalKeep(RouterModule, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure the Router should be kept in libs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much @jahow for making this work! It was a really big and complicated feature.
I tested the feature a bit and I think we still need to filter out the place keywords from the "other" keywords that we display on the 3rd page of the editor.
Otherwise we get issues like this:
And when we delete the keyword "Africa" and go back to the first page, we see:
WDYT?
@Angi-Kinas yes you're right... could this be done in another PR? because I honestly don't feel like adding anything else to this one 😱 |
@jahow yes you are right, I totally understand! Let's do it in another PR. |
Description
This PR introduces the form field for the spatial extents.
The tests have no been written yet and the PR depends on #944.
For some reason the translation keys are not being applied.
Architectural changes
There are some changes in the
record-form.component
in the way we render this field. This is the first field that needs input from two sources of the field config (place keywords and spatial extents). That's why we made it specific here. If there will be more fields like this, we can think about making this more generic.Screenshots
Quality Assurance Checklist
breaking change
labelbackport <release branch>
labelThis work is sponsored by Organization ABC.