(targetFolder, recursiveValue, cursorValue = null, forceNoPaging = false)
| 6146 | // Kick off both in parallel, but render as soon as FILES are ready |
| 6147 | const recursiveParam = folderOnly ? 0 : 1; |
| 6148 | const buildFileListUrl = (targetFolder, recursiveValue, cursorValue = null, forceNoPaging = false) => { |
| 6149 | const params = new URLSearchParams(); |
| 6150 | params.set('folder', targetFolder); |
| 6151 | params.set('recursive', String(recursiveValue)); |
| 6152 | if (paneSourceId) { |
| 6153 | params.set('sourceId', paneSourceId); |
| 6154 | } |
| 6155 | if (includeContent) { |
| 6156 | params.set('includeContent', '1'); |
| 6157 | } |
| 6158 | if (!forceNoPaging && useServerPaging) { |
| 6159 | const pageSize = getFileListCursorPageSize(); |
| 6160 | const sortColumn = String(sortOrder?.column || 'modified'); |
| 6161 | const sortDir = (sortOrder && sortOrder.ascending === true) ? 'asc' : 'desc'; |
| 6162 | const allowedSort = new Set(['name', 'modified', 'uploaded', 'size', 'uploader']); |
| 6163 | params.set('pageSize', String(pageSize)); |
| 6164 | params.set('sortBy', allowedSort.has(sortColumn) ? sortColumn : 'modified'); |
| 6165 | params.set('sortDir', sortDir); |
| 6166 | const cursorText = (cursorValue == null) ? '' : String(cursorValue).trim(); |
| 6167 | if (cursorText !== '') { |
| 6168 | params.set('cursor', cursorText); |
| 6169 | } |
| 6170 | } |
| 6171 | params.set('t', String(Date.now())); |
| 6172 | return withBase(`/api/file/getFileList.php?${params.toString()}`); |
| 6173 | }; |
| 6174 | |
| 6175 | const startCursor = useServerPaging |
| 6176 | ? resolveServerPagingCursorForLoad({ |
no test coverage detected