mobile icon indicating copy to clipboard operation
mobile copied to clipboard

Use project IDs internaly to manage projects

Open Withalion opened this issue 8 months ago • 2 comments

Fixes #1969

This PR adds foundational work for supporting project IDs in mobile app. Besides issue mentioned above this is preliminary work for #1008, #1102, #576, project renaming etc.

Outline of the changes done:

  • core
    • CoreUtils
      • refactor
      • getFullProjectName(), extractProjectName() has been moved from MerginApi
    • Project
      • LocalProject supports UUID type of IDs + new generateProjectId()
      • MerginProject supports UUID type of IDs + new fullname()
      • LocalProjectsList changed to HashMap LocalProjectsDict with ID as key
    • LocalProjectsManager
      • keeps projects in HashMap
      • delete projectFromMerginName(), it was used only by tests
      • new updateProjectId() necessary function for creating new projects on server ( server returns new ID for already existing projects, app needs to adapt to it)
      • general refactor and move from project fullnames to project IDs as parameters in functions
    • MerginApi
      • general refactor, a lot of the functions are never called from QML for example
      • listProjectsByName() stays until there is v2 endpoint for IDs
      • delete migrateProjectToMergin() just a wrapper for createProject() ( i think it was used just by tests)
      • delete projectDiffableFiles() not used anywhere
      • move getFullProjectName() & extractProjectName() to utils
      • change deleteProject() to use immediate deletion instead of scheduled, we use it only internally for project management
      • remove topic parameter from networkErrorOccured() it was only used by tests (they use http error codes now)
      • new projectIdChanged() signal to trigger update of local project ID to server generated ID
      • new getProjectDetails() it's leaner version of getProjectInfo(), the response won't contain versioning history
      • Transactions now keep projectId as key
      • generally everything what could be, was moved to use project IDs, the synchronization workflow couldn't, so for communication with API we use project names but internally the project ID is propagated and used where possible
      • when a local project is "migrated" to mergin there is new request for new project ID generated on server that is further processed and local ID is changed to match server ID
  • app
    • QML
      • just refactor to support project IDs
    • C++
      • ActiveProject
        • new projectId() to get project ID of active project
      • Main
        • rework to project IDs
      • ProjectsModel
        • replaced listProjectsByName() by fetchProjectsById()
        • reworked slots to use project IDs
        • removed porjectNames(), it was used internally and is not necessary since we moved to IDs
      • ProjectWizard
        • refactor, most importantly moved from deprecated QVariant::type to QMetaType
      • SynchronizationManager
        • keeps synchronization processes by project ID
        • reworked to use project IDs instead of project names
    • Tests
      • mostly refactor & minor changes
      • replaced findProjectByName() with template function
      • moved descriptive inline test function comments to header file or written new ones

Withalion avatar May 06 '25 13:05 Withalion

Pull Request Test Coverage Report for Build 15041670829

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 634 unchanged lines in 14 files lost coverage.
  • Overall coverage increased (+0.3%) to 60.661%

Files with Coverage Reduction New Missed Lines %
input/app/projectwizard.h 1 50.0%
input/core/merginapi.h 1 97.56%
input/core/merginprojectstatusmodel.h 1 0.0%
input/core/project.cpp 1 97.22%
input/app/projectsmodel.h 3 25.0%
input/core/project.h 16 46.15%
input/app/variablesmanager.cpp 19 60.28%
input/core/localprojectsmanager.cpp 21 78.74%
input/core/coreutils.cpp 31 82.61%
input/app/projectsmodel.cpp 41 69.52%
<!-- Total: 634
Totals Coverage Status
Change from base Build 15018608869: 0.3%
Covered Lines: 8202
Relevant Lines: 13521

💛 - Coveralls

github-actions[bot] avatar May 15 '25 09:05 github-actions[bot]

From our discussion earlier today:

For sync: image

For listing downloaded projects: image

tomasMizera avatar Jun 26 '25 10:06 tomasMizera