diff --git a/CHANGELOG.md b/CHANGELOG.md
index cff589ad..b257d0e2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,15 @@
# Changelog
+## [1.0.1-rc.8](https://github.com/NFDI4Chem/nmrxiv/compare/v1.0.0-rc.8...v1.0.1-rc.8) (2023-11-13)
+
+
+### Bug Fixes
+
+* resolved [#888](https://github.com/NFDI4Chem/nmrxiv/issues/888) ([bb6da86](https://github.com/NFDI4Chem/nmrxiv/commit/bb6da86da78d2e7f451abb56c2187e18043e6847))
+* updated dataset spectra loading logic and other minor updates ([e854cbb](https://github.com/NFDI4Chem/nmrxiv/commit/e854cbbd1c4c1681c79f128d8bd4f43b1f2524a1))
+* updated DOIBadge component and various other fixes/updates ([ca36ea6](https://github.com/NFDI4Chem/nmrxiv/commit/ca36ea63dd99cd53b875ef2d43ffd2e528438670))
+* updated nmrium info save routine ([5f22551](https://github.com/NFDI4Chem/nmrxiv/commit/5f225518eb7df42aaec30ff67b7f72df298c2742))
+
## 1.0.0 (2023-11-10)
diff --git a/app/Console/Commands/ArchiveData.php b/app/Console/Commands/ArchiveData.php
index 7f6bf796..1c0e5986 100644
--- a/app/Console/Commands/ArchiveData.php
+++ b/app/Console/Commands/ArchiveData.php
@@ -36,8 +36,8 @@ public function handle()
])->get();
foreach ($projects as $project) {
- echo($project->identifier);
- echo("\r\n");
+ echo $project->identifier;
+ echo "\r\n";
ArchiveProject::dispatch($project);
ArchiveStudy::dispatch($project);
}
diff --git a/app/Console/Commands/ExtractSpectra.php b/app/Console/Commands/ExtractSpectra.php
index d471e39c..ae6e55ec 100644
--- a/app/Console/Commands/ExtractSpectra.php
+++ b/app/Console/Commands/ExtractSpectra.php
@@ -35,6 +35,7 @@ public function handle()
])->get();
foreach ($projects as $project) {
+ echo "\r\n";
echo $project->identifier;
echo "\r\n";
$studies = $project->studies;
@@ -90,61 +91,63 @@ public function handle()
}
$study = $study->fresh();
foreach ($study->datasets as $dataset) {
- echo $dataset->identifier;
- echo "\r\n";
+ // echo $dataset->identifier;
+ // echo "\r\n";
// if(!$dataset->has_nmrium){
$nmriumInfo = json_decode($study->nmrium['nmrium_info'], true);
$_nmriumJSON = $nmriumInfo;
$fsObject = $dataset->fsObject;
- $level = -($fsObject->level);
- // echo $fsObject->path;
- // echo("\r\n");
- // echo $study->name;
- // echo("\r\n");
- $path = $study->name.'/'.$dataset->name;
+
+ $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'];
- // echo($path);
- // echo("\r\n");
- $pathsMatch = true;
if ($files) {
foreach ($files as $file) {
- // echo $file;
- // echo "\r\n";
- if (! str_contains($file, $path)) {
- $pathsMatch = false;
+ if (str_contains($file, $path)) {
+ $pathsMatch = true;
}
}
}
- // echo($pathsMatch);
- // echo("\r\n");
if ($pathsMatch) {
- $_nmriumJSON['data']['spectra'] = [$spectra];
- // dd($_nmriumJSON);
- $_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);
- }
- $dataset->type = $experiment.','.$nucleus;
+ break;
+ }
+ }
+ if (! $pathsMatch) {
+ echo $project->identifier;
+ echo "\r\n";
+
+ 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);
}
- $dataset->save();
+ $dataset->type = $experiment.','.$nucleus;
}
+ $dataset->save();
}
// }
}
@@ -154,7 +157,7 @@ public function handle()
public function processSpectra($url)
{
- $response = Http::timeout(300)->post('https://nodejsdev.nmrxiv.org/spectra-parser', [
+ $response = Http::timeout(300)->post('https://nodejs.nmrxiv.org/spectra-parser', [
'urls' => [$url],
'snapshot' => false,
]);
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 5ad1b15a..a4b62bca 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -4,6 +4,7 @@
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
+use Illuminate\Support\Facades\App;
class Kernel extends ConsoleKernel
{
diff --git a/app/Http/Controllers/DatasetController.php b/app/Http/Controllers/DatasetController.php
index 1254d5c7..f1bcbf5b 100644
--- a/app/Http/Controllers/DatasetController.php
+++ b/app/Http/Controllers/DatasetController.php
@@ -31,7 +31,7 @@ public function fetchNMRium(Request $request, Dataset $dataset)
if ($dataset) {
$nmrium = $dataset->nmrium;
if ($nmrium) {
- return $nmrium;
+ return json_decode($nmrium->nmrium_info);
} else {
return null;
}
diff --git a/app/Http/Controllers/StudyController.php b/app/Http/Controllers/StudyController.php
index 8253e010..787b71a0 100644
--- a/app/Http/Controllers/StudyController.php
+++ b/app/Http/Controllers/StudyController.php
@@ -209,45 +209,50 @@ public function nmriumInfo(Request $request, Study $study)
$_nmriumJSON = $nmriumInfo;
foreach ($study->datasets as $dataset) {
$fsObject = $dataset->fsObject;
- $level = -($fsObject->level + 1);
- // echo $fsObject->path;
- $path = implode('/', array_slice(explode('/', $fsObject->path), $level));
+
+ $studyFSObject = $study->fsObject;
+ $datasetFSObject = $dataset->fsObject;
+ $path = '/'.$studyFSObject->name.'/'.$datasetFSObject->name;
+
+ $pathsMatch = false;
foreach ($nmriumInfo['data']['spectra'] as $spectra) {
unset($_nmriumJSON['data']['spectra']);
$files = $spectra['sourceSelector']['files'];
- $pathsMatch = true;
if ($files) {
foreach ($files as $file) {
- if (! str_contains($file, $path)) {
- $pathsMatch = false;
+ if (str_contains($file, $path)) {
+ $pathsMatch = true;
}
}
}
if ($pathsMatch) {
- $_nmriumJSON['data']['spectra'] = [$spectra];
- $_nmrium = $dataset->nmrium;
- if ($_nmrium) {
- $_nmrium->nmrium_info = $_nmriumJSON;
- $dataset->has_nmrium = true;
- $_nmrium->save();
- } else {
- $_nmrium = NMRium::create([
- 'nmrium_info' => json_encode($_nmriumJSON),
- ]);
- $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;
+ break;
+ }
+ }
+ if ($pathsMatch){
+ $_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);
}
- $dataset->save();
+ $dataset->type = $experiment.','.$nucleus;
}
+ $dataset->save();
}
}
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 5eab1ffb..a83c403d 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -26,8 +26,8 @@ public function register()
*/
public function boot()
{
- // if ($this->app->environment('production')) {
- // \URL::forceScheme('https');
- // }
+ if ($this->app->environment('production')) {
+ \URL::forceScheme('https');
+ }
}
}
diff --git a/resources/js/Mixins/Global.js b/resources/js/Mixins/Global.js
index bcf2084f..09a896dc 100644
--- a/resources/js/Mixins/Global.js
+++ b/resources/js/Mixins/Global.js
@@ -74,13 +74,15 @@ export default {
return str;
},
- copyToClipboard(text, id) {
- document.getElementById(id).select();
- copyText(text, undefined, (error, event) => {
+ copyToClipboard(text, element) {
+ if (typeof element == "string") {
+ document.getElementById(id).select();
+ } else {
+ element.select();
+ }
+ copyText(text, undefined, (error) => {
if (error) {
console.log(error);
- } else {
- // console.log(event)
}
});
},
diff --git a/resources/js/Pages/Project/Show.vue b/resources/js/Pages/Project/Show.vue
index 3a90d71c..4f0426ac 100644
--- a/resources/js/Pages/Project/Show.vue
+++ b/resources/js/Pages/Project/Show.vue
@@ -306,7 +306,7 @@
v-if="project.identifier"
class="text-gray-400 mt-2"
>
-
+