Merge pull request #40511 from nextcloud/fix/dashboard-widgets-api

Fix dashboard widgets api
This commit is contained in:
Kate 2023-09-20 21:22:33 +02:00 committed by GitHub
commit 716c5e0966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View file

@ -150,7 +150,7 @@ class DashboardApiController extends OCSController {
* @NoAdminRequired
* @NoCSRFRequired
*
* @return DataResponse<Http::STATUS_OK, DashboardWidget[], array{}>
* @return DataResponse<Http::STATUS_OK, array<string, DashboardWidget>, array{}>
*/
public function getWidgets(): DataResponse {
$widgets = $this->dashboardManager->getWidgets();

View file

@ -220,8 +220,8 @@
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Widget"
}
}

View file

@ -40,8 +40,8 @@ class Manager implements IManager {
/** @var array */
private $lazyWidgets = [];
/** @var IWidget[] */
private $widgets = [];
/** @var array<string, IWidget> */
private array $widgets = [];
private ContainerInterface $serverContainer;
private ?IAppManager $appManager = null;
@ -134,6 +134,9 @@ class Manager implements IManager {
$this->lazyWidgets = [];
}
/**
* @return array<string, IWidget>
*/
public function getWidgets(): array {
$this->loadLazyPanels();
return $this->widgets;

View file

@ -40,7 +40,7 @@ interface IManager {
/**
* @since 20.0.0
*
* @return IWidget[]
* @return array<string, IWidget>
*/
public function getWidgets(): array;
}