Skip to content

Fixed size issues on main detail view and disappearing of share recipients#26603

Merged
PVince81 merged 6 commits into
owncloud:masterfrom
mjobst-necls:fix_favorite_and_size_in_details_view-patch2
Nov 21, 2016
Merged

Fixed size issues on main detail view and disappearing of share recipients#26603
PVince81 merged 6 commits into
owncloud:masterfrom
mjobst-necls:fix_favorite_and_size_in_details_view-patch2

Conversation

@mjobst-necls

Copy link
Copy Markdown
Contributor

This is a clean PR refering to #26552

@mention-bot

Copy link
Copy Markdown

@mjobst-necls, thanks for your PR! By analyzing the history of the files in this pull request, we identified @PVince81, @DeepDiver1975 and @rullzer to be potential reviewers.

@PVince81 PVince81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code looks good otherwise.

I haven't tested yet (will need to retest all affected components).

See me comments and let me know what you think.

Comment thread apps/comments/js/commentmodel.js Outdated
PROPERTY_OBJECTID: '{' + OC.Files.Client.NS_OWNCLOUD + '}objectId',
PROPERTY_OBJECTTYPE: '{' + OC.Files.Client.NS_OWNCLOUD + '}objectType',
PROPERTY_ACTORDISPLAYNAME: '{' + OC.Files.Client.NS_OWNCLOUD + '}actorDisplayName',
PROPERTY_CREATEIONDATETIME: '{' + OC.Files.Client.NS_OWNCLOUD + '}creationDateTime'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

creation, not create-ion ? 😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep ...

Comment thread apps/comments/js/commentmodel.js Outdated
'creationDateTime': OC.Files.Client.PROPERTY_CREATEIONDATETIME,
'objectType': OC.Files.Client.PROPERTY_OBJECTTYPE,
'objectId': OC.Files.Client.PROPERTY_OBJECTID,
'isUnread': OC.Files.Client.PROPERTY_ISUNREAD

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

weird alignment here, I suggest to not tab or indent after the ":" and let it flow 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, in the editor it looks better with an tab size of 4. I'll change this and take it in future works into account.

return $displayName;
});
$propFind->handle(self::SIZE_PROPERTYNAME, function() use ($node) {
return $node->getSize();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The "oc:size" property is only used for folders. For files we use "DAV:getcontentlength" instead.

Did you add it for convenience ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I just thought the oc:size is the correct property to retrieve the size of an object.
I added the oc:size property to the webdav request payload to retrieve the size and nothing was returned. It must be dependent of another property.

oc:size is also in the request payload of the webdav API:
<?xml version="1.0"?> <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"> <d:prop> <d:getlastmodified /> <d:getetag /> <d:getcontenttype /> <d:resourcetype /> <oc:fileid /> <oc:permissions /> <oc:size /> <d:getcontentlength /> <oc:tags /> <oc:favorite /> <oc:comments-unread /> <oc:owner-display-name /> <oc:share-types /> </d:prop> </d:propfind>

What exactly does the oc:size property express, then? What is the difference of oc:size and d:getcontentlength?

Can I use d:getcontentlength for reloading the size property of shared files and folders?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, you can add "d:getcontentlength" to the requested properties and then check later which one of "oc:size" or "d:getcontentlength" was set in the response and use that.

The reason why we needed to invent "oc:size" is because the Webdav spec's "d:getcontentlength" isn't suitable for folders/collections and also because we needed something that represents the size of the complete contents (basically the same as the size shown in the properties of a folder in a file manager, the size of ALL included files). This is not exactly the same as checking the "quota-used-bytes" as received shared folders do not use any quota for the current user.

Comment thread apps/files/js/filelist.js Outdated
properties: properties
})
.then(function(status, data) {
// the following lines should be extracted to a mapper

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah, or use the backbone model's ".fetch()" method instead of getFileInfo, but that's WIP here: #25909. In that PR fetching the properties of the model would automatically make the list's entry refresh.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, cool. I'll try it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't try it on your PR, it won't work...

Here you can see it in action in the other PR: https://github.com/owncloud/core/pull/25909/files#diff-dafefd9519924bec4efa9f5af4af8e68L2262

Comment thread apps/files/js/filelist.js Outdated
deferred.resolve(status, data);
})
.fail(function(status) {
OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name}));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"could not load info for file" ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah. For sure =/

