-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add OCA.Files.Settings for Files navigation settings #18556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Cool 👍 Is the text app still able to inject or is a update required? |
|
You're welcome :) @skjnldsv whistle files to vue 😁 |
YES 😃!!!
The Text app would need an update to use the new API. |
2e00c62 to
637d434
Compare
|
Thanks for looking into this! As with the sidebar, my gut feeling tells we we shouldn't make this a Vue-specific API but one that works with any framework. Yes, right now Vue is our main tool, but so was jQuery and Backbone and now we have to deal with legacy APIs that are bound to these libraries. There is no perfect API that works forever, but we can try to make it as flexible as possible. Thus I would like to propose that we make this framework-agnostic and don't reply on a component passed. One thing that I had in mind with the sidebar as well is that if you register X (sidebar, settings, whatever) you get a mounted DOM element back. And then you simply render your UI into this element. So, as someone who wants to adds a custom settings to files, I do something like const el = OCA.Files.Settings.register('recommendations')
const view = Vue.extend(...).mount(el)^ that should work with most frameworks and isn't much less convenient to use. It even has the advantage that creating the component is done by your app and not the server Vue instance, hence you get Hope this makes sense. I won't be around much the next few days, but I'll happily discuss this next year :) |
With this you leave the mount mechanism to the app's management, but the app might not know the current settings status. I could therefore do it differently, OCA.Files.Settings.register('recommendations', function() {
return new Vue({...}).$el
})And then every time the Settings would change it can generate the whole data itself by requesting a new instance of the registered Settings? |
|
lol, yes, that was the simplified version. I had pretty much the same in mind for cases where you need more context information. Maybe with an object, though OCA.Files.Settings.register('recommendations', {
open: () => {...},
close: () => {...},
})^ allows separation of different events. A single callback would either have a single purpose for which it's called or you need to pass in this information as parameter. If you use the object style then in server you even know which callbacks are provided, should you need that information. I'm not sure if we should return a new element every time a callback is invoked. |
|
Alright, let's go with a more framework agnostic one! For the sidebar, it definitely would make sense to have different events but I don't think that's necessary for the settings for which it's usually a mount then done thing. Could just make it so that, at least for settings, only OCA.Files.Settings.register('recommendations', {
el: () => {new (Vue.extend(Settings)).$mount(document.createElement('div')).$el}
});Also, cc @juliushaertl for Text app rich workspace enabled setting. EDIT: Just thinking, it may also make sense to have a |
Let's keep the settings independent from the current directory. Otherwise it would be confusing if they are sometimes there and sometimes not. 😉 |
No, you don't need to mount or do anything, this is exactly what @ChristophWurst suggested :) The close would just be unmounting stuff, and we could possibly need this as we might have different settings for different files views? (sharing, deleted files...) Now that I think of it, why are you all using Vue.extend instead of creating a new Vue instance? I feel like I'm missing something :) |
Oh wait, new (Vue.extend(Settings)).$mount().$elalso works doesn't it. 🙈
Oh, that makes sense, although it should be possible to unmount without needing that to be handled for most cases? Still can't hurt to have it available. It may make sense to have options Sorry if I'm misunderstanding something. |
seems about right :)
Can you? I never seen the I just found this: https://forum.vuejs.org/t/what-is-the-relation-or-difference-between-vue-instance-and-vue-component-instance/12439/2 The difference is than from 1.x to vue 2.x, they removed the option to use |
9212bc4 to
b45e22e
Compare
cb96515 to
27b6aa1
Compare
27b6aa1 to
05e43c3
Compare
0434a25 to
1639a16
Compare
1639a16 to
6ef0fb4
Compare
6ef0fb4 to
3371ad8
Compare
ChristophWurst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works instantly, really nice! :)
Just suggested a slight wording change over in the Recommendations pull request: nextcloud/recommendations#168
And only a small request here: Is it possible to change the order so that "Show hidden files" is last? Then it is:
- Show rich workspaces
- Show recommendations
- Show hidden files
And it corresponds to the order these elements show in the actual files view.
ae4f521 to
d2b833d
Compare
d2b833d to
7cc9a53
Compare
|
/compile amend / |
7cc9a53 to
884bb45
Compare
Signed-off-by: Gary Kim <[email protected]>
884bb45 to
98eeb57
Compare
Resolves #16602
Most of this is taken from #15719 so thank you @skjnldsv!
cc @ChristophWurst for Recommendations app
Example use here: nextcloud/recommendations#168 (Can be tested with this)
Also for Text: nextcloud/text#708
Signed-off-by: Gary Kim [email protected]