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

create api card and form to request Ign download api #989

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

mmohadIGN
Copy link

@mmohadIGN mmohadIGN commented Sep 11, 2024

Description

This PR introduces a new component designed to create an API card for requesting the IGN download API. The component simplifies the integration process by providing a form to interact with the IGN download API.

Architectural changes

Screenshots

image

Quality Assurance Checklist

  • Commit history is devoid of any merge commits and readable to facilitate reviews
  • If new logic ⚙️ is introduced: unit tests were added
  • If new user stories 🤏 are introduced: E2E tests were added
  • If new UI components 🕹️ are introduced: corresponding stories in Storybook were created
  • If breaking changes 🪚 are introduced: add the breaking change label
  • If bugs 🐞 are fixed: add the backport <release branch> label
  • The documentation website 📚 has received the love it deserves

Details issues #766

@jahow
Copy link
Collaborator

jahow commented Sep 18, 2024

Hi @mmohadIGN, sorry for the late reply but the team is currently busy working on a first version of the Metadata Editor app, so we simply don't have the bandwidth to look into this PR. Is this OK if the review happens later in October? Thanks

@mmohadIGN
Copy link
Author

Hi @mmohadIGN, sorry for the late reply but the team is currently busy working on a first version of the Metadata Editor app, so we simply don't have the bandwidth to look into this PR. Is this OK if the review happens later in October? Thanks

Hi @jahow, it's fine, no problem.

@jahow jahow added this to the 2.4.0 milestone Nov 14, 2024
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Collaborator

@Angi-Kinas Angi-Kinas left a comment

Choose a reason for hiding this comment

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

Thanks @mmohadIGN for this contribution and sorry for the delayed review! I haven't tested the feature yet, but the screenshots look good already! :)

There are some minor issues that I think should be addressed.
Also it would be great if we could make the components more generic to fit in this project instead of specifically mentioning IGN. What do you think about this?

Let me know if anything is unclear!

@@ -162,6 +166,7 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
UiWidgetsModule,
RecordMetaComponent,
LetDirective,
MatButtonToggleModule,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this really needed here? I don't see it being used.

Copy link
Author

Choose a reason for hiding this comment

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

No, you're right. I removed it

@@ -36,9 +36,20 @@
<div class="bg-primary-opacity-10 py-8">
<div class="flex flex-col px-4 gap-8 container-lg lg:mx-auto">
<div class="flex flex-wrap justify-between sm:mb-2 ng-star-inserted">
<p class="text-[21px] text-title font-title" translate>
<p
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the two paragraphs (line 39 -52) are the same except of their text content. Instead of repeating, you could use one paragraph, like so:

Suggested change
<p
<p
class="text-[21px] text-title font-title"
*ngIf="selectedApiLink?.accessServiceProtocol"
translate
>
{{ selectedApiLink?.accessServiceProtocol === 'GPFDL'
? 'record.metadata.api.form.title.gpf'
: 'record.metadata.api.form.title' }}
</p>

If we would have to change the paragraph in the future, we would only have to do that in one place :)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you're right. I have done it.

@@ -57,7 +68,13 @@
</ng-icon>
</button>
</div>

<gn-ui-ign-api-dl
Copy link
Collaborator

Choose a reason for hiding this comment

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

The name of this component gn-ui-ign-api-dl is really specific to IGN. Would there be a way to make the component more generic (maybe reflecting the format it is using?)?
Maybe @jahow has a good idea about it.


:host ::ng-deep gn-ui-copy-text-button button,
host ::ng-deep gn-ui-copy-text-button button:hover {
background-color: var(--color-secondary) !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to achieve this without using !important?

</div>
<div class="flex flex-row flex-wrap justify-between flex-grow gap-5">
<div class="flex flex-col gap-3">
<!--<p class="text-sm" translate>record.metadata.api.form.type</p>-->
Copy link
Collaborator

@Angi-Kinas Angi-Kinas Dec 19, 2024

Choose a reason for hiding this comment

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

Is this still needed as it is commented out?

Copy link
Author

Choose a reason for hiding this comment

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

No, you're right. I removed them.


listFilteredProduct$ = this.apiQueryUrl$.pipe(
mergeMap((url) => {
console.log(url)
Copy link
Collaborator

Choose a reason for hiding this comment

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

console.log ;-)

Copy link
Author

Choose a reason for hiding this comment

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

done :)

}
return outputUrl
})
// startWith(() => this.apiBaseUrl)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this still relevant? See also line 126 and 180.

