Giter VIP home page Giter VIP logo

Comments (50)

erquhart avatar erquhart commented on May 22, 2024 41

Still coming. Became a part of a bigger effort (πŸ€¦β€β™‚) but will be out soon.

from decap-cms.

loremipson avatar loremipson commented on May 22, 2024 25

Requesting some more flexibility here. What do you all think about accepting some optional yaml in the config that would result in both additional fields being displayed in the entry list, as well as making them sortable?

Something like:

collections:
  - name: posts
     label: Posts
     folder: src/posts
     create: true
     fields:
       - { name: title, label: Title, widget: string }
       - { name: publishedDate, label: Published Date, widget: datetime }
       - { name: editedDate, label: Edited Date, widget: datetime }
       - { name: body, label: Body, widget: markdown }
     sortableFields: ["title", "publishedDate", "editedDate"]

from decap-cms.

BIIGitHub avatar BIIGitHub commented on May 22, 2024 18

Any updates on this??

from decap-cms.

erezrokah avatar erezrokah commented on May 22, 2024 12

Just to get a feel for it:
image

from decap-cms.

wing5wong avatar wing5wong commented on May 22, 2024 10

Waiting on this too - just been asked whether or not this is possible to do rather than the current alphabetical.

config only is fine - specifically wanting reverse date order (newest entries at top of list)

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024 10

Latest decisions:

  • Implement for all backends
  • Control sorting via UI!
    • This does not mean drag and drop, that's a whole other thing: #475
  • Defaults:
    • "Updated" - uses Git to sort files by most recently changed
    • Inferred fields - title and date
  • Configuration can be used to sort by any field

from decap-cms.

Herohtar avatar Herohtar commented on May 22, 2024 9

@mittalyashu Taking more space is preferable to having a confusing UI component. "Ascending" and "Descending" are sort directions and should be separate from the list of fields to sort by. Not to mention that the way they're displayed there implies you can somehow select both at once.

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024 8

I spoke w/ @Benaiah recently about using sha's to pseudo cache. The big 3 Git hosts all provide some kind of commit diffing via API:

With the ability to see files that changed between two commits, we can create a sort of index in a data file in your repo, updating changed bits on load, and never needing to download all entries (except to create the original cache, or if the cache is somehow lost).

Still some work to do on the concept, but it does feel feasible.

from decap-cms.

didia avatar didia commented on May 22, 2024 7

Wow! Enfin! Congratulations on closing this one. It's been more than 3 years waiting for this! Good Job team!

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024 6

@barbalex question: we're about to implement this, but initially it will be config driven, so you can set the sort in config but won't be able to change it in the UI. Regardless of whether it's too late to actually use it for your client, I'm curious whether what I'm describing would satisfy your requirements?

Sent with GitHawk

from decap-cms.

erezrokah avatar erezrokah commented on May 22, 2024 5

This is next on our list. We needed to pay off some tech debt to make this happen (#3316)

from decap-cms.

tomrutgers avatar tomrutgers commented on May 22, 2024 4

I agree with @Herohtar. Also: it does not have to take up extra space. If you move the asc/desc icon out of the select box and use it as a button you'd have the outcome I mean.

from decap-cms.

Undistraction avatar Undistraction commented on May 22, 2024 4

It seems to me that currently we have paginated entries, but at the expense of:

  • ability to order entries
  • ability to filter entries
  • ability to search entries

For me this is a poor tradeoff. Implementation of the above three items is a pretty critical feature for any CMS if it is to scale at all. Given that it seems that it is unlikely that the above three features are going to be implemented across all backends due to differences in how they handle pagination, how about making the pagination of results optional? This would allow the above features to be implemented for collections that are not set to paginate. I know the feedback from the people using my build is that it is virtually unusable without a means of searching or ordering entries, whereas pagination is just a nice-to-have feature that has very little or no effect for relatively small collections.

In short, I feel like the tradeoff between pagination and the above features is not a good one.

from decap-cms.

barbalex avatar barbalex commented on May 22, 2024 4

@erquhart Yes, config would suffice as entries would be sorted by a date field, descending. Plus: I can wait a few weeks. Looking forward to this feature!

from decap-cms.

JasonHanley avatar JasonHanley commented on May 22, 2024 3

Very impressed with many aspects of this project, but from the perspective of someone evaluating different static CMS tools, having content show up in hard-coded reverse-alphabetical order is a fairly glaring deficiency, and makes it unsuitable for production use. Not being a React expert, I can't even find where in the source to change this.

I'd be happy just to have a simple config option control this, and that might be simpler to implement.
sort: [fieldname] [asc|desc]

In the meantime, is someone able to point me to the source where this is hard-coded?

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024 3

That's a part of the plan, I expect repo indexes to play a big role in many features and improvements in the future. Initially this will likely all be in memory. Perf won't be great for large collections, but it will initially be configuration driven (no UI sort selection), so the impact will be limited.

Sent with GitHawk

from decap-cms.

shushugah avatar shushugah commented on May 22, 2024 3

Bump, my file names are numeric based, and it's annoying that right now it sorts by, without any option to sort by date

1.md
10.md 
11.md
2.md
3.md

from decap-cms.

austincondiff avatar austincondiff commented on May 22, 2024 3

In v3-ui-redesign we are working on exactly this. We’ve created this list view where you can click on the table headings and also drag items in a custom order.

Check it out here...
https://storybook.netlifycms.org/?path=/story/components-table--table

from decap-cms.

mittalyashu avatar mittalyashu commented on May 22, 2024 2

I have created this. It is similar to what @phae said.

group 4

Check the source file.

from decap-cms.

tomrutgers avatar tomrutgers commented on May 22, 2024 2

Looks good! I would split the ascending / descending functionality from the select box though. So a select box to select the sort modifier and one button to switch between ascending and descending.

from decap-cms.

enriquemorenotent avatar enriquemorenotent commented on May 22, 2024 2

Is this request really 2 years old? This is so important!

from decap-cms.

Undistraction avatar Undistraction commented on May 22, 2024 2

Some repos using Netlify CMS have thousands of entries in a single collection, so requiring that they all be loaded up front is a non-starter.

I agree, and I appreciate that most apis will paginate results, that's why I'm suggesting making pagination something that can be opted out of. For many, probably the majority of cases, there is little or no need for pagination, and it would be fine to load everything up front. Just suggesting that by allowing a collection to opt out of pagination, it could at the same time opt-in to ordering entries, filtering entries and searching entries. At the moment, these crucial features are not available due to the difficulty of their implementation alongside enforced pagination.

from decap-cms.

Benaiah avatar Benaiah commented on May 22, 2024 2

Opting out of pagination by loading all posts up-front is possible - there’s existing code to do so for search in the GitLab and BitBucket backends. It could be an option for small sites, though the latency upfront can become large very quickly. The CMS would also have to load them every time it detects a change in the repo, meaning this cost would be incurred multiple times in a single CMS session.

from decap-cms.

erezrokah avatar erezrokah commented on May 22, 2024 2

Best thing you can do is up vote the issue as we use it for prioritization. This is currently number 4: https://github.com/netlify/netlify-cms/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024 1

That's where commit diffing comes in.

from decap-cms.

erezrokah avatar erezrokah commented on May 22, 2024 1

I'd be happy just to have a simple config option control this, and that might be simpler to implement.
sort: [fieldname] [asc|desc]

@chocobuckle I think he means that you can control sorting from the UI as opposed to the comment I quoted. Drag and drop is more related to #475

from decap-cms.

austincondiff avatar austincondiff commented on May 22, 2024 1

@wing5wong I plan to virtualize these rows with react-window. So it should handle 200+ items easily.

from decap-cms.

mittalyashu avatar mittalyashu commented on May 22, 2024

That will take too much of space from design prospective. Why not just keep inside a single component.

I know the title of the button is wrong, but the image is just to show the design.

from decap-cms.

mittalyashu avatar mittalyashu commented on May 22, 2024

Okay, I will try and do some brainstorming 😜.

from decap-cms.

enriquemorenotent avatar enriquemorenotent commented on May 22, 2024

@JasonHanley That is an interesting thought. I never considered hacking it myself :D

I have not really taken time to analize it well, but my bet would be in this file:

https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-core/src/components/Collection/Entries/EntryListing.js

Either line: #50 or #55. Not sure which one of those 2 methods is used, but I would bet that one of those 2 arrays (or maybe boths) need a sort function.

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024

Note that this is more complex than it seems - in many cases you're dealing with a paginated list, in which case more entries load as you scroll. Sorting would therefore have to be supported by the backend in use, or else we need to load all pages up front before sorting.

Sent with GitHawk

from decap-cms.

JasonHanley avatar JasonHanley commented on May 22, 2024

Ugh, I do see the trickiness, assuming you're using something like https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/src/%7Bnode%7D/%7Bpath%7D to list the files in a folder.

The best you could do is sort by file name or file size. In that case, I don't see any way to avoid loading, parsing, and caching all entries upfront. It's a bit of a shame you have to load the entire file just to get the front matter.

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024

We didn't choose pagination - the Bitbucket and GitLab API's (and pretty much every normal API out there) returns paginated results. Some repos using Netlify CMS have thousands of entries in a single collection, so requiring that they all be loaded up front is a non-starter. As GitLab and Bitbucket support were the most requested features by a wide margin, we had to take the good with the bad.

Again, we can start this off with a backend agnostic solution in core and an implementation in the GitHub backend. I don't love having features supported in only one backend, but it's better than nothing.

from decap-cms.

Jones-S avatar Jones-S commented on May 22, 2024

I see that this issue is included in the dev cycle ending on 29th of March. Will this mean that we can soon see some sorting within the netlify cms?

from decap-cms.

barbalex avatar barbalex commented on May 22, 2024

I had almost decided on using netlify-cms for two projects. Then I realized that not being able to sort was a no-go for my client :-(

I understand the problems and realize it is hard to solve. Aside from this: great project!

from decap-cms.

otaviowillow avatar otaviowillow commented on May 22, 2024

@erquhart is this still on the roadmap?

from decap-cms.

erquhart avatar erquhart commented on May 22, 2024

Absolutely, just didn't get it out as soon as I had hoped.

Sent with GitHawk

from decap-cms.

snoopdouglas avatar snoopdouglas commented on May 22, 2024

Great that this is being developed now. Sorting is the last major hurdle for our clients too.

How is this going to work with sorting by custom fields? Is this now part of the acceptance criteria as per @loremipson's suggestion?

With hundreds of pages, I'd imagine this could get quite slow as we'd be bombarding {your git host} with requests on every single client-side sort. So, will the CMS maintain in-repo index files? eg.

`/.netlify-cms/indexes/${collection}/${field}.json`

from decap-cms.

nratter avatar nratter commented on May 22, 2024

Any updates on this? Config only is fine for our case as well.

from decap-cms.

alfchee avatar alfchee commented on May 22, 2024

I would like you may add this feature to the CMS, it would be great to be a able to decide how to sort the items of different collections in the CMS.

from decap-cms.

marcneander avatar marcneander commented on May 22, 2024

Would love an update on this.

Currently no way to sort in a decent way? Best workaround I've found is using "{{year}}-{{month}}-{{day}}" or similar as slug. However, when updating an item NetlifyCMS is not updating filenames.

Am I doing something wrong or are we missing this very basic and crucial feature?

from decap-cms.

bencao avatar bencao commented on May 22, 2024

definitely an up vote for this feature.

from decap-cms.

cloudcrestconsulting avatar cloudcrestconsulting commented on May 22, 2024

Any update on this?

from decap-cms.

JeffML avatar JeffML commented on May 22, 2024

I would hope we could filter by draft/published status as well.

from decap-cms.

chocobuckle avatar chocobuckle commented on May 22, 2024

@erquhart By "sort in ui", do you mean we'll be able to click and drag items to new positions?

from decap-cms.

ChrisLasar avatar ChrisLasar commented on May 22, 2024

Just in case you have note considered it yet: A couple of days ago I found a wonderful "a table enhancing plug-in for the jQuery Javascript library" on Github, which might add wonderful sorting, filtering and grouping features to the great NetlifyCMS solution. See https://github.com/DataTables/DataTables for more information.

from decap-cms.

wing5wong avatar wing5wong commented on May 22, 2024

Will this implementation deal with a large list as well - say 200 + items

from decap-cms.

jacobpake avatar jacobpake commented on May 22, 2024

Glad to be able to unsubscribe from this, thank you team

from decap-cms.

equivalentideas avatar equivalentideas commented on May 22, 2024

Congrats on this implementation @erezrokah @erquhart it works really well πŸ’ :)

My team have a long lists of post and want to have the latest post first, because it's not always easy to remember the name of a post you're looking for to find it and edit it. Latest-post-first is how we present posts on the frontend, and it's not obvious to them why it would be different on the back-end.

Is it possible to set a date field to be the default from sortableFields and control the direction? or would that be a new feature?

from decap-cms.

erezrokah avatar erezrokah commented on May 22, 2024

@equivalentideas Thanks πŸ˜„
The reason for not to have a default sort was that sorting requires reading all entries (since it's done client side) which can take some time with large collections, and once a user sorts a collection, that preference is persisted so it's a one time thing.

With that said, since this is not the first time I've heard of that request it's looks like it would make sense to be able to opt in to a default sort method with the cost of a slow first load.
Does that makes sense? Do you mind opening a feature request with your suggestion?

from decap-cms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.