Skip to content

Conversation

@KatKatKateryna
Copy link
Collaborator

@KatKatKateryna KatKatKateryna commented Dec 17, 2025

Small improvements:

  • date-to-string and date-from-string functionality is centralized for Diff and Save - no variations in different places. Also 'self._diff_original_and_current_data' will return both boolean and the final data dictionary, so we don't need to call 'asdict_enum_safe' inside of it, and then later again.
  • accept differently formatted datetime strings on Open - when we receive server data it's being received with '+00:00' at the end instead of 'Z'
  • ensure sending utf-8 encoded data to server admin

Remaining issues:

  1. Server admin incorrectly decodes the characters, while payload is encoded and sent correctly from the plugin:
image
  1. Datetime format is being changed on admin side, although we explicitly send correctly formatted strings:
image
  1. Unit tests are missing - can be added through github action forking and deploying pygeoapi server from the official repo.

@doublebyte1
Copy link
Contributor

Small improvements Keeping as draft until other datetime issues are resolved

It seems with your changes the dates are still working fine (thanks for removing the redundant code). Are there any specific use cases where you see the dates failing?

@KatKatKateryna
Copy link
Collaborator Author

Some inconsistent behaviors, checking now 🙏

@KatKatKateryna KatKatKateryna marked this pull request as ready for review December 19, 2025 16:14
@KatKatKateryna
Copy link
Collaborator Author

KatKatKateryna commented Dec 19, 2025

@doublebyte1 finished the edits and adjusted PR description 🙏
P.S. opened related PR in pygeoapi repo: geopython/pygeoapi#2191

Copy link
Contributor

@doublebyte1 doublebyte1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for harmonising the datetime functions, and for the PR in pygeoapi (see my comments there)! 👍🏽

I have pulled and pushed confs from the server and it seems to be working pretty well. Unit tests for the server in the GitHub action are a good idea - let me have a look at that 💯

I noticed a couple of glitches that are not necessarily related to this PR, but I hope you don't mind if I write them here, anyway (:

  • The diff function does not seem to work correctly for the "Resources" section. If I change anything in the resources (for instance, adding a temporal extent, or updating the title), and then save it, it shows me a diff with things that did not change. Example:
{
    "added": {
        "resources.countries.extents.temporal.begin": "2025-12-29T00:00:00Z"
    },
    "removed": {},
    "changed": {
        "resources.countries.description": {
            "old": "Countries of the world (SpatialLite)",
            "new": {
                "en": "Countries of the world (SpatialLite)"
            }
        },
        "resources.countries.keywords": {
            "old": [
                "countries",
                "natural eart"
            ],
            "new": {
                "en": [
                    "countries",
                    "natural eart"
                ]
            }
        },
        "resources.countries.title": {
            "old": "Countries in the world (SpatialLite Provider)",
            "new": {
                "en": "Countries in the world (SpatialLite Provider)"
            }
        }
    }
}
  • Deleting a resource is not triggering a change in the UI, or sending any information to the user that the resource was deleted (although it effectively was). As a consequence, the user may try to delete the resource multiple times throwing a error, because the key does not exist anymore. Example:
    File "/home/joana/.local/share/QGIS/QGIS3/profiles/default/python/plugins/pygeoapi_config/ui_widgets/UiSetter.py", line 592, in preview_resource if isinstance(dialog.config_data.resources[dialog.current_res_name], dict): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'countries'

    My suggestion upon such a delicate operation as deletion, would be to send a confirmation box asking the user if they really want to delete the resource. Upon confirmation, the resource would be deleted, a message would be send to the user with the status of the operation (much like we do on the push configuration to server) and the UI would be refresh to not show that resource anymore.

Thanks again for the great work! 🥇

- add GUI dependencies for (headless) unit tests
@KatKatKateryna
Copy link
Collaborator Author

Thanks @doublebyte1 ! I will check why the UI is not refreshing, and add a confirmation window 👍

Regarding the resources diff, it follows the same behavior as Metadata: converts everything to a dictionary with "en" as a default language. What I noticed before is that the language should instead be read from the Server section, and not default to English.

