Repository navigation
mediaviewer: add state to urls - #3294
Conversation
|
it would also be nice to scroll to the last opened file when closing, this comment hints their might be code to achieve that already: #3184 (comment) Can anyone point me to it? |
kulmann
left a comment
There was a problem hiding this comment.
We already talked about the general direction in private: first of all it's awesome that you brought the app back to life. Second I personally think (like you) that it's very important to map certain aspects of the current state to the URL, and that's definitely the case for the active file in the mediaviewer. Users want to be able to refresh the page on that. So, big 👍 for all of this. I personally would like to have more context data available in core directly, but this in nothing to be addressed in this PR. I left some comments for improvement and also solved scrolling to the active file when closing to the app and going back to the files app (provided in a comment). We're using the path npm package in core, so you can use it to make some more file and folder related lines of this PR easier / more readable.
Thanks for the good work so far!
Since we can't reach mixins from different apps, one option could be to bring this to store. That is however not such a nice solution. If you feel like this would be something really used often we could move it into the owncloud-sdk or as a core plugin. |
I'm not so familiar with how you are doing things in phoenix, but yes, I think this is something that can and probably will be reused over and over again. Basically anything that deals with actual files and folders will need at least parts of it. MediaViewer, PDF Viewer or just look at AllFilesList.vue. davUrl, $_ocFilesFolder_getFolder. It could use my mixin instead by passing in this.$route.name as contextRouteName. |
9ac1720 to
43774f1
Compare
|
Hope I addressed all of the raised concerns :) |
da6e016 to
ff3ee4c
Compare
The problem I'm seeing here is that bringing this to core would seem to me like making core dependent on files app. So bringing this as a core plugin doesn't feel right to me. And since we can't reach mixins from other apps this approach is automatically dismissed as well. So I guess the only solutions we are left with are the sdk or store. Let's raise a ticket for this where we can discuss the best approach and put in the code a TODO with the link to it so we don't block this PR. |
|
LGTM. If @kulmann is also happy with changes I'd say let's merge it 😉 |
kulmann
left a comment
There was a problem hiding this comment.
Please fix console outputs. After that it's good for merge 👍
kulmann
left a comment
There was a problem hiding this comment.
Happy to get this merged now. Thanks for your work!
|
@dschmidt Are you fine with squashing this PR into one commit before the merge? |
|
If that's what you do in this project 🤷 ... usually I like having a proper history, but as there's quite a bit of back and forth here, I can squash, sure. |
Yes, I'm all for a clean history as well, but I don't think that it's worth the effort to do this for your 26 commits. ;-) And having 1 is nicer than having the 26. 😁 |
|
Yeah, well ... squashed :) |
This commit adds context to apps in general and state to the mediaviewer app. It should be considered a first step towards further refactoring for more reuse of code and less boilerplate in apps.
Hey everyone,
I'm sorry this PR addresses a bunch of separate issues/topics at once.
I wanted to figure out what can be done and what is possible in which scope. I would like to discuss the overall approach here, if desired I can send more fine grained PRs for individual aspects.
Commits can obviously still be cleaned up a bit :)
Loader is also obviously a stupid name for the mixin, any better ideas?
I specifically tried to encapsulate all folder loading logic there so it can be reused in other apps, what do you think about that? Where could we put that?
This includes the commit from #3288.
Description
This PR adds state to app routes (i.e. the context from which they were opened and the file they open). They are accessible as
contextRouteNameandfilePath.Moreover it adds a local history to the mediaviewer app, so forward and back buttons work and we can smootly animate between different pictures without transitioning between routes (and to keep the changes somewhat limited in this regard).
Related Issue
Motivation and Context
Apps opened from the files view did not contain state in the url, so F5 is broken. We should either not route to apps or make the urls useful (which I think is a pretty good idea for webapps anyway).
How Has This Been Tested?
I tested local files, favorites and public links.
Navigating to a folder, opening pictures, clicking prev and next, using the forward and back buttons in the browser works as expected, I could not break it or find any behavior that I did not expect...
shares don't allow me to open apps, so not tested.
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: