-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Dashboard API #21346
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
Merged
Merged
Dashboard API #21346
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
673d70d
Add new dashboard public API
juliusknorr 544fcdb
Deprecate old dashboard API
juliusknorr 5a18749
Add dashboard app
juliusknorr 4b9d47f
Modify dashboard welcome sentences
jancborchardt 829bf1a
Fix Dashboard layout, positioning and responsiveness
jancborchardt a0cd760
Separate icon from translatable text
juliusknorr 86a7d16
Update autoloader
juliusknorr 81e5593
Move to lazy panel registration during registration context
juliusknorr f7c04b0
Deprecate panel register event right away but keep it for not breakin…
juliusknorr 66ce9ed
Initialize panels early to make sure that scripts can be loaded
juliusknorr b71de68
Cleanup public api methods
juliusknorr 879b756
Update Dashboard app icon
jancborchardt 31a1494
Add load method for apps to bootstrap their panels
juliusknorr e6fb1b9
Load more than one panel
juliusknorr 35bdb99
Dashboard strict typing
juliusknorr 0c35218
Include name in translatable greeting
juliusknorr 6b2bb32
Bump bundles
juliusknorr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add new dashboard public API
Signed-off-by: Julius Härtl <[email protected]>
- Loading branch information
commit 673d70dfc5ac5cab63bda1c0d0d5d7a21bf420e9
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <?php | ||
| /** | ||
| * @copyright Copyright (c) 2020 Julius Härtl <[email protected]> | ||
| * | ||
| * @author Julius Härtl <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace OC\Dashboard; | ||
|
|
||
| use OCP\Dashboard\IManager; | ||
| use OCP\Dashboard\IPanel; | ||
|
|
||
| class Manager implements IManager { | ||
| private $panels = []; | ||
|
|
||
| /** | ||
| * @inheritDoc | ||
| */ | ||
| public function registerPanel(IPanel $panel): void { | ||
| if (array_key_exists($panel->getId(), $this->panels)) { | ||
| throw new \InvalidArgumentException('Dashboard panel with this id has already been registered'); | ||
| } | ||
|
|
||
| $this->panels[$panel->getId()] = $panel; | ||
| } | ||
|
|
||
| public function getPanels(): array { | ||
| return $this->panels; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <?php | ||
| /** | ||
| * @copyright Copyright (c) 2020 Julius Härtl <[email protected]> | ||
| * | ||
| * @author Julius Härtl <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace OCP\Dashboard; | ||
|
|
||
| /** | ||
| * Interface IManager | ||
| * | ||
| * @package OCP\Dashboard | ||
| * @since 20.0.0 | ||
| */ | ||
| interface IManager { | ||
|
|
||
| /** | ||
| * @param IPanel $panel | ||
| * @since 20.0.0 | ||
juliusknorr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| public function registerPanel(IPanel $panel): void; | ||
|
|
||
| /** | ||
| * @since 20.0.0 | ||
| * | ||
| * @return IPanel[] | ||
| */ | ||
| public function getPanels(): array; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <?php | ||
| /** | ||
| * @copyright Copyright (c) 2020 Julius Härtl <[email protected]> | ||
| * | ||
| * @author Julius Härtl <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace OCP\Dashboard; | ||
|
|
||
| /** | ||
| * Interface IPanel | ||
| * | ||
| * @package OCP\Dashboard | ||
| * @since 20.0.0 | ||
| */ | ||
| interface IPanel { | ||
|
|
||
| /** | ||
| * @return string | ||
| * @since 20.0.0 | ||
| */ | ||
| public function getId(): string; | ||
|
|
||
| /** | ||
| * @return string | ||
| * @since 20.0.0 | ||
| */ | ||
| public function getTitle(): string; | ||
|
|
||
| /** | ||
| * @return int | ||
| * @since 20.0.0 | ||
| */ | ||
| public function getOrder(): int; | ||
|
|
||
| /** | ||
| * @return string | ||
| * @since 20.0.0 | ||
| */ | ||
| public function getIconClass(): string; | ||
juliusknorr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @return string The absolute path to an icon in SVG | ||
| * @since 20.0.0 | ||
| */ | ||
| public function getIconUrl(): string; | ||
|
|
||
| /** | ||
| * @return string The absolute url to the apps own view | ||
| * @since 20.0.0 | ||
| */ | ||
| public function getUrl(): string; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <?php | ||
| /** | ||
| * @copyright Copyright (c) 2020 Julius Härtl <[email protected]> | ||
| * | ||
| * @author Julius Härtl <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace OCP\Dashboard; | ||
|
|
||
| use OCP\EventDispatcher\Event; | ||
|
|
||
| /** | ||
| * Class IRegisterPanelEvent | ||
| * | ||
| * @package OCP\Dashboard | ||
| * @since 20.0.0 | ||
| */ | ||
| class IRegisterPanelEvent extends Event { | ||
| private $manager; | ||
|
|
||
| public function __construct(IManager $manager) { | ||
| parent::__construct(); | ||
|
|
||
| $this->manager = $manager; | ||
| } | ||
|
|
||
| /** | ||
| * @param IPanel $panel | ||
| * @since 20.0.0 | ||
| */ | ||
| public function registerPanel(IPanel $panel) { | ||
juliusknorr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| $this->manager->registerPanel($panel); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.