mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-22 17:58:05 +00:00
Order Google Drive results by folder to show all folders first (#3546)
This commit is contained in:
parent
ae1c512b32
commit
7da07c29fe
1 changed files with 2 additions and 5 deletions
|
|
@ -17,10 +17,6 @@ const SHARED_DRIVE_FIELDS = '*'
|
|||
// Hopefully this name will not be used by Google
|
||||
const VIRTUAL_SHARED_DIR = 'shared-with-me'
|
||||
|
||||
function sortByName (first, second) {
|
||||
return first.name.localeCompare(second.name)
|
||||
}
|
||||
|
||||
async function waitForFailedResponse (resp) {
|
||||
const buf = await new Promise((resolve) => {
|
||||
let data = ''
|
||||
|
|
@ -71,7 +67,7 @@ function adaptData (listFilesResp, sharedDrivesResp, directory, query, showShare
|
|||
|
||||
const adaptedItems = [
|
||||
...(virtualItem ? [virtualItem] : []), // shared folder first
|
||||
...([...sharedDrives, ...items].map(adaptItem).sort(sortByName)),
|
||||
...([...sharedDrives, ...items].map(adaptItem)),
|
||||
]
|
||||
|
||||
return {
|
||||
|
|
@ -143,6 +139,7 @@ class Drive extends Provider {
|
|||
pageToken: query.cursor,
|
||||
q,
|
||||
// pageSize: 10, // can be used for testing pagination if you don't have many files
|
||||
orderBy: 'folder,name',
|
||||
includeItemsFromAllDrives: true,
|
||||
supportsAllDrives: true,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue