Skip to content

Commit

Permalink
Add the list of LWC modules when displaying/exporting metadata from t…
Browse files Browse the repository at this point in the history
…he server
  • Loading branch information
Gustry committed Oct 1, 2024
1 parent 04242be commit 1a7937f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lizmap/dialogs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ def safeguards_to_markdown(self) -> str:
""" Export the list of safeguards to markdown. """
text = '<details>\n'
text += '<summary>List of safeguards :</summary>\n'
text += '<br/>\n\n'
text += '<br/>\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():
Expand All @@ -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 += '</details>'
text += '</details>\n'
return text

def save_settings(self):
Expand Down
23 changes: 23 additions & 0 deletions lizmap/server_lwc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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<details>\n'
text += '<summary>List of Lizmap Web Client modules :</summary>\n'
text += '<br/>\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 += '</details>\n'
return text

@classmethod
def existing_json_server_list(cls) -> List:
""" Read the JSON file and return its content. """
Expand Down Expand Up @@ -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('<details>', '')
data = data.replace('</details>', '')
data = data.replace('<summary>', '')
data = data.replace('</summary>', '')
data = data.replace('<br/>', '')
QMessageBox.information(
self.parent,
tr('Server versions'),
Expand Down

0 comments on commit 1a7937f

Please sign in to comment.