Copy link
Author

Choose a reason for hiding this comment

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

No, I removed it too.

return choicesTest
}
async getFields() {
this.choices = await this.getCapabilities()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see a lot of repetition in this part of the code. But maybe I don't understand the logic behind it.
@jahow could we simplify this?

<div *ngFor="let entry of liste$ | async">
<a [href]="entry['link'][0]['href']"
>{{ entry['link'][0]['href'].split('/').slice(-1) }}
<mat-icon
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, we updated our icon library in the meantime and use <ng-icon> now.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I made the change.

@@ -75,6 +76,8 @@ export class RecordApisComponent implements OnInit {
}

openRecordApiForm(link: DatasetServiceDistribution) {
this.displayApiIgnForm =
Copy link
Collaborator

Choose a reason for hiding this comment

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

This could be simpliefied, as the expression already evaluates to a boolean.

Suggested change
this.displayApiIgnForm =
this.displayApiIgnForm = link.accessServiceProtocol === 'GPFDL';

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you're right. I made the change.

@mmohadIGN
Copy link
Author

Thanks @mmohadIGN for this contribution and sorry for the delayed review! I haven't tested the feature yet, but the screenshots look good already! :)

There are some minor issues that I think should be addressed. Also it would be great if we could make the components more generic to fit in this project instead of specifically mentioning IGN. What do you think about this?

Let me know if anything is unclear!
Your version is much improved! Here's a slightly polished version to address minor issues:

Hi,

No problem.
Yes, I think generalizing will improve the situation. Do you have any advice on how to proceed?
In the meantime, I’ll correct the issues you pointed out.

Thanks!

@Angi-Kinas
Copy link
Collaborator

Angi-Kinas commented Jan 6, 2025

Hello @mmohadIGN, thank you for your patience and thanks for addressing the comments!

I tried to test the new functionality locally and realized that some of the logic interferes with already existing logic of the "Downloads"-section. As a result, some of the downloads now appear in the "API"-section that were in the "Downloads"-section before. For those download resources, there is now the logic available that you created for the IGN downloads, but they don't provide this functionality (see Screenshot):
image

Therefore I have some questions:

  • Do you know what the protocol looks like for the IGN API? Is it in any way different from the protocol for other downloads? (e.g. different from WWW:DOWNLOAD-1.0-http--download)
  • Can you tell me how I can locally test your changes with a dataset from your side? So I can see how it is supposed to work.
  • Which values will be used for ZONE/ FORMAT / CRS? Do they come from the API?

In the meantime, maybe you can adjust the placing of the button ("reset") and text ("create your request") above the dropdowns a bit?
Currently it looks a bit squished together:
image

But it could look like the other API form (record-api-form.component):
image

Additionally my team had an idea about making the naming more generic: Could you please change the name of the components that contain ign into gpf or gpfdl? (e.g. gpf-api-dl.component.ts)

Let me know if you have any questions.
Thanks!

@mmohadIGN
Copy link
Author

Hello @Angi-Kinas,

I made the style change you request and rename the file.
About the http-download protocols, maybe I can check with a regex the URL ?
For example, a metadata : https://data.geopf.fr/csw?REQUEST=GetRecordById&SERVICE=CSW&VERSION=2.0.2&OUTPUTSCHEMA=http://standards.iso.org/iso/19115/-3/mdb/2.0&elementSetName=full&ID=IGNF_BD-TOPO
Can you use this metadata for your test ?

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.

4 participants