Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maltheism authored and ridz1208 committed Mar 24, 2023
1 parent 488bec8 commit bb76c32
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
12 changes: 10 additions & 2 deletions modules/genomic_browser/jsx/tabs_content/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Files extends Component {
},
};
this.fetchData = this.fetchData.bind(this);
this.formatColumn = this.formatColumn.bind(this);
this.openFileUploadModal = this.openFileUploadModal.bind(this);
this.closeFileUploadModal = this.closeFileUploadModal.bind(this);
this.renderFileUploadForm = this.renderFileUploadForm.bind(this);
Expand Down Expand Up @@ -151,9 +152,16 @@ class Files extends Component {
formatColumn(column, cell, rowData, rowHeaders) {
let reactElement;
switch (column) {
case 'Name':
const fileName = rowData.Name.split('/').pop();
const url =
`${this.props.baseURL
}/genomic_browser/FileManager?filename=${fileName}`;
reactElement = <td><a href={url}>{fileName}</a></td>;
break;
case 'PSCID':
const url = `${this.props.baseURL}/${rowData.DCCID}/`;
reactElement = <td><a href={url}>{rowData.PSCID}</a></td>;
const url_pscid = `${this.props.baseURL}/${rowData.DCCID}/`;
reactElement = <td><a href={url_pscid}>{rowData.PSCID}</a></td>;
break;
case 'Subproject':
reactElement = <td>{this.state.data.subprojects[parseInt(cell)]}</td>;
Expand Down
27 changes: 27 additions & 0 deletions modules/genomic_browser/php/filemanager.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ class FileManager extends \NDB_Page implements ETagCalculator
*/
private function _handleGET(ServerRequestInterface $request) : ResponseInterface
{
// Parse GET query params.
$values = $request->getQueryParams();
// GET request for downloading file by ID.
if ($values['filename']) {
$factory = \NDB_Factory::singleton();
$config = $factory->config();
$filesDir = \Utility::appendForwardSlash(
$config->getSetting('GenomicDataPath')
);
try {
$downloadhandler = new \LORIS\FilesDownloadHandler(
new \SplFileInfo($filesDir)
);
$request = $request->withAttribute(
'filename',
$values['filename']
);
return $downloadhandler->handle($request);
} catch (\LorisException $e) {
// FilesUploadHandler throws an exception if there's a problem with
// the downloaddir.
return new \LORIS\Http\Response\JSON\InternalServerError(
$e->getMessage()
);
}
}

$provisioner = new FilesProvisioner();
$user = $request->getAttribute('user');

Expand Down
6 changes: 4 additions & 2 deletions modules/genomic_browser/php/uploading/genomicfile.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,10 @@ class Genomicfile
function setFullPath(&$fileToUpload) : void
{
$config = \NDB_Config::singleton();
$genomic_data_dir = rtrim($config->getSetting('GenomicDataPath'), '/')
. '/genomic_uploader/';
$genomic_data_dir = rtrim(
$config->getSetting('GenomicDataPath'),
'/'
) . '/';

$fileToUpload->full_path = $genomic_data_dir
. $fileToUpload->file_name;
Expand Down

0 comments on commit bb76c32

Please # to comment.