-
Notifications
You must be signed in to change notification settings - Fork 282
about/index.php: Add message if database connection fail #5356
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,9 @@ | |
| use ipl\Html\Text; | ||
| use ipl\Web\Compat\CompatController; | ||
| use ipl\Web\Widget\ActionLink; | ||
| use ipl\Web\Widget\Icon; | ||
| use ipl\Web\Widget\Link; | ||
| use Throwable; | ||
|
|
||
| class MigrationsController extends CompatController | ||
| { | ||
|
|
@@ -55,24 +58,48 @@ public function indexAction(): void | |
|
|
||
| $migrateListForm = new MigrationForm(); | ||
| $migrateListForm->setAttribute('id', $this->getRequest()->protectId('migration-form')); | ||
| $migrateListForm->setRenderDatabaseUserChange(! $mm->validateDatabasePrivileges()); | ||
| try { | ||
| $migrateListForm->setRenderDatabaseUserChange(! $mm->validateDatabasePrivileges()); | ||
|
|
||
| if ($canApply && $mm->hasPendingMigrations()) { | ||
| $migrateAllButton = new SubmitButtonElement(sprintf('migrate-%s', DbMigrationHook::ALL_MIGRATIONS), [ | ||
| if ($canApply && $mm->hasPendingMigrations()) { | ||
| $migrateAllButton = new SubmitButtonElement(sprintf('migrate-%s', DbMigrationHook::ALL_MIGRATIONS), [ | ||
| 'form' => $migrateListForm->getAttribute('id')->getValue(), | ||
| 'label' => $this->translate('Migrate All'), | ||
| 'title' => $this->translate('Migrate all pending migrations') | ||
| ]); | ||
| ]); | ||
|
|
||
| // Is the first button, so will be cloned and that the visible | ||
| // button is outside the form doesn't matter for Web's JS | ||
| $migrateListForm->registerElement($migrateAllButton); | ||
| // Is the first button, so will be cloned and that the visible | ||
| // button is outside the form doesn't matter for Web's JS | ||
| $migrateListForm->registerElement($migrateAllButton); | ||
|
|
||
| // Make sure it looks familiar, even if not inside a form | ||
| $migrateAllButton->setWrapper(new HtmlElement('div', Attributes::create(['class' => 'icinga-controls']))); | ||
| // Make sure it looks familiar, even if not inside a form | ||
| $migrateAllButton->setWrapper( | ||
| new HtmlElement('div', Attributes::create(['class' => 'icinga-controls'])) | ||
| ); | ||
|
|
||
| $this->controls->getAttributes()->add('class', 'default-layout'); | ||
| $this->addControl($migrateAllButton); | ||
| $this->controls->getAttributes()->add('class', 'default-layout'); | ||
| $this->addControl($migrateAllButton); | ||
| } | ||
| } catch (Throwable $e) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure you need to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given your specific error message, re-consider your caught type. (Throwable) |
||
| $this->addContent( | ||
| new HtmlElement( | ||
| 'div', | ||
| new Attributes(['class' => 'db-connection-warning']), | ||
| new Icon('warning'), | ||
| new HtmlElement('ul', null), | ||
| new HtmlElement( | ||
| 'p', | ||
| null, | ||
| new Text($this->translate( | ||
| 'No Configuration Database selected. ' | ||
| . 'To establish a valid database connection set the Configuration Database field.' | ||
| )), | ||
| new HtmlElement('ul', null), | ||
| new Link($this->translate('Configuration Database'), 'config/general') | ||
| ) | ||
| ) | ||
| ); | ||
| return; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if the framework has no configuration DB to migrate:
|
||
| } | ||
|
|
||
| $this->handleFormatRequest($mm->toArray()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,10 +4,15 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace Icinga\Controllers; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use Icinga\Common\Database; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use Icinga\Web\Notification; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use Icinga\Web\RememberMe; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use Icinga\Web\RememberMeUserDevicesList; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use ipl\Html\Attributes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use ipl\Html\HtmlElement; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use ipl\Html\Text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use ipl\Web\Compat\CompatController; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use ipl\Web\Widget\Icon; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use ipl\Web\Widget\Link; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use Throwable; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * MyDevicesController | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -49,6 +54,42 @@ public function init() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function indexAction() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $this->getDb(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (Throwable $e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $hasConfigPermission = $this->hasPermission('config/*'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $configLink = new HtmlDocument(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($hasConfigPermission) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $warningMessage = $this->translate( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'No Configuration Database selected.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| . 'To establish a valid database connection set the Configuration Database field.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $configLink = new Link($this->translate('Configuration Database'), 'config/general'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $warningMessage = $this->translate( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'No Configuration Database selected.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| . 'You don`t have permission to change this setting. Please contact an administrator.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $this->addContent( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new HtmlElement( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'div', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new Attributes(['class' => 'db-connection-warning']), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new Icon('warning'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new HtmlElement( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'p', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Text::create($warningMessage), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $configLink | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+60
to
+88
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I have changed the message and also included the link within the message, which made more sense to me. Also, add |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $name = $this->auth->getUser()->getUsername(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $data = (new RememberMeUserDevicesList()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -57,12 +98,6 @@ public function indexAction() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ->setUrl('my-devices/delete'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $this->addContent($data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (! $this->hasDb()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Notification::warning( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $this->translate("Users can't stay logged in without a database configuration backend") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public function deleteAction() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,9 +3,11 @@ | |||||||||
|
|
||||||||||
| namespace Icinga\Forms\Config\General; | ||||||||||
|
|
||||||||||
| use Icinga\Application\Config; | ||||||||||
| use Icinga\Application\Icinga; | ||||||||||
| use Icinga\Data\ResourceFactory; | ||||||||||
| use Icinga\Web\Form; | ||||||||||
| use ipl\Html\Text; | ||||||||||
|
|
||||||||||
| /** | ||||||||||
| * Configuration form for general application options | ||||||||||
|
|
@@ -100,6 +102,17 @@ public function createElements(array $formData) | |||||||||
| ) | ||||||||||
| ); | ||||||||||
|
|
||||||||||
| $config = Config::app()->getSection('global'); | ||||||||||
| if (! isset($config->config_resource)) { | ||||||||||
| $this->warning( | ||||||||||
| $this->translate( | ||||||||||
| 'No Configuration Database selected.' | ||||||||||
| . 'Please set the field to establish a valid database connection.' | ||||||||||
|
Comment on lines
+109
to
+110
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| ), | ||||||||||
| false | ||||||||||
| ); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| return $this; | ||||||||||
| } | ||||||||||
| } | ||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |||||||||
| use Icinga\Web\Session; | ||||||||||
| use Icinga\Web\StyleSheet; | ||||||||||
| use ipl\Html\HtmlElement; | ||||||||||
| use ipl\Html\Text; | ||||||||||
| use ipl\I18n\GettextTranslator; | ||||||||||
| use ipl\I18n\Locale; | ||||||||||
| use ipl\I18n\StaticTranslator; | ||||||||||
|
|
@@ -185,7 +186,16 @@ public function createElements(array $formData) | |||||||||
| false | ||||||||||
| ); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| $config = Config::app()->getSection('global'); | ||||||||||
JolienTrog marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| if (! isset($config->config_resource)) { | ||||||||||
| $this->warning( | ||||||||||
| $this->translate( | ||||||||||
| 'No Configuration Database selected.' | ||||||||||
| . 'To establish a valid database connection set the Configuration Database field.' | ||||||||||
|
Comment on lines
+193
to
+194
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I am curious why the link to set the configuration database was not included here like in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe there’s a small mistake in the suggested text. The correct version should be: “The configuration database has not been selected.”
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You are right, use the correct version has you have mentioned.
Good question, I will look into it and will let you know if this is possible :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JolienTrog, easiest way is to add an EmptyState widget directly in the view script |
||||||||||
| ), | ||||||||||
| false | ||||||||||
| ); | ||||||||||
| } | ||||||||||
| $themeFile = StyleSheet::getThemeFile(Config::app()->get('themes', 'default')); | ||||||||||
| if (! (bool) Config::app()->get('themes', 'disabled', false)) { | ||||||||||
| $themes = Icinga::app()->getThemes(); | ||||||||||
|
|
@@ -439,7 +449,7 @@ public function addSubmitButton() | |||||||||
|
|
||||||||||
| public function isSubmitted() | ||||||||||
| { | ||||||||||
| if (parent::isSubmitted()) { | ||||||||||
| if (($this->getElement('btn_submit') !== null ) && parent::isSubmitted()) { | ||||||||||
| return true; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,10 @@ | ||||||||||||||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| use Icinga\Application\Config; | ||||||||||||||||||||||||||||||||||||||
| use Icinga\Application\MigrationManager; | ||||||||||||||||||||||||||||||||||||||
| use Icinga\Web\Navigation\Renderer\BadgeNavigationItemRenderer; | ||||||||||||||||||||||||||||||||||||||
| use ipl\Html\HtmlElement; | ||||||||||||||||||||||||||||||||||||||
| use ipl\Web\Widget\EmptyState; | ||||||||||||||||||||||||||||||||||||||
| use ipl\Web\Widget\Icon; | ||||||||||||||||||||||||||||||||||||||
| use ipl\Web\Widget\StateBadge; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -93,8 +95,6 @@ use ipl\Web\Widget\StateBadge; | |||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||
| ?> | ||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| <?php | ||||||||||||||||||||||||||||||||||||||
| $mm = MigrationManager::instance(); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -104,10 +104,36 @@ use ipl\Web\Widget\StateBadge; | |||||||||||||||||||||||||||||||||||||
| } catch (Throwable $e) { | ||||||||||||||||||||||||||||||||||||||
| // suppress | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| if ($hasPending): ?> | ||||||||||||||||||||||||||||||||||||||
| <div class="pending-migrations clearfix"> | ||||||||||||||||||||||||||||||||||||||
| <h2><?= $this->translate('Pending Migrations') ?></h2> | ||||||||||||||||||||||||||||||||||||||
| <table class="name-value-table migrations"> | ||||||||||||||||||||||||||||||||||||||
| ?> | ||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||
| <?php $config = Config::app()->getSection('global') ?> | ||||||||||||||||||||||||||||||||||||||
| <div class="pending-migrations clearfix"> | ||||||||||||||||||||||||||||||||||||||
| <?php if($mm->getPendingMigrations() || (!isset($config->config_resource))) : ?> | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We usually add a space after the ! (not) operator for readability. |
||||||||||||||||||||||||||||||||||||||
| <h2><?= $this->translate('Pending Migrations') ?></h2> | ||||||||||||||||||||||||||||||||||||||
| <?php endif ?> | ||||||||||||||||||||||||||||||||||||||
| <table > | ||||||||||||||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||||||||||||||
| <th> | ||||||||||||||||||||||||||||||||||||||
| <?php if (!isset($config->config_resource)) : ?> | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We usually add a space after the ! (not) operator for readability. |
||||||||||||||||||||||||||||||||||||||
| <?= new EmptyState( | ||||||||||||||||||||||||||||||||||||||
| $this->translate('No Configuration Database selected. To establish a valid database connection set: ') | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
| ?><td> | ||||||||||||||||||||||||||||||||||||||
| <?= $this->qlink( | ||||||||||||||||||||||||||||||||||||||
| $this->translate('Configuration Database'), | ||||||||||||||||||||||||||||||||||||||
| 'config/general/', | ||||||||||||||||||||||||||||||||||||||
| [], | ||||||||||||||||||||||||||||||||||||||
| ['title' => sprintf($this->translate('Go to Application/General')), 'Configuration Database'] | ||||||||||||||||||||||||||||||||||||||
| ) ?> | ||||||||||||||||||||||||||||||||||||||
| </td> | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+119
to
+129
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In other parts of the code,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to check why this is happening. The issue appears to be caused by the current CSS rules, which are preventing the links from displaying on the same line. Consider updating the layout properties that are causing this.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It provides a straightforward way to include the link in the EmptyState widget. Hence, you could use it here. |
||||||||||||||||||||||||||||||||||||||
| <?php endif ?> | ||||||||||||||||||||||||||||||||||||||
| </th> | ||||||||||||||||||||||||||||||||||||||
| </tr> | ||||||||||||||||||||||||||||||||||||||
| </table> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| <?php if ($hasPending): ?> | ||||||||||||||||||||||||||||||||||||||
| <table class="name-value-table migrations"> | ||||||||||||||||||||||||||||||||||||||
| <?php foreach ($mm->getPendingMigrations() as $migration): ?> | ||||||||||||||||||||||||||||||||||||||
| <tr> | ||||||||||||||||||||||||||||||||||||||
| <th><?= $this->escape($migration->getName()) ?></th> | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| .db-connection-warning { | ||
| border-radius: .25em; | ||
| display: flex; | ||
| align-items: center; | ||
| margin: 0 0 1em 0; | ||
| padding: 1em 1em; | ||
| background-color: fade(#ffaa44, 40%); | ||
| color: #fff; | ||
|
|
||
| p { | ||
| margin: 0; | ||
| align-items: center; | ||
| } | ||
|
|
||
| a { | ||
| margin: 0; | ||
| align-items: center; | ||
| margin-left: .5em; | ||
| color: #00c3ed; | ||
| } | ||
|
|
||
| i { | ||
| font-size: 2em; | ||
|
|
||
| opacity: .4; | ||
| align-self: flex-start; | ||
| } | ||
|
|
||
| ul { | ||
| list-style: none; | ||
| } | ||
| } |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you need this variable
$hasPending.I don't see this variable used anywhere. In the try block, you're assigning it a value, but it's not used afterward. You could consider removing it.