-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fixed favorite and size issues on main detail view. #26552
fixed favorite and size issues on main detail view. #26552
Conversation
enhanced js test file removed css superscript attribute for version size
some refactoring
@mjobst-necls, thanks for your PR! By analyzing the history of the files in this pull request, we identified @PVince81, @DeepDiver1975 and @MorrisJobke to be potential reviewers. |
@PVince81 js-fu - your discipline - THX |
I just realized that the test has to be modified due to the additional getSize call. I'm going to change it today evening. |
The method getSize can be called when this property is requested.
OC.CLIENT.NS_DAV = 'DAV:'; | ||
|
||
OC.CLIENT.PROPERTY = {}; | ||
OC.CLIENT.PROPERTY.ACTORDISPLAYNAME = '{' + OC.CLIENT.NS_OWNCLOUD + '}actorDisplayName'; |
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.
we can't list all possibly Webdav properties here. Some are supposed to be only known by apps/plugins like the comments app.
@@ -59,43 +59,83 @@ | |||
this._client = new dav.Client(clientOptions); | |||
this._client.xhrProvider = _.bind(this._xhrProvider, this); | |||
}; | |||
OC.CLIENT = {}; |
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.
Capitalized class name doesn't look good. Can we put these constants on OC.Files.Client
instead ?
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.
Yep, you're right. I'm going to change this.
OC.CLIENT.PROPERTY.USERASSIGNABLE = '{' + OC.CLIENT.NS_OWNCLOUD + '}user-assignable'; | ||
OC.CLIENT.PROPERTY.USERVISIBLE = '{' + OC.CLIENT.NS_OWNCLOUD + '}user-visible'; | ||
OC.CLIENT.PROPERTY.CHECKSUMS = '{' + OC.CLIENT.NS_OWNCLOUD + '}checksums'; | ||
OC.CLIENT.PROPERTY.DATA_FINGERPRINT = '{' + OC.CLIENT.NS_OWNCLOUD + '}data-fingerprint'; |
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.
while I appreciate the intention of declaring constants for every property, I'd still prefer if we keep the constants in the scope of the respective apps. So in the OC.Files.Client namespace only define the base properties known for files.
Then every app define their own constants. They could optionally extend this namespace so the props still all appear in the same one:
_.extend(OC.Files.Client, { PROPERTY_COMMENTS_UNREAD: '...', ...})
Not sure if it's a good idea though.
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.
Ok, I'll check whether this is possible ... but it should be ...
I just want to avoid duplicate code =)
@@ -117,6 +126,80 @@ | |||
return baseUrl + OC.generateUrl('/f/{fileId}', {fileId: fileId}); | |||
}, | |||
|
|||
_createLocalFavoriteActionIfNotExisting: function(actionName){ |
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.
The problem with this is that the MainFileInfoView now needs to know about the favorite plugin/action.
Ideally we need a mechanism to inject elements into this view from outside so that the TagsPlugin can inject the star itself.
The current impl didn't do that yet unfortunately.
} | ||
|
||
if( properties.length > 0){ | ||
this._fileList.reloadProperties(fileInfo, properties); |
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.
It shouldn't be needed to reload the properties.
Whenever a model properties gets modified with "model.set()", a "change" event is triggered in which the list of properties to update can be seen.
I think the TagsPlugin needs to listen to the model's event:
model.on('change:tags', function() { ... }
and in the handler it should tell the file list to rerender the row with the updated information by calling fileList.updateRow(...)
.
Actually there was already such code for other operations but a bit hacky: https://github.com/owncloud/core/blob/master/apps/files/js/filelist.js#L445. Not sure why that one doesn't work when updating tags ?
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.
The problem is, that the size and the tags (also favorite tag) are not already in the file info, because they were not retrieved by the list fill api call. I think that behavior is correct until now, because the information is not shown in the list. It's just needed for the details view.
( Ok, we also need the favorite information because of issue #19753. I'm going to work on that for this PR, but shouldn't we use the favoritesplugin in this case? Or, at least, extract the actions to reuse them on the sharing views?)
The reloadProperties() function retrieves the missing properties from the server by webdav and adds them to the model.
The change event is getting triggered and the row gets updated and rerendered after reloading the properties.
Can you please verify whether my approach about reloading missing file properties is good or not or do you know another method how to do this?
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.
Ah, right... The favorite info is usually available on the regular PROPFIND but not when calling the share API.
Here there are three solutions:
- Your solution, but it involves doing a PROPFIND for every entry in the list, it will become expensive when the list is long
- Modify the OCS Share API to also return size and favorite in its response. What I don't like here is that one might not always need the "favorite" info and that one is more expensive to resolve on DB level. The advantage of PROPFIND is that you can choose what you need.
- Create a new Webdav API for sharing which aligns with the Webdav files API, which would make it possible to add such properties.
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.
regarding 1) That's not correct. My approach just reloads the missing properties for the selected entry, when the Details view is open.
regarding 2) Considering #19753 this would be the best approach for a quick solution without need to create a new API because the information is needed for every entry in the list. It should be possible to hide/show the favorite column as a user setting and add a parameter to the OCS Share API to control which values should be sent.
regarding 3) Would be the best approach for a long term solution.
- and 3) are quite equal but 2) would be easier for me, because I don't know anything about creating a new api endpoint in owncloud, yet.
@mjobst-necls great to see you diving deeper into the mess that is the files app code 😄 However I think the approach you proposed will make it a bit more messy and introduce additional coupling. Have a look at my comments and let's see if we can find a better way to make it work. |
@PVince81 I'm sometimes wondering why oc is doing quite everything on it's own. There are a plenty of solutions like AngularJS doing jobs better. JQuery, for example, is also used, so I guess you don't want to avoid using 3rd Party libraries. The design could also be more responsive by using bootstrap. Bootstrap and AngularJS are both under MIT license so that shouldn't be a problem, either. I'm just interested in the why?. |
@PVince81 I also realized that the file propiertes are added to the tr element as "data-..." attributes and the list reads that attributes to create a new FileInfo object when updating a File.
AngularJS, for example, provides two way binding. The whole setting and getting properties and also the rerendering is done without extra code. |
Because this code is very old and never got to properly clean it up fully. I was looking at using Backbone JS a bit more in this PR #25909. Goal is at least to separate the model from the view. If possible I'd eventually want to get rid of the "data-*" attributes and keep everything on the model.
Yes, would love that. See #25909 |
Ok. that's an argument. Indeed, introducing a library has to be done step by step.
Is it possible to use a user developed files-app instead of the provided files app in owncloud (selectable by the admin)? |
…mjobst-necls/core into fix_favorite_from_sidebar-patch
Added missing function description
is merged - @mjobst-necls can you please rebase this branch? THX a lot! Nice work! |
some refactoring
The method getSize can be called when this property is requested.
some refactoring
please try (asuming you have this repo setup as remote names upstream 😉 ) git fetch upstream
git rebase upstream/master |
Duplicates because of rebase mistage
It is already rebased, isn't it? |
Now yes - I guess old commits have been shown to be due to missing update on the github page - I'm sorry |
Oh. wait. there still seems to be an rebase mistake ... |
Wrong alert. I just haven't pulled the client.js so that karma test failed. |
The old commits still seem to show up on rebase, but on files changed only the real changes for this issue are shown. |
If they show up it still means that on merge they're likely to appear in the log, additionally. |
@mjobst-necls easiest would be to restart with a new PR, then cherry-pick only the new commits there. |
we can also squash on merge .... |
Ok. I create a new PR ... |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
The missing information on detail view is being reloaded from now. Because there is no action for the click on the star button registered at this point we need to create a local action. This makes the favorite button work on the detail view.
I also did some refactoring of the property names in the javascript code to provide a better overview and to avoid misspellings in the future.
Related Issue
#26437
#26241 : The names of the share recipients still diseappeard on view Shared with others
Motivation and Context
The size and the favorite star were not shown correctly on the details view when openened by any share list. By this commit, the needed information is reloaded when the detail view is open and the information is missing.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: