From 1a7937fe4e3f02faeae99f97a033d3dbf1a981e7 Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Tue, 1 Oct 2024 19:18:16 +0200 Subject: [PATCH] Add the list of LWC modules when displaying/exporting metadata from the server --- lizmap/dialogs/main.py | 4 ++-- lizmap/server_lwc.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lizmap/dialogs/main.py b/lizmap/dialogs/main.py index 8ffa29d4..ef353b23 100755 --- a/lizmap/dialogs/main.py +++ b/lizmap/dialogs/main.py @@ -1168,7 +1168,7 @@ def safeguards_to_markdown(self) -> str: """ Export the list of safeguards to markdown. """ text = '
\n' text += 'List of safeguards :\n' - text += '
\n\n' + text += '
\n' text += '* Mode : {}\n'.format('normal' if self.radio_normal.isChecked() else 'safe') text += '* Allow parent folder : {}\n'.format('yes' if self.radio_allow_parent_folder.isChecked() else 'no') if self.radio_allow_parent_folder.isChecked(): @@ -1178,7 +1178,7 @@ def safeguards_to_markdown(self) -> str: text += '* Prevent PG Auth DB : {}\n'.format('yes' if self.safe_pg_auth_db.isChecked() else 'no') text += '* Force PG user&pass : {}\n'.format('yes' if self.safe_pg_user_password.isChecked() else 'no') text += '* Prevent ECW : {}\n'.format('yes' if self.safe_ecw.isChecked() else 'no') - text += '
' + text += '\n' return text def save_settings(self): diff --git a/lizmap/server_lwc.py b/lizmap/server_lwc.py index 90c5a105..fad699bc 100755 --- a/lizmap/server_lwc.py +++ b/lizmap/server_lwc.py @@ -685,6 +685,8 @@ def request_finished(self, row: int): markdown += '* Py-QGIS-Server : {}\n'.format(py_qgis_version) for plugin, info in plugins.items(): markdown += '* QGIS Server plugin {} : {}\n'.format(plugin, info['version']) + + markdown += self.modules_to_markdown(content) qgis_cell.setData(Qt.UserRole, markdown) self.update_action_version( lizmap_version, qgis_server_version, row, login, lizmap_cloud=is_lizmap_cloud(content)) @@ -745,6 +747,22 @@ def request_finished(self, row: int): self.server_combo.setItemData(index, markdown, ServerComboData.MarkDown.value) self.update_action_version(lizmap_version, None, row) + @classmethod + def modules_to_markdown(cls, content: dict) -> str: + """ Export the list of LWC modules to markdown. """ + # Available since LWC 3.8.2 + text = '\n
\n' + text += 'List of Lizmap Web Client modules :\n' + text += '
\n' + modules = content.get("modules") + if modules: + for module, info in modules.items(): + text += f'* {module} : {info['version']}\n' + else: + text += '* Version Lizmap Web Client 3.8 needed\n' + text += '
\n' + return text + @classmethod def existing_json_server_list(cls) -> List: """ Read the JSON file and return its content. """ @@ -1234,6 +1252,11 @@ def show_fonts(self, data: list, alias: str): def display_all_versions(self, data: str): """ Display the markdown in a message box. """ data = data.replace('*', '') + data = data.replace('
', '') + data = data.replace('
', '') + data = data.replace('', '') + data = data.replace('', '') + data = data.replace('
', '') QMessageBox.information( self.parent, tr('Server versions'),