Skip to content

Commit

Permalink
fix typo, improve html for module view (#4816)
Browse files Browse the repository at this point in the history
* fix typo, improve html for module view

* declare Url repositoryAdmin liz global lizUrl

* plugin homepage must be non empty to do a link

* fix end2end modules line count
  • Loading branch information
nworr authored Oct 1, 2024
1 parent 02f669e commit f23556a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
6 changes: 2 additions & 4 deletions lizmap/modules/admin/lib/ModulesInfo/ModulesChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class ModulesChecker
public function getList($withCore = false)
{
$moduleConfig = \jApp::config()->modules;

// file_get_contents(\jApp::varConfigPath('installer.ini.php'));
$installreRadr = new IniReader(\jApp::varConfigPath('installer.ini.php'));
$installReader = new IniReader(\jApp::varConfigPath('installer.ini.php'));

$enabledModuleName = array();
foreach ($moduleConfig as $paramName => $value) {
Expand All @@ -38,7 +36,7 @@ public function getList($withCore = false)
if ($coreModule && !$withCore) {
continue;
}
$version = $installreRadr->getValue($moduleSlug.'.version', 'modules');
$version = $installReader->getValue($moduleSlug.'.version', 'modules');
$enabledModuleName[] = new ModuleMetaData($moduleSlug, $version, $coreModule);
}
}
Expand Down
12 changes: 8 additions & 4 deletions lizmap/modules/admin/templates/server_information.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,21 @@
{if empty($modules)}
<p>{@admin.server.information.no.module@}</p>
{else}
<table class="table table-condensed table-striped table-bordered table-lizmap-modules">
<table class="table table-condensed table-striped table-bordered table-server-info table-lizmap-modules">
<thead>
<tr>
<th>{@admin.server.information.module@}</th>
<th>{@admin.server.information.module.version@}</th>
</tr>
</thead>
<tbody>
{foreach $modules as $module}
<tr>
<th style='width:20%;'> {$module->slug}</th>
<td style='width:20%;'>{$module->version}</td>
<th>{$module->slug}</th>
<td>{$module->version}</td>
</tr>
{/foreach}
</tbody>
{/if}
</table>

Expand Down Expand Up @@ -167,7 +171,7 @@
{* Fixed in lizmap_server plugin 1.3.2 https://github.com/3liz/qgis-lizmap-server-plugin/commit/eb6a773ba035f877e9fa91db5ef87911a2648ee1 *}
<th style="width:20%;">
{$version['name']}
{if $version['homepage']}
{if array_key_exists('homepage', $version) && $version['homepage']}
<a href="{$version['homepage']}" target="_blank"><span class='badge rounded-pill bg-secondary'>{@admin.server.information.qgis.plugin.help@}</span></a>
{/if}
</th>
Expand Down
4 changes: 4 additions & 0 deletions lizmap/modules/view/controllers/lizMap.classic.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function index()
// Add bottom dock js
$rep->addJSLink($bp.'assets/js/bottom-dock.js', array('defer' => ''));

// TODO : refacto, quite the same URLs are declared in lizAjax.classic.php
// Pass some configuration options to the web page through javascript var
$lizUrls = array(
'params' => array('repository' => $repository, 'project' => $project),
Expand Down Expand Up @@ -224,6 +225,9 @@ function f($x)
$lizUrls['removeCache'] = jUrl::get('admin~maps:removeLayerCache');
}

if (jAcl2::check('lizmap.admin.access') || jAcl2::check('lizmap.admin.server.information.view')) {
$lizUrls['repositoryAdmin'] = jUrl::getFull('admin~maps:index');
}
$webDavProfile = RemoteStorageRequest::getProfile('webdav');
if ($webDavProfile) {
$lizUrls['webDavUrl'] = $webDavProfile['baseUri'];
Expand Down
4 changes: 3 additions & 1 deletion tests/end2end/playwright/server-information.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ test.describe('Server information', () => {
await expect(await lwcRow.locator('td').innerText()).not.toEqual('');
}
// Check that Lizmap modules contains 2 lines (header and 1 module lizmapdemo)
const modulesRows = page.locator('#lizmap_server_information table.table-lizmap-modules tr:nth-child(1n+2)')
const modulesHeadRows = page.locator('#lizmap_server_information table.table-lizmap-modules thead tr');
await expect(modulesHeadRows).toHaveCount(1);
const modulesRows = page.locator('#lizmap_server_information table.table-lizmap-modules tbody tr');
await expect(modulesRows).toHaveCount(1);
for (const row of await modulesRows.all()) {
await modulesRows.scrollIntoViewIfNeeded();
Expand Down

0 comments on commit f23556a

Please sign in to comment.