Skip to content

Commit

Permalink
update #570
Browse files Browse the repository at this point in the history
- Condition to disallow deletion of app default dashboard.
  • Loading branch information
oyeaussie committed Sep 2, 2024
1 parent 2d6be2c commit 7fe3be9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ public function removeDashboard(array $data)
throw new PermissionDeniedException;
}

if (isset($this->apps->getAppInfo()['settings']['defaultDashboard'])) {
if ($this->apps->getAppInfo()['settings']['defaultDashboard'] == $dashboard['id']) {
$this->addResponse('Cannot remove app default dashboard', 1);

return false;
}
}

//Remove widgets
$widgets = $this->getDashboardWidgets(['dashboard_id' => $data['id']]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ function (
$dispatcher,
\Exception $exception
) use ($errorComponent, $namespace) {
$dispatcher->getDi()->getShared('logger')->logExceptions->critical(json_trace($exception));
if ($dispatcher->getDi()->getShared('logger')->logExceptions) {
$dispatcher->getDi()->getShared('logger')->logExceptions->critical(json_trace($exception));
}

if (!str_contains($exception->getMessage(), 'handler class cannot be loaded')) {//Handle any other exceptions, like variable not found, etc
$class = (new \ReflectionClass($exception))->getShortName();
Expand Down

0 comments on commit 7fe3be9

Please sign in to comment.