-
Notifications
You must be signed in to change notification settings - Fork 21
Add API action 'findwikis' to find a wiki by a change number #537
Conversation
Example request/response: [
{
"wiki":"0483bb0894",
"creator":"ESanders (WMF)",
"created":"2022-07-13 15:11:52",
"url":"https:\/\/patchdemo.wmflabs.org\/wikis\/0483bb0894\/wiki\/Special:UserLogin?returnto=Talk%3ADiscussionTools"
},
{
"wiki":"2ca64449dd",
"creator":"ESanders (WMF)",
"created":"2022-07-13 15:13:23",
"url":"https:\/\/patchdemo.wmflabs.org\/wikis\/2ca64449dd\/wiki\/Special:UserLogin?returnto=Talk%3ADiscussionTools"
}
] |
cc @hashar |
Nice! Maybe the If a change has multiple wikis, maybe we would need the list of applied patches to help disambiguates between multiple instances similar to how it is displayed on https://patchdemo.wmflabs.org/ |
It's much more common that wikis get rebuilt the same set of changes, but just newer patchsets. |
This is just PHPs default JSON encoding...
|
I've added patch data to the response:
|
Apparently there's a flag for this: #541 |
I am so PHP illiterate nowadays ;) To disambiguate, I think the instances can be represented with the wiki ids followed by either the change number or task (whatever set has the least items):
Then clicking on one of the line would expand a drop down with some raw text giving more details. There for a single task and multiple patches:
And a single Gerrit change referring to multiple tasks:
Given the dropdown message is a raw text unfortunately, but that at least gives some informations :) |
As above, I don't think this will disambiguate in most cases (also we take the task number from the gerrit description, so there's no new info there). You'd be better off showing the patchset number it was built for on this change, followed by the timestamp:
|
Sounds good :) |
@hashar this as been deployed |
In case someone come here in the future, there are some screenshots of the integration in Gerrit at https://phabricator.wikimedia.org/T332474#8874936 |
Patch demo requested a Gerrit integration to show wikis spawned for a given change. Following discussions on T332474, they have implemented a `findwikis` action API: MatmaRex/patchdemo#537 Example: https://patchdemo.wmflabs.org/api.php?action=findwikis&change=822099 [ { "wiki": "a442d4db80", "creator": "ESanders (WMF)", "created": "2022-08-10 22:08:38", "patches": [ "822099,3", "820233,6" ], "url": "https://patchdemo.wmflabs.org/wikis/a442d4db80/w" }, ... ] Which should be represented as a check result: | Patchdemo |↗️ a442d4db80 PS3, X time ago Bug: T332474 Change-Id: I00199133eaaf5ff59a3b563c335eefaffb1ff4fb
We need the API to emit `Access-Control-Allow-Origin: *` to allow downstream usage in JavaScript application. For example the integration with https://gerrit.wikimedia.org/. Without it, the browser complains with: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://patchdemo.wmflabs.org/api.php?action=findwikis&change=922162. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Part of #285 Follow-up #537 Bug: https://phabricator.wikimedia.org/T332474
Part of #285