Skip to content

Commit 5d33f01

Browse files
maltheismridz1208
authored andcommitted
update
update Revert "update" This reverts commit 6d56db9. Revert "update" This reverts commit 3f8274d. update remove additional directory for file storage remove additional directory for file storage update update Update files.js
1 parent 488bec8 commit 5d33f01

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

modules/genomic_browser/jsx/tabs_content/files.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Files extends Component {
3535
},
3636
};
3737
this.fetchData = this.fetchData.bind(this);
38+
this.formatColumn = this.formatColumn.bind(this);
3839
this.openFileUploadModal = this.openFileUploadModal.bind(this);
3940
this.closeFileUploadModal = this.closeFileUploadModal.bind(this);
4041
this.renderFileUploadForm = this.renderFileUploadForm.bind(this);
@@ -151,9 +152,16 @@ class Files extends Component {
151152
formatColumn(column, cell, rowData, rowHeaders) {
152153
let reactElement;
153154
switch (column) {
155+
case 'Name':
156+
const fileName = rowData.Name.split('/').pop();
157+
const url =
158+
`${this.props.baseURL
159+
}/genomic_browser/FileManager?filename=${fileName}`;
160+
reactElement = <td><a href={url}>{fileName}</a></td>;
161+
break;
154162
case 'PSCID':
155-
const url = `${this.props.baseURL}/${rowData.DCCID}/`;
156-
reactElement = <td><a href={url}>{rowData.PSCID}</a></td>;
163+
const urlPscid = `${this.props.baseURL}/${rowData.DCCID}/`;
164+
reactElement = <td><a href={urlPscid}>{rowData.PSCID}</a></td>;
157165
break;
158166
case 'Subproject':
159167
reactElement = <td>{this.state.data.subprojects[parseInt(cell)]}</td>;

modules/genomic_browser/php/filemanager.class.inc

+27
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,33 @@ class FileManager extends \NDB_Page implements ETagCalculator
5454
*/
5555
private function _handleGET(ServerRequestInterface $request) : ResponseInterface
5656
{
57+
// Parse GET query params.
58+
$values = $request->getQueryParams();
59+
// GET request for downloading file by ID.
60+
if ($values['filename']) {
61+
$factory = \NDB_Factory::singleton();
62+
$config = $factory->config();
63+
$filesDir = \Utility::appendForwardSlash(
64+
$config->getSetting('GenomicDataPath')
65+
);
66+
try {
67+
$downloadhandler = new \LORIS\FilesDownloadHandler(
68+
new \SplFileInfo($filesDir)
69+
);
70+
$request = $request->withAttribute(
71+
'filename',
72+
$values['filename']
73+
);
74+
return $downloadhandler->handle($request);
75+
} catch (\LorisException $e) {
76+
// FilesUploadHandler throws an exception if there's a problem with
77+
// the downloaddir.
78+
return new \LORIS\Http\Response\JSON\InternalServerError(
79+
$e->getMessage()
80+
);
81+
}
82+
}
83+
5784
$provisioner = new FilesProvisioner();
5885
$user = $request->getAttribute('user');
5986

modules/genomic_browser/php/uploading/genomicfile.class.inc

+4-2
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,10 @@ class Genomicfile
468468
function setFullPath(&$fileToUpload) : void
469469
{
470470
$config = \NDB_Config::singleton();
471-
$genomic_data_dir = rtrim($config->getSetting('GenomicDataPath'), '/')
472-
. '/genomic_uploader/';
471+
$genomic_data_dir = rtrim(
472+
$config->getSetting('GenomicDataPath'),
473+
'/'
474+
) . '/';
473475

474476
$fileToUpload->full_path = $genomic_data_dir
475477
. $fileToUpload->file_name;

0 commit comments

Comments
 (0)