Skip to content

Remove hardcoded UI logic in app restoration over existing instance #7843

@DavidePrincipi

Description

@DavidePrincipi

Currently, the replaceExistingDisabled function in the RestoreSingleInstanceModal Vue component (see ns8-core, core/ui/src/components/backup/RestoreSingleInstanceModal.vue) uses a hardcoded array of module names to determine whether an app can be restored over an existing instance. This is flagged with a FIXME in the code. A more robust and maintainable solution would be to obtain this information from the backend API, rather than hardcoding it in the UI.

Proposed solution

  • Extend (or add) a backend API that returns whether a given module can be replaced/restored over an existing one.
  • The UI should use this API to determine the eligibility, removing the hardcoded restriction in the Vue component.
  • Ideally, the API should return this eligibility together with the other module or instance data required during restoration.
  • If one of the APIs already invoked in RestoreSingleInstanceModal (e.g., list-modules, determine-restore-eligibility, etc.) could be extended to return this information, it should be preferred.

Alternative solutions

  • Continue maintaining the hardcoded list in the UI (not recommended: leads to bugs, inconsistent behavior, and technical debt).
  • Move the logic to a configuration file shipped with the frontend (still suboptimal versus API-driven approach).

Additional context
See the FIXME in RestoreSingleInstanceModal.vue, function replaceExistingDisabled. The modules currently hardcoded are: ["samba", "loki", "mail", "ejabberd", "nethvoice-proxy"].

The backend should provide a reliable, maintainable source of truth.

See also


Thanks to @stephdl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    ToDo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions