Dashboard: show DB selection only for setups...

...with multiple DBs
This commit is contained in:
Thomas Gelf 2018-06-23 11:17:56 +02:00
parent e6563b9882
commit 06b6356de1
2 changed files with 11 additions and 3 deletions

View File

@ -10,13 +10,16 @@ class DashboardController extends ActionController
{ {
protected function checkDirectorPermissions() protected function checkDirectorPermissions()
{ {
// No special permissions required, override parent method
} }
protected function addDbSelection() protected function addDbSelection()
{ {
$form = new DbSelectorForm($this->Window(), $this->listAllowedDbResourceNames()); if ($this->isMultiDbSetup()) {
$this->content()->add($form); $form = new DbSelectorForm($this->Window(), $this->listAllowedDbResourceNames());
$form->handleRequest($this->getRequest()); $this->content()->add($form);
$form->handleRequest($this->getRequest());
}
} }
/** /**

View File

@ -66,6 +66,11 @@ trait DirectorDb
return preg_split('/\s*,\s*/', $string, -1, PREG_SPLIT_NO_EMPTY); return preg_split('/\s*,\s*/', $string, -1, PREG_SPLIT_NO_EMPTY);
} }
protected function isMultiDbSetup()
{
return count($this->listAvailableDbResourceNames()) > 1;
}
/** /**
* @return array * @return array
*/ */