Nevertheless, we can change this behavior entirely. I can add an empty dropdown option for the language, which upon Save will default the value to list (instead of a dictionary Language: Value). But this will trigger more if/else conditions, like do we use Metadata as a benchmark and make resources follow the format? If Metadata is a list, do we allow Resources to have a dictionary? If a user tries to add an entry with an empty language value, we should only allow it if there are no values yet, etc.

We can do either: just adjust the default language correctly, or change the behavior to allow lists in Metadata and Resources.

@doublebyte1
Copy link
Contributor

Thanks @doublebyte1 ! I will check why the UI is not refreshing, and add a confirmation window 👍

Regarding the resources diff, it follows the same behavior as Metadata: converts everything to a dictionary with "en" as a default language. What I noticed before is that the language should instead be read from the Server section, and not default to English.

Nevertheless, we can change this behavior entirely. I can add an empty dropdown option for the language, which upon Save will default the value to list (instead of a dictionary Language: Value). But this will trigger more if/else conditions, like do we use Metadata as a benchmark and make resources follow the format? If Metadata is a list, do we allow Resources to have a dictionary? If a user tries to add an entry with an empty language value, we should only allow it if there are no values yet, etc.

We can do either: just adjust the default language correctly, or change the behavior to allow lists in Metadata and Resources.

@KatKatKateryna no need to complicate this for the purpose of the diff. I think we can stick to the default language, as you suggested.

@doublebyte1
Copy link
Contributor

Thanks for harmonising the datetime functions, and for the PR in pygeoapi (see my comments there)! 👍🏽

I have pulled and pushed confs from the server and it seems to be working pretty well. Unit tests for the server in the GitHub action are a good idea - let me have a look at that 💯

I noticed a couple of glitches that are not necessarily related to this PR, but I hope you don't mind if I write them here, anyway (:

  • The diff function does not seem to work correctly for the "Resources" section. If I change anything in the resources (for instance, adding a temporal extent, or updating the title), and then save it, it shows me a diff with things that did not change. Example:
{
    "added": {
        "resources.countries.extents.temporal.begin": "2025-12-29T00:00:00Z"
    },
    "removed": {},
    "changed": {
        "resources.countries.description": {
            "old": "Countries of the world (SpatialLite)",
            "new": {
                "en": "Countries of the world (SpatialLite)"
            }
        },
        "resources.countries.keywords": {
            "old": [
                "countries",
                "natural eart"
            ],
            "new": {
                "en": [
                    "countries",
                    "natural eart"
                ]
            }
        },
        "resources.countries.title": {
            "old": "Countries in the world (SpatialLite Provider)",
            "new": {
                "en": "Countries in the world (SpatialLite Provider)"
            }
        }
    }
}
  • Deleting a resource is not triggering a change in the UI, or sending any information to the user that the resource was deleted (although it effectively was). As a consequence, the user may try to delete the resource multiple times throwing a error, because the key does not exist anymore. Example:
    File "/home/joana/.local/share/QGIS/QGIS3/profiles/default/python/plugins/pygeoapi_config/ui_widgets/UiSetter.py", line 592, in preview_resource if isinstance(dialog.config_data.resources[dialog.current_res_name], dict): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'countries'
    My suggestion upon such a delicate operation as deletion, would be to send a confirmation box asking the user if they really want to delete the resource. Upon confirmation, the resource would be deleted, a message would be send to the user with the status of the operation (much like we do on the push configuration to server) and the UI would be refresh to not show that resource anymore.

Thanks again for the great work! 🥇

I created a PR that added the Unit Test (and GitHub action step) for server push and pull here: KatKatKateryna#9

@doublebyte1 doublebyte1 self-requested a review January 2, 2026 11:16
@doublebyte1
Copy link
Contributor

doublebyte1 commented Jan 2, 2026

@KatKatKateryna could you merge KatKatKateryna#9 before I merge this? 🙏🏽

@KatKatKateryna
Copy link
Collaborator Author

@doublebyte1 all edits done, server-tests PR merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants