Skip to content

Commit 56793c8

Browse files
committed
fix: resolve review comments
Co-authored-by: Ravi Kumar Kempapura Srinivasa <33730024+raviks789@users.noreply.github.com>
1 parent fe03c03 commit 56793c8

File tree

5 files changed

+50
-51
lines changed

5 files changed

+50
-51
lines changed

application/controllers/MigrationsController.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ public function indexAction(): void
9090
new HtmlElement(
9191
'p',
9292
null,
93-
new Text(
94-
$this->translate(' No Configuration Database selected.
95-
To establish a valid database connection set the Configuration Database field. ')
96-
)
97-
),
98-
new HtmlElement('ul', null),
99-
new Link($this->translate('Configuration Database'), 'config/general/')
93+
new Text($this->translate(
94+
'No Configuration Database selected. '
95+
. 'To establish a valid database connection set the Configuration Database field.'
96+
)),
97+
new HtmlElement('ul', null),
98+
new Link($this->translate('Configuration Database'), 'config/general')
99+
)
100100
)
101101
);
102102
return;

application/controllers/MyDevicesController.php

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,38 @@ public function indexAction()
5858
$this->getDb();
5959
} catch (Throwable $e) {
6060
$hasConfigPermission = $this->hasPermission('config/*');
61+
$configLink = new HtmlDocument();
6162
if ($hasConfigPermission) {
62-
$this->addContent(
63-
new HtmlElement(
64-
'div',
65-
new Attributes(['class' => 'db-connection-warning']),
66-
new Icon('warning'),
67-
new HtmlElement(
68-
'p',
69-
null,
70-
new Text($this->translate(
71-
'No Configuration Database selected.'
72-
. 'To establish a valid database connection set the Configuration Database field.'
73-
))
74-
),
75-
new Link($this->translate('Configuration Database'), 'config/general/')
76-
)
63+
$warningMessage = $this->translate(
64+
'No Configuration Database selected.'
65+
. 'To establish a valid database connection set the Configuration Database field.'
7766
);
67+
68+
$configLink = new Link($this->translate('Configuration Database'), 'config/general');
7869
} else {
79-
$this->addContent(
80-
new HtmlElement(
81-
'div',
82-
new Attributes(['class' => 'db-connection-warning']),
83-
new Icon('warning'),
84-
new HtmlElement(
85-
'p',
86-
null,
87-
new Text($this->translate(
88-
'No Configuration Database selected.'
89-
. 'You don`t have permission to change this setting. Please contact an administrator.'
90-
))
91-
)
92-
)
70+
$warningMessage = $this->translate(
71+
'No Configuration Database selected.'
72+
. 'You don`t have permission to change this setting. Please contact an administrator.'
9373
);
9474
}
75+
76+
$this->addContent(
77+
new HtmlElement(
78+
'div',
79+
new Attributes(['class' => 'db-connection-warning']),
80+
new Icon('warning'),
81+
new HtmlElement(
82+
'p',
83+
null,
84+
Text::create($warningMessage),
85+
),
86+
$configLink
87+
)
88+
);
89+
9590
return;
9691
}
92+
9793
$name = $this->auth->getUser()->getUsername();
9894

9995
$data = (new RememberMeUserDevicesList())

application/forms/Config/General/ApplicationConfigForm.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,14 @@ public function createElements(array $formData)
103103
);
104104

105105
$config = Config::app()->getSection('global');
106-
if (!isset($config->config_resource)) {
107-
$missingConfigResource =
108-
Text::create(
109-
$this->translate("No Configuration Database selected.
110-
Please set the field to establish a valid database connection.")
111-
);
112-
$this->warning($missingConfigResource, false);
106+
if (! isset($config->config_resource)) {
107+
$this->warning(
108+
$this->translate(
109+
'No Configuration Database selected.'
110+
. 'Please set the field to establish a valid database connection.'
111+
),
112+
false
113+
);
113114
}
114115

115116
return $this;

application/forms/PreferenceForm.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,14 @@ public function createElements(array $formData)
187187
);
188188
}
189189
$config = Config::app()->getSection('global');
190-
if (!isset($config->config_resource)) {
191-
$missingConfigResource =
192-
Text::create($this->translate(
190+
if (! isset($config->config_resource)) {
191+
$this->warning(
192+
$this->translate(
193193
'No Configuration Database selected.'
194194
. 'To establish a valid database connection set the Configuration Database field.'
195-
));
196-
$this->warning($missingConfigResource, false);
195+
),
196+
false
197+
);
197198
}
198199
$themeFile = StyleSheet::getThemeFile(Config::app()->get('themes', 'default'));
199200
if (! (bool) Config::app()->get('themes', 'disabled', false)) {

application/views/scripts/about/index.phtml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ use ipl\Web\Widget\StateBadge;
117117
<th>
118118
<?php if (!isset($config->config_resource)) : ?>
119119
<?= new EmptyState(
120-
$this->translate('No Configuration Database selected. To establish a valid database connection set: '))
120+
$this->translate('No Configuration Database selected. To establish a valid database connection set: ')
121+
)
121122
?><td>
122123
<?= $this->qlink(
123124
$this->translate('Configuration Database'),
124125
'config/general/',
125-
array('name' => ('Configuration Database')),
126-
array('title' => sprintf($this->translate('Go to Application/General')), 'Configuration Database')
126+
[],
127+
['title' => sprintf($this->translate('Go to Application/General')), 'Configuration Database']
127128
) ?>
128129
</td>
129130
<?php endif ?>

0 commit comments

Comments
 (0)