aee603836cd555a755a72d82028e9193cebc4bf7 chmalee Mon Nov 18 17:22:43 2024 -0800 Format dates the same as js when returning files to client, rename hub to parent dir on client when an upload is successful, add the quota used out of the max quota to the table display diff --git src/hg/js/hgMyData.js src/hg/js/hgMyData.js index 11c269e..4848413 100644 --- src/hg/js/hgMyData.js +++ src/hg/js/hgMyData.js @@ -19,31 +19,31 @@ allowMultipleUploadBatches: false, onBeforeUpload: (files) => { // set all the fileTypes and genomes from their selects let doUpload = true; for (let [key, file] of Object.entries(files)) { if (!file.meta.genome) { uppy.info(`Error: No genome selected for file ${file.name}!`, 'error', 2000); doUpload = false; continue; } else if (!file.meta.fileType) { uppy.info(`Error: File type not supported, please rename file: ${file.name}!`, 'error', 2000); doUpload = false; continue; } uppy.setFileMeta(file.id, { - fileName: file.name, + fileName: file.meta.name, fileSize: file.size, lastModified: file.data.lastModified, }); } return doUpload; }, }); var hubCreate = (function() { let uiState = { // our object for keeping track of the current UI and what to do userUrl: "", // the web accesible path where the uploads are stored for this user }; // We can use XMLHttpRequest if necessary or a mirror can't use tus var useTus = tus.isSupported && true; @@ -300,31 +300,31 @@ }, { // The upload time column, not visible but we use it to sort on new uploads targets: 8, visible: false, searchable: false } ], columns: [ {data: "", }, {data: "", }, {data: "fileName", title: "File name"}, {data: "fileSize", title: "File size", render: dataTablePrintSize}, {data: "fileType", title: "File type"}, {data: "genome", title: "Genome", render: dataTablePrintGenome}, - {data: "hub", title: "Hubs"}, + {data: "parentDir", title: "Hubs"}, {data: "lastModified", title: "File Last Modified"}, {data: "uploadTime", title: "Upload Time"}, ], order: [[6, 'desc']], drawCallback: function(settings) { if (isLoggedIn) { settings.api.buttons(0).enable(); } } }; function showExistingFiles(d) { // Make the DataTable for each file // make buttons have the same style as other buttons $.fn.dataTable.Buttons.defaults.dom.button.className = 'button'; @@ -684,31 +684,31 @@ theme: 'auto', }; let tusOptions = { endpoint: getTusdEndpoint(), withCredentials: true, retryDelays: null, }; uppy.use(Uppy.Dashboard, uppyOptions); uppy.use(Uppy.Tus, tusOptions); uppy.use(BatchChangePlugin, {target: Uppy.Dashboard}); uppy.on('upload-success', (file, response) => { const metadata = file.meta; const d = new Date(metadata.lastModified); newReqObj = { "uploadTime": Date.now(), - "lastModified": d.toJSON(), + "lastModified": d.toLocaleString(), "fileName": metadata.fileName, "fileSize": metadata.fileSize, "fileType": metadata.fileType, "genome": metadata.genome, "parentDir": metadata.parentDir, }; addNewUploadedFileToTable(newReqObj); }); } return { init: init, uiState: uiState, }; }());