Skip to content

[Refactoring] Replacement of models + QML refactored#1293

Merged
sklencar merged 22 commits intoprojects-model-refactoring-mainfrom
pmr-project-sync
Apr 6, 2021
Merged

[Refactoring] Replacement of models + QML refactored#1293
sklencar merged 22 commits intoprojects-model-refactoring-mainfrom
pmr-project-sync

Conversation

@tomasMizera
Copy link
Collaborator

@tomasMizera tomasMizera commented Mar 31, 2021

QML is refactored, we have new separated components. C++ is updated based on that and also:

  • removed unused/old code
  • removed _future suffix
  • use only new models and structures
  • models are instantiated from QML

Current known issues / Todo in this or next PR:

  • Tests
  • Several UI changes:
    • after auth failed redirection,
    • refresh list immediately after opened from map,
    • refresh more menu items on project status changed,
    • download project on project clicked when not downloaded (but first show modal)
    • uploading project could show pending change in place where it was and after uploaded sorted in list
    • always open on home screen from map
    • connect logout signal to created and shared project types
  • Add texts for no permission and no projects found
Screen_Recording_20210331-131711.mp4

@saberraz
Copy link
Contributor

Under My projects page, can we get rid of the namespace (tomas in your video). This is inline with the Mergin website too:
image

@tomasMizera
Copy link
Collaborator Author

tomasMizera commented Mar 31, 2021

Sure Saber, that is not a problem. Do we want it only in My projects?

@saberraz
Copy link
Contributor

saberraz commented Mar 31, 2021

Correct, as it is clear that it is user's projects. Other pages (Home, Shared with me..) there will be different namespaces and can cause confusion

if ( mProjects[i].projectDir == projectDir )
if ( mProjects[i].id() == projectId )
{
emit aboutToRemoveLocalProject( mProjects[i] );
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that this signal is propagated to ProjectsModel. Does it have some advantage to emit it before project is removed from a disk and local manager's project?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think generally it is good idea to first remove any reference to the project and then actually remove it from device (in case we would want to check if the dir exists or not). Do not have a preference though

InputUtils::log( "list projects", QStringLiteral( "Success - got %1 projects" ).arg( mRemoteProjects.count() ) );
InputUtils::log( "list projects", QStringLiteral( "Success - got %1 projects" ).arg( projectList.count() ) );
}
else
Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, handling if anything goes wrong with fetching projects from Mergin, was deleted (2 places). The previous behaviours is that the model clears data.
To reproduce:

  • fetch shared with me
  • log out
  • try to go to shared with me -> auth request triggers Login page
  • cancel/go back from Login page, you can still see shared with me projects listed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

MerginAPI used to held a separated list of projects which is now gone and after listProjects is finished, it now emits all projects and not care what happens next.
Good idea though, I will connect log out signal to CreatedProjectsModel and SharedProjectsModel types!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added to todo

}
project->mergin->status = ProjectStatus::projectStatus( project );
}
else if ( project->local->localVersion > -1 )
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discuss, this may introduce confusion about remote projects - if they are from different mergin server or they are orphaned. Maybe would be good to set some specific project status for such projects - so a user can see, that they are Mergin projects, but actually cannot sync as usual with current auth session.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that we actually do not need it anymore thanks to this https://github.com/lutraconsulting/input/blob/pmr-project-sync/app/projectsmodel.cpp#L623

I will double check that

@tomasMizera
Copy link
Collaborator Author

@saberraz this is how it looks without namespace. Can be?

image

@tomasMizera tomasMizera requested a review from sklencar April 6, 2021 08:01
@sklencar
Copy link
Contributor

sklencar commented Apr 6, 2021

Merging the PR, some of the remarks will be resolved in the next PR

@sklencar sklencar merged commit cc35f84 into projects-model-refactoring-main Apr 6, 2021
PeterPetrik added a commit that referenced this pull request Apr 12, 2021
This PR contains all parts of refactoring (including all points fixed from #1293 ) and Mergin cpp api.

Commit containing Mergin cpp api: 13dfde6
All other commits contain refactoring. Commits from 557dfd1 contain UI fixes of #1293 + code cleanup and documentation (I tried to separate them ~ one fix = one commit ~ so it should be possible to review them commit by commit).

Versions were also updated to 0.9.3

Resolves #379
Resolves #352
Resolves #1050
Also #1086 (if I understand it correctly, app now shows when project is being uploaded)

Co-authored-by: Peter Petrik <zilolv@gmail.com>
@PeterPetrik PeterPetrik deleted the pmr-project-sync branch April 15, 2021 06:09
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.

4 participants