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

Custom widgets - send location info of the main window to widgets #2284

Closed
girish-tank-avnet opened this issue Sep 6, 2023 · 17 comments
Closed

Comments

@girish-tank-avnet
Copy link

Hello @JMach1
before 1 month i had create a ticket regarding access parent page URL in azure APIM custom widget and you got resolved it by adding "parentLocation" property in Secret object.

Here is the old ticket/PR reference:
[PR reference] (#2238)
[Code commit URL] (e873140)

i saw that this change (adding parentLocation) has been merged into master branch in developer portal v2.24.0 and i think this developer portal version has been deployed but i am not able to get these changes in my custom widget code.

so, would you please let me know how can i get this change? is there any packages needs to be update in my custom widget source code?

@azure/api-management-custom-widgets-scaffolder npm package is used for communicating developer portal to get secret information and i have its latest version (1.0.0-beta.2) installed in my custom widget source code.

please let me know how can in get change that you have done in developer portal in my custom widget source code.

i am going to attach an image of get secret call in which you can see "parentLocation" URL property is not there.

image

Thanks in advance.

@JMach1
Copy link
Member

JMach1 commented Sep 6, 2023

Hello, AFAIK Dev Portal release was rolled back because of some regressions, so it's still not there, @malincrist please correct me if I'm wrong.
There is a release of the @azure/api-management-custom-widgets-tools package in progress as well, but it's not necessary for getting the new functionality going. With old version, you'll just need to add ts-ignore because of missing type, but the data should be coming, once the Dev Portal is released.

@girish-tank-avnet
Copy link
Author

@JMach1, thanks for instant reply !!!!.

@malincrist , do you have any idea about release of developer portal with above mentioned change?

Thanks.

@malincrist
Copy link
Member

Hi @girish-tank-avnet , unfortunately, the release was postponed. The new ETA is mid-September. Apologies for the delay.

@girish-tank-avnet
Copy link
Author

Hi @malincrist. no problem. just 1 thing i need to know that how can i know once release will be done in the mid of September.?

is there any facility like i can receive an email or anything else?

@girish-tank-avnet
Copy link
Author

Hello @malincrist and @JMach1
is there any update for when developer portal will be deployed with mentioned changes in this ticket? as now this is end of the September and this change is not on current deployed developer portal.

@malincrist
Copy link
Member

Hello @girish-tank-avnet , the deployment is in progress, please give it a few days to reach all the regions. Apologies for the delay.

@girish-tank-avnet
Copy link
Author

@malincrist Thank you very much for giving update!!!!!!!!

@girish-tank-avnet
Copy link
Author

Hello @malincrist

should i know the progress of developer portal release if you have any information for the same?

Thanks in Advance......

@malincrist
Copy link
Member

Hello @girish-tank-avnet , unfortunately, the deployment was cancelled due to found regressions. The new ETA for the release is 1 week. Apologies for the delay and the inconveniences caused by this.

@girish-tank-avnet
Copy link
Author

girish-tank-avnet commented Oct 24, 2023

Hello @JMach1 and @malincrist

first of all thanks for you all effort to keep me updated for developer portal deployment. we have received new portal changes what we need. but when i was doing code in my application i found one major issue in secret payload that we received from management portal.

there is a property added in secret payload namely "parentLocation" that was a change we want.

but now after new changes, property "managementApiURL" gives the value "/mapi" instead of full managementApiURL like "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}"

we are use this managementApiUrl for calling management Api for getting user and subscription details but now the due to not getting correct value our whole functionality has been broken and not working even on production environment too.

i just want to know that is this change i.e. getting "/mapi" value in managementApiURL property instead of full value intentionally changed or it is a defect in new release?

if it is defect in new release then is there any chances to rollback of developer portal deployment from our APIM instances?

please find the image which shows the issue.

image

Please let me know your thought as soon as possible as it impacted our application process.

Thanks,
Girish.

@girish-tank-avnet
Copy link
Author

@JMach1 is there any option to navigate other page by assigning a URL to parent page 's address bar from custom widget?

i got the "parentLocation" property from secrets object and do process the product subscription. after done product subscription, i need to navigate to profile page to show all product subscription of logged-in user.

so i need to assign https:///profile URL to window.partent.location.href from custom widget but as custom widget is rendered in restricted iFrame, i cannot do this and got cross origin error.

image

please do needful.

Thanks,
Girish

@JMach1
Copy link
Member

JMach1 commented Oct 27, 2023

@girish-tank-avnet regarding the first issue, on my latest portal version, I was not able to reproduce it unfortunately. Is it still happening, did you try to update the "tools" dependency package of your custom widget?

Regarding the second issue, how are you managing the redirect? For me this works just fine:
<a target="_parent" href="https://jm-apim.developer.azure-api.net/profile">profile</a>

@girish-tank-avnet
Copy link
Author

@JMach1 Thanks for replying to my query.

for 1st issue: i have update @azure/api-management-custom-widgets-tools to latest version as you suggested but still i am getting same value in "managementApiUrl" i.e "/mapi".

before latest deployment of developer portal, I was getting full URL as i mentioned in my previous comment(https://management.azure.com/subscriptions/%7BsubscriptionId%7D/resourceGroups/%7BresourceGroupName%7D/providers/Microsoft.ApiManagement/service/%7BserviceName%7D )

i have attached image of secrets values which i have got from hook.ts file.

image

@JMach1
Copy link
Member

JMach1 commented Nov 1, 2023

You are correct, I reproduced the issue, thank you for reporting it!
Could you try to send requests to
${secrets.parentLocation.origin}${secrets.managementApiUrl}...
(with valid api version at the end, so it will look for example something like https://-------.azure-api.net/mapi/apis?api-version=2021-08-01)
In the React example, you can modify the useRequest custom hook to ${secrets.parentLocation.origin}${secrets.managementApiUrl}${url}?api-version=${secrets.apiVersion}. It's only workaround, we'll fix it properly ASAP.

@girish-tank-avnet
Copy link
Author

Welcome.... @JMach1... i have 1 queries over here.
as issue is found, have you guys any plan to rollback developer portal to previous version which does not have "parentLocation" property?

we don't want to rollback developer portal to previous version. please let us know if you are planning to do.

@JMach1
Copy link
Member

JMach1 commented Nov 2, 2023

I would like to avoid rollback as well but I can promise you that, it depends what incident manager decide later.

Just to be sure, did the workaround resolved your issue?

@girish-tank-avnet
Copy link
Author

Hello @JMach1 ,

yes, i have resolved my issue by replacing managementAPIUrl manually after getting secrets from management portal.

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

No branches or pull requests

4 participants