Comment thread apps/files/js/filelist.js Outdated
// the following lines should be extracted to a mapper
if( properties.indexOf(OC.Files.Client.PROPERTY_SIZE) !== -1){
fileInfo.set('size', data.size);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See discussion above about oc:size vs DAV:getcontentlength. You'd need to also check the content length property here I think.

Comment thread apps/files/js/mainfileinfodetailview.js Outdated
}

if( properties.length > 0){
this._fileList.reloadProperties(fileInfo, properties);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah, if we could at some point just call "this.model.fetch()" like I'd like to have in this PR #25909 then we could remove the dependency with the file list completely.

@PVince81

Copy link
Copy Markdown
Contributor

@mjobst-necls do we actually still need that reload call ?
Your other PR changed the OCS Share API to already return the correct values.
So if someone changes the favorite in the sidebar all we need to do is set it on the model, which itself will (should) trigger a row update with the star state applied.
So I don't think we need to do the extra reloads any more.

@mjobst-necls

mjobst-necls commented Nov 14, 2016

Copy link
Copy Markdown
Contributor Author

@PVince81 Yes, the property reload is still needed because of the file size, which is not contained in the share API response. In big data applications only the information needed for immediate display should be retrieved, minimizing the response data size. This is the point here, because the file size is not shown in the file list.

Otherwise, if we want to show e.g. the file/content size summary at the bottom or in a column, the file size should be retrieved by the share api immediately.

Of course, we can add the size/contentlength to the share api, but this adds additional overhead for not necessarily needed information until now.

The size/contentlength property is only reloaded once per file on demand for the following position on details view:
image

Well, you are the boss and I want the file size to be displayed correctly on the main details view. Which method do you prefer?

Comment thread apps/files/js/filelist.js Outdated

/**
* Reloads missing properties from server and set them in the model.
* @param {OCA.Files.FileInfo} fileInfo file info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should be FileInfoModel ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're right... I'm gonna change this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Uh, the FileInfoModel doesn't have a client in this version, yet.

Anyway. I added the client to the FileInfoModel so that we are closer to what we wanna have by PR #25909.

I tested the result and it works =)

@PVince81

Copy link
Copy Markdown
Contributor

Ah, damn... I forgot that the sharing file list didn't have the size. Well, if the PROPFIND only happens for the sidebar, then this is fine.

Too bad we can't have "reloadCallback" directly on the model.
Anyway, I think if we ever get to merge #25909 we'll be able to use "model.fetch({davProperties: []})` with the stuff that the sidebar needs.

@mjobst-necls

Copy link
Copy Markdown
Contributor Author

I had to add the Client to the FileInfoModel, but this should be ok, because we are closer to what we want to have by Issue #25909, now.

@mjobst-necls mjobst-necls self-assigned this Nov 14, 2016
@mjobst-necls

Copy link
Copy Markdown
Contributor Author

Conclusion of changes:

  • The size on main details view (triggered by share views) get displayed correctly. There is a reload of the size property on demand, but only once per file until page reload.
  • The share recipients on view Shared with others stay visible on after favorite change
  • The Expiration date on view Shared by link stay visible on after favorite change

@PVince81

Copy link
Copy Markdown
Contributor

Great, so I guess ready to review again ?
Will check it next week. Thanks.

@mjobst-necls

Copy link
Copy Markdown
Contributor Author

@PVince81 Yes, this PR should be complete, now.

@PVince81

Copy link
Copy Markdown
Contributor

Tested, works 👍
Thanks!

@lock

lock Bot commented Aug 4, 2019

Copy link
Copy Markdown

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.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants