2020use function ipl \Stdlib \get_php_type ;
2121
2222/**
23- * A pane, displaying different Dashboard dashlets
23+ * A Pane or Dashboard Pane organizes various Dashlets/Views into a single panel
24+ * and can be accessed via the tabs rendered on the upper navigation bar of Icinga Web 2.
2425 */
2526class Pane extends BaseDashboard implements DashboardEntry, Sortable
2627{
@@ -100,6 +101,7 @@ public function loadDashboardEntries(string $name = null)
100101 $ dashlets = Model \Dashlet::on (DBUtils::getConn ())
101102 ->utilize (self ::TABLE )
102103 ->with ('icingaweb_module_dashlet ' );
104+
103105 $ dashlets ->filter (Filter::equal ('dashboard_id ' , $ this ->getUuid ()));
104106
105107 // TODO(yh): Qualify those columns properly??
@@ -166,7 +168,8 @@ public function manageEntry($entryOrEntries, BaseDashboard $origin = null, bool
166168
167169 if (! $ this ->getHome ()) {
168170 throw new \LogicException (
169- 'Dashlets cannot be managed. Please make sure to set the current dashboard home beforehand. '
171+ 'Dashlet(s) cannot be managed without a valid Dashboard Home. Please make sure to set ' .
172+ ' the current dashboard home beforehand. '
170173 );
171174 }
172175
@@ -231,6 +234,8 @@ public function manageEntry($entryOrEntries, BaseDashboard $origin = null, bool
231234 'id = ? ' => $ origin ->getEntry ($ dashlet ->getName ())->getUuid (),
232235 'dashboard_id = ? ' => $ origin ->getUuid ()
233236 ];
237+
238+ $ this ->addEntry ($ dashlet );
234239 }
235240
236241 $ conn ->update (Dashlet::TABLE , [
@@ -246,9 +251,9 @@ public function manageEntry($entryOrEntries, BaseDashboard $origin = null, bool
246251 // Failed to move the pane! Should have already been handled by the caller,
247252 // though I think it's better that we raise an exception here!!
248253 throw new AlreadyExistsException (
249- 'Dashlet "%s" could not be managed . Dashboard Pane "%s" has a Dashlet with the same name ! ' ,
250- $ dashlet ->getTitle (),
251- $ this ->getTitle ()
254+ 'Failed to successfully manage the Dashlet . Dashboard Pane "%s" has already a Dashlet called "%s" ! ' ,
255+ $ this ->getTitle (),
256+ $ dashlet ->getTitle ()
252257 );
253258 }
254259
0 commit comments