diff --git a/CHANGELOG.md b/CHANGELOG.md index b257d0e2..11d7fe67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.0.1-rc.9](https://github.com/NFDI4Chem/nmrxiv/compare/v1.0.0-rc.9...v1.0.1-rc.9) (2023-11-15) + + +### Bug Fixes + +* added titles to public pages and various other minor updates ([cca8fce](https://github.com/NFDI4Chem/nmrxiv/commit/cca8fcedf053d0b341b3bf26846b590289bcaac3)) +* dataset spectra parsing updates / issues fixes ([4c71480](https://github.com/NFDI4Chem/nmrxiv/commit/4c714807d92939b241c7d6b302fd2b34e92fd3bc)) +* FSBrowser folder truncate enabled ([ca44ca9](https://github.com/NFDI4Chem/nmrxiv/commit/ca44ca98932512decaa46331a90618d2f8cb71cb)) +* resolved [#645](https://github.com/NFDI4Chem/nmrxiv/issues/645) ([da98574](https://github.com/NFDI4Chem/nmrxiv/commit/da9857406fa305f9c658d13d47f50ea8ff28f871)) +* resolves [#804](https://github.com/NFDI4Chem/nmrxiv/issues/804) download issue ([13da87a](https://github.com/NFDI4Chem/nmrxiv/commit/13da87a23c23ced2539cd446e1d239bc54264a94)) +* update postgres version to 15.4 ([87099f3](https://github.com/NFDI4Chem/nmrxiv/commit/87099f376aa0833c792bae48c2a2255043501ebf)) +* updated messages in the upload screen and also formatting changes ([40d147b](https://github.com/NFDI4Chem/nmrxiv/commit/40d147bd6ed0b9edafbf61a91a552d34ad2e9d0c)) +* various bug fixes and updates ([f7ca828](https://github.com/NFDI4Chem/nmrxiv/commit/f7ca828d6a04b8fc485645f54103fe4dac624477)) + ## [1.0.1-rc.8](https://github.com/NFDI4Chem/nmrxiv/compare/v1.0.0-rc.8...v1.0.1-rc.8) (2023-11-13) diff --git a/app/Console/Commands/ExtractSpectra.php b/app/Console/Commands/ExtractSpectra.php index ae6e55ec..359af77c 100644 --- a/app/Console/Commands/ExtractSpectra.php +++ b/app/Console/Commands/ExtractSpectra.php @@ -79,78 +79,87 @@ public function handle() } } }); - } else { + } + $study = $study->fresh(); + if ($study->has_nmrium) { $nmriumInfo = json_decode($study->nmrium['nmrium_info'], true); if (count($nmriumInfo['data']['spectra']) == 0) { echo '--MISSING SPECTRA INFO (NMRIUM JSON)--'; echo "\r\n"; - } - } - } catch (Exception $e) { - echo 'Caught exception: ', $e->getMessage(), "\n"; - } - $study = $study->fresh(); - foreach ($study->datasets as $dataset) { - // echo $dataset->identifier; - // echo "\r\n"; - // if(!$dataset->has_nmrium){ - $nmriumInfo = json_decode($study->nmrium['nmrium_info'], true); - $_nmriumJSON = $nmriumInfo; - $fsObject = $dataset->fsObject; + } else { + foreach ($study->datasets as $dataset) { + echo $dataset->identifier; + echo "\r\n"; + // if(!$dataset->has_nmrium){ + $nmriumInfo = json_decode($study->nmrium['nmrium_info'], true); + $_nmriumJSON = $nmriumInfo; + $fsObject = $dataset->fsObject; - $studyFSObject = $study->fsObject; - $datasetFSObject = $dataset->fsObject; - $path = '/'.$studyFSObject->name.'/'.$datasetFSObject->name; - // echo($path); - // echo "\r\n"; - $pathsMatch = false; - foreach ($nmriumInfo['data']['spectra'] as $spectra) { - unset($_nmriumJSON['data']['spectra']); - $files = $spectra['sourceSelector']['files']; - if ($files) { - foreach ($files as $file) { - if (str_contains($file, $path)) { - $pathsMatch = true; - } - } - } - if ($pathsMatch) { - break; - } - } - if (! $pathsMatch) { - echo $project->identifier; - echo "\r\n"; + $studyFSObject = $study->fsObject; + $datasetFSObject = $dataset->fsObject; + $path = '/'.$studyFSObject->name.'/'.$datasetFSObject->name; + // echo($path); + // echo "\r\n"; + $fsObject = $dataset->fsObject; + $studyFSObject = $study->fsObject; + $datasetFSObject = $dataset->fsObject; + $path = '/'.$studyFSObject->name.'/'.$datasetFSObject->name; - echo '===========> no match'; - echo "\r\n"; - } else { - $_nmriumJSON['data']['spectra'] = [$spectra]; - $_nmrium = $dataset->nmrium; - if ($_nmrium) { - $_nmrium->nmrium_info = json_encode($_nmriumJSON, JSON_UNESCAPED_UNICODE); - $dataset->has_nmrium = true; - $_nmrium->save(); - } else { - $_nmrium = NMRium::create([ - 'nmrium_info' => json_encode($_nmriumJSON, JSON_UNESCAPED_UNICODE), - ]); - $dataset->nmrium()->save($_nmrium); - $dataset->has_nmrium = true; - } - $experimentDetailsExists = array_key_exists('experiment', $spectra['info']); - if ($experimentDetailsExists) { - $experiment = $spectra['info']['experiment']; - $nucleus = $spectra['info']['nucleus']; - if (is_array($nucleus)) { - $nucleus = implode('-', $nucleus); + $pathsMatch = false; + $spectrum = []; + $type = []; + foreach ($nmriumInfo['data']['spectra'] as $spectra) { + unset($_nmriumJSON['data']['spectra']); + $files = $spectra['sourceSelector']['files']; + if ($files) { + foreach ($files as $file) { + if (str_contains($file, $path)) { + $pathsMatch = true; + } + } + } + if ($pathsMatch) { + array_push($spectrum, $spectra); + $experimentDetailsExists = array_key_exists('experiment', $spectra['info']); + if ($experimentDetailsExists) { + $experiment = $spectra['info']['experiment']; + $nucleus = $spectra['info']['nucleus']; + if (is_array($nucleus)) { + $nucleus = implode('-', $nucleus); + } + array_push($type, $experiment.' - '.$nucleus); + } + $pathsMatch = false; + } + } + if (count($spectrum) > 0) { + $_nmriumJSON['data']['spectra'] = $spectrum; + $_nmrium = $dataset->nmrium; + if ($_nmrium) { + $_nmrium->nmrium_info = json_encode($_nmriumJSON, JSON_UNESCAPED_UNICODE); + $dataset->has_nmrium = true; + $_nmrium->save(); + } else { + $_nmrium = NMRium::create([ + 'nmrium_info' => json_encode($_nmriumJSON, JSON_UNESCAPED_UNICODE), + ]); + $dataset->nmrium()->save($_nmrium); + $dataset->has_nmrium = true; + } + } + $uType = array_unique($type); + if (count($uType) == 1) { + $dataset->type = $uType[0]; + } + $dataset->save(); + // } } - $dataset->type = $experiment.','.$nucleus; } - $dataset->save(); } - // } + } catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n"; } + } } } diff --git a/app/Http/Controllers/DownloadController.php b/app/Http/Controllers/DownloadController.php index 9364f4ec..6ef0ebf3 100644 --- a/app/Http/Controllers/DownloadController.php +++ b/app/Http/Controllers/DownloadController.php @@ -102,17 +102,22 @@ public function downloadFromProject(Request $request, $username, $project, $key array_push($s3keys, substr($fsObj->path, 1)); } } else { - $command = $s3Client->getCommand('ListObjects'); - $command['Bucket'] = $bucket; + + $command = [ + 'Bucket' => $bucket, + ]; if ($path[0] == '/') { $command['Prefix'] = ltrim($path, $path[0]).'/'; } else { $command['Prefix'] = $path.'/'; } - $result = $s3Client->execute($command); - if ($result['Contents']) { - foreach ($result['Contents'] as $file) { - array_push($s3keys, $file['Key']); + $results = $s3Client->getPaginator('ListObjects', $command); + foreach ($results as $result) { + $contents = $result->get('Contents'); + if ($contents) { + foreach ($contents as $file) { + array_push($s3keys, $file['Key']); + } } } } diff --git a/app/Http/Controllers/DraftController.php b/app/Http/Controllers/DraftController.php index 2f4bc894..eacde9f6 100644 --- a/app/Http/Controllers/DraftController.php +++ b/app/Http/Controllers/DraftController.php @@ -548,7 +548,13 @@ public function isJcampDX($folder) $isDX = true; } - if ($isJDX || $isDX) { + $fileTypes = ['jcamp']; + $isJCAMP = false; + if (array_intersect($fileTypes, $extensions) == $fileTypes) { + $isJCAMP = true; + } + + if ($isJDX || $isDX || $isJCAMP) { return true; } diff --git a/app/Http/Controllers/StudyController.php b/app/Http/Controllers/StudyController.php index 787b71a0..21c06f4c 100644 --- a/app/Http/Controllers/StudyController.php +++ b/app/Http/Controllers/StudyController.php @@ -213,8 +213,10 @@ public function nmriumInfo(Request $request, Study $study) $studyFSObject = $study->fsObject; $datasetFSObject = $dataset->fsObject; $path = '/'.$studyFSObject->name.'/'.$datasetFSObject->name; - + $pathsMatch = false; + $spectrum = []; + $type = []; foreach ($nmriumInfo['data']['spectra'] as $spectra) { unset($_nmriumJSON['data']['spectra']); $files = $spectra['sourceSelector']['files']; @@ -226,11 +228,21 @@ public function nmriumInfo(Request $request, Study $study) } } if ($pathsMatch) { - break; + array_push($spectrum, $spectra); + $experimentDetailsExists = array_key_exists('experiment', $spectra['info']); + if ($experimentDetailsExists) { + $experiment = $spectra['info']['experiment']; + $nucleus = $spectra['info']['nucleus']; + if (is_array($nucleus)) { + $nucleus = implode('-', $nucleus); + } + array_push($type, $experiment.' - '.$nucleus); + } + $pathsMatch = false; } } - if ($pathsMatch){ - $_nmriumJSON['data']['spectra'] = [$spectra]; + if (count($spectrum) > 0) { + $_nmriumJSON['data']['spectra'] = $spectrum; $_nmrium = $dataset->nmrium; if ($_nmrium) { $_nmrium->nmrium_info = json_encode($_nmriumJSON, JSON_UNESCAPED_UNICODE); @@ -243,17 +255,13 @@ public function nmriumInfo(Request $request, Study $study) $dataset->nmrium()->save($_nmrium); $dataset->has_nmrium = true; } - $experimentDetailsExists = array_key_exists('experiment', $spectra['info']); - if ($experimentDetailsExists) { - $experiment = $spectra['info']['experiment']; - $nucleus = $spectra['info']['nucleus']; - if (is_array($nucleus)) { - $nucleus = implode('-', $nucleus); - } - $dataset->type = $experiment.','.$nucleus; - } - $dataset->save(); } + $uType = array_unique($type); + if (count($uType) == 1) { + $dataset->type = $uType[0]; + } + $dataset->save(); + } return $study->fresh(); diff --git a/app/Jobs/ArchiveProject.php b/app/Jobs/ArchiveProject.php index 1d248758..b203abca 100644 --- a/app/Jobs/ArchiveProject.php +++ b/app/Jobs/ArchiveProject.php @@ -72,17 +72,21 @@ public function handle(): void array_push($s3keys, substr($fsObject->path, 1)); } } else { - $command = $s3Client->getCommand('ListObjects'); - $command['Bucket'] = $bucket; + $command = [ + 'Bucket' => $bucket, + ]; if ($path[0] == '/') { $command['Prefix'] = ltrim($path, $path[0]).'/'; } else { $command['Prefix'] = $path.'/'; } - $result = $s3Client->execute($command); - if ($result['Contents']) { - foreach ($result['Contents'] as $file) { - array_push($s3keys, $file['Key']); + $results = $s3Client->getPaginator('ListObjects', $command); + foreach ($results as $result) { + $contents = $result->get('Contents'); + if ($contents) { + foreach ($contents as $file) { + array_push($s3keys, $file['Key']); + } } } } diff --git a/app/Jobs/ArchiveStudy.php b/app/Jobs/ArchiveStudy.php index f6111300..5ba6748b 100644 --- a/app/Jobs/ArchiveStudy.php +++ b/app/Jobs/ArchiveStudy.php @@ -59,17 +59,22 @@ public function handle(): void array_push($s3keys, substr($fsObject->path, 1)); } } else { - $command = $s3Client->getCommand('ListObjects'); - $command['Bucket'] = $bucket; + + $command = [ + 'Bucket' => $bucket, + ]; if ($path[0] == '/') { $command['Prefix'] = ltrim($path, $path[0]).'/'; } else { $command['Prefix'] = $path.'/'; } - $result = $s3Client->execute($command); - if ($result['Contents']) { - foreach ($result['Contents'] as $file) { - array_push($s3keys, $file['Key']); + $results = $s3Client->getPaginator('ListObjects', $command); + foreach ($results as $result) { + $contents = $result->get('Contents'); + if ($contents) { + foreach ($contents as $file) { + array_push($s3keys, $file['Key']); + } } } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a83c403d..747ebd94 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use Illuminate\Support\Facades\App; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -26,7 +27,7 @@ public function register() */ public function boot() { - if ($this->app->environment('production')) { + if (App::environment() == 'production') { \URL::forceScheme('https'); } } diff --git a/database/scripts/sync_index.sql b/database/scripts/sync_index.sql new file mode 100644 index 00000000..6fe93e66 --- /dev/null +++ b/database/scripts/sync_index.sql @@ -0,0 +1,50 @@ +SELECT setval('announcements_id_seq', max(id)) FROM announcements; +SELECT setval('assays_id_seq', max(id)) FROM assays; +SELECT setval('audits_id_seq', max(id)) FROM audits; +SELECT setval('author_project_id_seq', max(id)) FROM author_project; +SELECT setval('authors_id_seq', max(id)) FROM authors; +SELECT setval('citation_project_id_seq', max(id)) FROM citation_project; +SELECT setval('citations_id_seq', max(id)) FROM citations; +SELECT setval('dataset_invitations_id_seq', max(id)) FROM dataset_invitations; +SELECT setval('dataset_molecule_id_seq', max(id)) FROM dataset_molecule; +SELECT setval('dataset_user_id_seq', max(id)) FROM dataset_user; +SELECT setval('datasets_id_seq', max(id)) FROM datasets; +SELECT setval('drafts_id_seq', max(id)) FROM drafts; +SELECT setval('failed_jobs_id_seq', max(id)) FROM failed_jobs; +SELECT setval('file_system_objects_id_seq', max(id)) FROM file_system_objects; +SELECT setval('licenses_id_seq', max(id)) FROM licenses; +SELECT setval('linked_social_accounts_id_seq', max(id)) FROM linked_social_accounts; +SELECT setval('markable_reactions_id_seq', max(id)) FROM markable_reactions; +SELECT setval('markable_likes_id_seq', max(id)) FROM markable_likes; +SELECT setval('markable_favorites_id_seq', max(id)) FROM markable_favorites; +SELECT setval('markable_bookmarks_id_seq', max(id)) FROM markable_bookmarks; +SELECT setval('migrations_id_seq', max(id)) FROM migrations; +-- model_has_permissions -- combi +-- model_has_roles SELECT setval('molecule_sample_id_seq', max(id)) FROM molecule_sample; -- combi +SELECT setval('molecule_sample_id_seq', max(id)) FROM molecule_sample; +SELECT setval('molecules_id_seq', max(id)) FROM molecules; +SELECT setval('nmrium_id_seq', max(id)) FROM nmrium; +-- SELECT setval('notifications_id_seq', max(id)) FROM notifications; UUID +-- SELECT setval('password_resets_id_seq', max(id)) FROM password_resets; no pkey +SELECT setval('permissions_id_seq', max(id)) FROM permissions; +SELECT setval('personal_access_tokens_id_seq', max(id)) FROM personal_access_tokens; +SELECT setval('project_invitations_id_seq', max(id)) FROM project_invitations; +SELECT setval('project_user_id_seq', max(id)) FROM project_user; +SELECT setval('projects_id_seq', max(id)) FROM projects; +-- role_has_permissions SELECT setval('role_has_permissions_id_seq', max(id)) FROM role_has_permissions; -- combi +SELECT setval('roles_id_seq', max(id)) FROM roles; +SELECT setval('samples_id_seq', max(id)) FROM samples; +-- SELECT setval('sessions_id_seq', max(id)) FROM sessions; UUID +SELECT setval('studies_id_seq', max(id)) FROM studies; +SELECT setval('study_invitations_id_seq', max(id)) FROM study_invitations; +SELECT setval('study_user_id_seq', max(id)) FROM study_user; +-- SELECT setval('taggables_id_seq', max(id)) FROM taggables; no pkey +SELECT setval('tags_id_seq', max(id)) FROM tags; +SELECT setval('team_invitations_id_seq', max(id)) FROM team_invitations; +SELECT setval('team_user_id_seq', max(id)) FROM team_user; +SELECT setval('teams_id_seq', max(id)) FROM teams; +SELECT setval('templates_id_seq', max(id)) FROM templates; +SELECT setval('tickers_id_seq', max(id)) FROM tickers; +SELECT setval('users_id_seq', max(id)) FROM users; +SELECT setval('validations_id_seq', max(id)) FROM validations; +SELECT setval('versions_version_id_seq', max(version_id)) FROM versions; \ No newline at end of file diff --git a/resources/js/App/FAQs.vue b/resources/js/App/FAQs.vue new file mode 100644 index 00000000..7ac1a136 --- /dev/null +++ b/resources/js/App/FAQs.vue @@ -0,0 +1,77 @@ + + + diff --git a/resources/js/Layouts/AppLayout.vue b/resources/js/Layouts/AppLayout.vue index c46e6c7a..b33879ef 100644 --- a/resources/js/Layouts/AppLayout.vue +++ b/resources/js/Layouts/AppLayout.vue @@ -59,7 +59,7 @@
- + diff --git a/resources/js/Pages/Public/Project/Dataset.vue b/resources/js/Pages/Public/Project/Dataset.vue index f70c4f32..14ad36a0 100644 --- a/resources/js/Pages/Public/Project/Dataset.vue +++ b/resources/js/Pages/Public/Project/Dataset.vue @@ -1,18 +1,27 @@