diff options
author | Kate <26026535+provokateurin@users.noreply.github.com> | 2023-09-20 21:22:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 21:22:33 +0200 |
commit | 716c5e0966ac1538d1f2abd5ec57e6b53984711d (patch) | |
tree | 23e1af6a5c837b2ee5839fa5f5e4d5ca0606edac | |
parent | 9a70c1e78ab55378421e24a53d34225f30529e18 (diff) | |
parent | 6c840984f89cdc4a44d37e073007675e029d8c40 (diff) | |
download | nextcloud-server-716c5e0966ac1538d1f2abd5ec57e6b53984711d.tar.gz nextcloud-server-716c5e0966ac1538d1f2abd5ec57e6b53984711d.zip |
Merge pull request #40511 from nextcloud/fix/dashboard-widgets-api
Fix dashboard widgets api
-rw-r--r-- | apps/dashboard/lib/Controller/DashboardApiController.php | 2 | ||||
-rw-r--r-- | apps/dashboard/openapi.json | 4 | ||||
-rw-r--r-- | lib/private/Dashboard/Manager.php | 7 | ||||
-rw-r--r-- | lib/public/Dashboard/IManager.php | 2 |
4 files changed, 9 insertions, 6 deletions
diff --git a/apps/dashboard/lib/Controller/DashboardApiController.php b/apps/dashboard/lib/Controller/DashboardApiController.php index 8855bf71700..e50ab974dfc 100644 --- a/apps/dashboard/lib/Controller/DashboardApiController.php +++ b/apps/dashboard/lib/Controller/DashboardApiController.php @@ -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(); diff --git a/apps/dashboard/openapi.json b/apps/dashboard/openapi.json index 739ba2c4afc..b771b952b33 100644 --- a/apps/dashboard/openapi.json +++ b/apps/dashboard/openapi.json @@ -220,8 +220,8 @@ "$ref": "#/components/schemas/OCSMeta" }, "data": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/Widget" } } diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index 18a66499167..afe28872e69 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -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; diff --git a/lib/public/Dashboard/IManager.php b/lib/public/Dashboard/IManager.php index 77bff7b34ff..135fd4b4514 100644 --- a/lib/public/Dashboard/IManager.php +++ b/lib/public/Dashboard/IManager.php @@ -40,7 +40,7 @@ interface IManager { /** * @since 20.0.0 * - * @return IWidget[] + * @return array<string, IWidget> */ public function getWidgets(): array; } |