[MGNLDAM-719] Sortable File Size Column Created: 27/Jul/17 Updated: 17/Jun/21 Resolved: 12/Mar/21 |
|
| Status: | Closed |
| Project: | Magnolia DAM Module |
| Component/s: | DAM App, User Interaction |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Marvin Kerkhoff | Assignee: | Unassigned |
| Resolution: | Obsolete | Votes: | 1 |
| Labels: | app, dam, file, sorting | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Date of First Response: | |||||||||
| Epic Link: | DAM improvements 2 | ||||||||
| Story Points: | 3 | ||||||||
| Description |
|
PXMDAM-8 ---------------- Hi Product Team, in some of our bigger customer projects we saw some issues regarding big files. Some of the users don't care about file sizes and push anything they like to the dam workspace. This ends in a big backup issue and you also have problems to download an xml export. For those reasons we have added a new column which shows the current file size of a mgnl:asset. If you are interessted i also attached the two java files for the column formatting. Now all works fine you see the file size in the column. But you can't sort it by this column because it's not possible to add a order by from a jcr subnode property. In this case it's a limitation of sql2 which you are using for the sorting in your container. I researched a little bit and it's only possible to sort this with a xpath query like this:
/jcr:root//element(*, mgnl:asset) order by jcr:content/@size descending
It's actualy way to much for me to implement a workaround, but it would be a nice improvement for the DAM App to have such a column. For all that people who have actualy the same issue. Here is a little groovy script what you can use to get a csv for the biggest files in your repo. hm = ctx.getHierarchyManager("dam") query = hm.getQueryManager().createQuery("/jcr:root//element(*, mgnl:asset) order by jcr:content/@size descending", "xpath") result = query.execute() contentCollection = result.getContent("mgnl:asset") println "path,size" contentCollection.each { c -> if (c.getJCRNode().hasNode('jcr:content')) { println "${c.handle},${PropertyUtil.getLong(c.getJCRNode().getNode('jcr:content'), 'size')}" } } |
| Comments |
| Comment by Roman Kovařík [ 12/Mar/21 ] | |||||||||
|
Works in latest https://demo.magnolia-cms.com/.magnolia/admincentral#app:resources:edit;/dam-app-jcr/decorations/dam-assets-app/apps/dam.subApps.yaml:edit
columns:
...
jcr:content/size:
type: java.lang.Long
| |||||||||
| Comment by Martin Drápela [ 07/May/21 ] | |||||||||
|
With this configuration size-sorting only works in the tree view. In the list view, an error is produced, leaving an empty view: 2021-05-07 15:54:43,228 ERROR nfo.magnolia.admincentral.AdmincentralErrorHandler: AdmincentralUI has encountered an unhandled exception. com.machinezoo.noexception.WrappedException: javax.jcr.query.InvalidQueryException: '/' not allowed in name
Unfortunately, a sortable (=false) property does not exist there, so sorting cannot be disabled in the list view.
(
)
| |||||||||
| Comment by Jan Haderka [ 10/May/21 ] | |||||||||
|
mdrapela the message talks about / not about the numbers. The error you got comes from some other column, not from the size one. Size field is defined as long so it can never contain "/". |