File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed
Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change 2323
2424namespace OC \Dashboard ;
2525
26+ use InvalidArgumentException ;
2627use OCP \AppFramework \QueryException ;
2728use OCP \Dashboard \IManager ;
2829use OCP \Dashboard \IPanel ;
2930use OCP \ILogger ;
3031use OCP \IServerContainer ;
32+ use Throwable ;
3133
3234class Manager implements IManager {
3335
@@ -46,7 +48,7 @@ public function __construct(IServerContainer $serverContainer) {
4648
4749 private function registerPanel (IPanel $ panel ): void {
4850 if (array_key_exists ($ panel ->getId (), $ this ->panels )) {
49- throw new \ InvalidArgumentException ('Dashboard panel with this id has already been registered ' );
51+ throw new InvalidArgumentException ('Dashboard panel with this id has already been registered ' );
5052 }
5153
5254 $ this ->panels [$ panel ->getId ()] = $ panel ;
@@ -88,6 +90,15 @@ public function loadLazyPanels(): void {
8890 'level ' => ILogger::FATAL ,
8991 ]);
9092 }
93+
94+ try {
95+ $ panel ->load ();
96+ } catch (Throwable $ e ) {
97+ \OC ::$ server ->getLogger ()->logException ($ e , [
98+ 'message ' => 'Error during dashboard panel loading: ' . $ e ->getMessage (),
99+ 'level ' => ILogger::FATAL ,
100+ ]);
101+ }
91102 }
92103 $ this ->lazyPanels = [];
93104 }
Original file line number Diff line number Diff line change 3232interface IPanel {
3333
3434 /**
35- * @return string
35+ * @return string Unique id that identifies the panel, e.g. the app id
3636 * @since 20.0.0
3737 */
3838 public function getId (): string ;
3939
4040 /**
41- * @return string
41+ * @return string User facing title of the panel
4242 * @since 20.0.0
4343 */
4444 public function getTitle (): string ;
4545
4646 /**
47- * @return int
47+ * @return int Initial order for panel sorting
4848 * @since 20.0.0
4949 */
5050 public function getOrder (): int ;
5151
5252 /**
53- * @return string
53+ * @return string css class that displays an icon next to the panel title
5454 * @since 20.0.0
5555 */
5656 public function getIconClass (): string ;
5757
5858 /**
59- * @return string The absolute url to the apps own view
59+ * @return string|null The absolute url to the apps own view
6060 * @since 20.0.0
6161 */
62- public function getUrl (): string ;
62+ public function getUrl (): ?string ;
63+
64+ /**
65+ * Execute panel bootstrap code like loading scripts and providing initial state
66+ * @since 20.0.0
67+ */
68+ public function load (): void ;
6369}
You can’t perform that action at this time.
0 commit comments