rstedman / tfs-pullrequest-dashboard

tfs dashboard for pullrequests across all repos
MIT License
30 stars 29 forks source link

Dashboard Widget fails with "New Dashboards Experience" in VSTS #15

Closed whoiskevinrich closed 6 years ago

whoiskevinrich commented 6 years ago

I updated to the "New Dashboards Experience" in VSTS, which seems to have broken the widget

image

Turning the Preview feature off restores functionality

image

DanielTheCoder commented 6 years ago

Same problem here, maybe the following error messages helps

JavaScript Error

VSS.SDK.js:652 No handler found on any channel for message: {"id":1,"methodName":null,"instanceId":"tfs-pullrequest-dashboard-widget","params":null,"jsonrpc":"2.0"}

we also have several 404s

Request URL:
https://******/_apis/ExtensionManagement/InstalledExtensions/ryanstedman/tfs-pullrequest-dashboard/Data/Scopes/User/Me/Collections/%24settings/Documents/allProjects

Response
{"$id":"1","innerException":null,"message":"TF1590005: Document with id $settings does not exist in collection User for ************* = allProjects","typeName":"Microsoft.VisualStudio.Services.ExtensionManagement.WebApi.DocumentDoesNotExistException, Microsoft.VisualStudio.Services.ExtensionManagement.WebApi","typeKey":"DocumentDoesNotExistException","errorCode":0,"eventId":3000}
Request URL:
https://**************/_apis/ExtensionManagement/InstalledExtensions/ryanstedman/tfs-pullrequest-dashboard/Data/Scopes/User/Me/Collections/%24settings/Documents/dateFormat

{"$id":"1","innerException":null,"message":"TF1590005: Document with id $settings does not exist in collection User for ******* = dateFormat","typeName":"Microsoft.VisualStudio.Services.ExtensionManagement.WebApi.DocumentDoesNotExistException, Microsoft.VisualStudio.Services.ExtensionManagement.WebApi","typeKey":"DocumentDoesNotExistException","errorCode":0,"eventId":3000}

cross posted on developer community here

PeterAntal commented 6 years ago

Cross-posting my response to Daniel on VSTS dev Community: https://developercommunity.visualstudio.com/content/problem/201115/new-dashboard-experience-breaks-widget-of-tfs-pull.html

What is happening -I have verified the repro, and observed: -The widget is being instantiated by the Widget Host of the Dashboard Service, as per normal -The widget page and client script code is running. -The widget was failing to implement widget contract methods e.g. load(), and did not return widgetHelpers.WidgetStatusHelper.Success(); -The widget host of the dashboard recognized the failure to implement the documented widget contract as meaning this was not behaving a widget.

Root Cause: In the code, I found the following line 65178 in the app.bundle.min(Line 71 of appConfig.service.ts), which is where the developer's expectations diverge in new dashboards:

_this._layout.widgetMode = context.getPageContext().navigation.currentController === "dashboards";

This step evaluated to false, as new dashboards does not have it's own Controller, it uses a common VSTS contribution based controller, which is named "apps". This state is not a supported part of the dashboards contract, and has no guarantees around it. Based on state of that boolean, the code took a branch which skips the widget contracts.

Recommended Next steps: -In short term, developer can set up their widget and "other" contribution to use different entry points and set some state to distinguish them, so they can guarantee they know what consumer is is running the code.

-As the developer seems to be trying to recognize which containers his contribution is hosted in, they should get in touch with us, so we can determine an explicit/reliable contract to recognize where his experience is being hosted, and how it should behave.

Thanks

rstedman commented 6 years ago

I've release version 2.0.2 which fixes this issue. It's still using the page context to determine if running as a dashboard widget, just looking at another property.

I've also logged issue #17 to determine an officially supported method for determining if running as a dashboard widget, so that this doesn't break again with a future VSTS update.

DanielTheCoder commented 6 years ago

For me the widget is not showing any PR for "My Team", maybe another change on vsts side? several 404s image