diff --git a/lizmap/definitions/definitions.py b/lizmap/definitions/definitions.py index 198e8f13..6480aa82 100755 --- a/lizmap/definitions/definitions.py +++ b/lizmap/definitions/definitions.py @@ -116,7 +116,7 @@ def find(cls, status_string: str): for status in cls.__members__.values(): if str(status.value).lower() == status_string: return status - return None + return ReleaseStatus.Unknown @unique diff --git a/lizmap/definitions/lizmap_cloud.py b/lizmap/definitions/lizmap_cloud.py index 2c659674..579c18da 100644 --- a/lizmap/definitions/lizmap_cloud.py +++ b/lizmap/definitions/lizmap_cloud.py @@ -9,6 +9,7 @@ CLOUD_ONLINE_URL = 'https://docs.lizmap.cloud' CLOUD_ONLINE_LANGUAGES = ('en', 'fr') +# TODO Fixme, the minimum version recommended varies on the LWC version CLOUD_QGIS_MIN_RECOMMENDED = (3, 28, 0) UPLOAD_EXTENSIONS = ('fgb', 'gpkg', 'xlsx', 'xls', 'csv', 'ods', 'kml', 'geojson') diff --git a/lizmap/plugin.py b/lizmap/plugin.py index 8fd05410..e250acf9 100755 --- a/lizmap/plugin.py +++ b/lizmap/plugin.py @@ -3591,7 +3591,19 @@ def project_config_file( target_status = ReleaseStatus.Unknown if is_lizmap_cloud(server_metadata): - if self.dlg.current_server_info(ServerComboData.LwcBranchStatus.value) == ReleaseStatus.Retired: + eol = (ReleaseStatus.Retired, ReleaseStatus.SecurityBugfixOnly) + if self.dlg.current_server_info(ServerComboData.LwcBranchStatus.value) in eol: + if self.dlg.current_server_info(ServerComboData.LwcBranchStatus.value) == ReleaseStatus.Retired: + msg = tr( + 'This version of Lizmap Web Client has now reached its end of life ' + 'and is not supported anymore.' + ) + else: + msg = tr( + 'This version of Lizmap Web Client has nearly reached its end of life as it is in ' + 'security bugfix mode. Only critical bugfix are added and soon the ' + 'branch will be declared end of life.' + ) QMessageBox.warning( self.dlg, CLOUD_NAME, @@ -3603,11 +3615,14 @@ def project_config_file( lwc_version=lwc_version.value, ) + "

" + + msg + + "

" + + "" + tr( - 'This version of Lizmap Web Client has now reached its end of life and is not supported ' - 'anymore. Please visit your administration panel in your web browser, in the dashboard, and ' + 'Please visit your administration panel in your web browser, in the dashboard, and ' 'ask for the update.' ) + + "" + "

" + tr( 'You might have some old project which need an update from you. The list is written on the ' diff --git a/lizmap/test/test_definitions.py b/lizmap/test/test_definitions.py index 5424807a..a299ec45 100644 --- a/lizmap/test/test_definitions.py +++ b/lizmap/test/test_definitions.py @@ -46,3 +46,4 @@ def test_release_status(self): self.assertEqual(ReleaseStatus.SecurityBugfixOnly, ReleaseStatus.find('security_bugfix_only')) self.assertEqual(ReleaseStatus.ReleaseCandidate, ReleaseStatus.find('feature_freeze')) self.assertEqual(ReleaseStatus.Stable, ReleaseStatus.find('stable')) + self.assertEqual(ReleaseStatus.Unknown, ReleaseStatus.find('i_dont_know')) diff --git a/lizmap/version_checker.py b/lizmap/version_checker.py index edaaddec..b9895291 100755 --- a/lizmap/version_checker.py +++ b/lizmap/version_checker.py @@ -5,8 +5,6 @@ import json import logging -from typing import Tuple - from qgis.core import Qgis, QgsNetworkContentFetcher from qgis.PyQt.QtCore import QDate, QLocale, QUrl @@ -71,38 +69,6 @@ def request_finished(self): with open(lizmap_user_folder().joinpath("released_versions.json"), "w") as output: output.write(content) - @classmethod - def version_status(cls, status: str) -> Tuple[ReleaseStatus, str]: - """ Return the release status according to the JSON content. """ - if status == 'dev': - flag = ReleaseStatus.Dev - elif status == 'feature_freeze': - flag = ReleaseStatus.ReleaseCandidate - elif status == 'stable': - flag = ReleaseStatus.Stable - elif status == 'retired': - flag = ReleaseStatus.Retired - else: - flag = ReleaseStatus.Unknown - - return flag, cls.status_display_string(flag) - - @classmethod - def status_display_string(cls, status: ReleaseStatus) -> str: - """ Return a human display string status. """ - if status == ReleaseStatus.Dev: - return tr('Next') - elif status == ReleaseStatus.ReleaseCandidate: - return tr('Feature freeze') - elif status == ReleaseStatus.Stable: - return tr('Stable') - elif status == ReleaseStatus.Retired: - return tr('Not maintained') - elif status is None or status == ReleaseStatus.Unknown: - return tr('Inconnu') - else: - raise Exception('Unknown status type : {}'.format(status)) - def update_lwc_servers(self, released_versions: dict): """ Update LWC version status for each server. """ for index in range(self.dialog.server_combo.count()): @@ -120,7 +86,7 @@ def update_lwc_servers(self, released_versions: dict): if lwc_version != version: continue - flag, suffix = self.version_status(json_version.get('status')) + flag = ReleaseStatus.find(json_version.get('status')) self.dialog.server_combo.setItemData(index, flag, ServerComboData.LwcBranchStatus.value) def update_lwc_releases(self, released_versions: dict):