Skip to content

Commit

Permalink
Merge pull request #349 from NFDI4Chem/development
Browse files Browse the repository at this point in the history
Merge Development to Main.
  • Loading branch information
NishaSharma14 authored Aug 19, 2022
2 parents ca87ab8 + c1f59ae commit e278b97
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 29 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function downloadSet(Request $request, $username, $project, $study = null
$environment = env('APP_ENV', 'local');
$fsObj->path = $environment.'/'.$project->uuid;
$fsObj->key = $project->uuid;
$fsObj->relative_url = '/'.$project->uuid;
$request->merge(['uuid' => $project->uuid]);

return $this->downloadFromProject($request, $username, $project, $fsObj->key, $fsObj);
}
Expand Down
2 changes: 1 addition & 1 deletion config/jetstream.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Features::profilePhotos(),
Features::api(),
Features::teams(['invitations' => true]),
Features::accountDeletion(),
// Features::accountDeletion(),
],

/*
Expand Down
9 changes: 9 additions & 0 deletions resources/js/Mixins/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ export default {
isString(val) {
return typeof val === "string" || val instanceof String;
},
parseJSON(val){
if(!val){
return null
}
if(this.isString(val)){
return JSON.parse(val)
}
return null
}
},
computed: {
editable() {
Expand Down
16 changes: 15 additions & 1 deletion resources/js/Pages/Public/Project/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<div class="float-right">
<a
class="ml-4 cursor-pointer relative inline-flex items-center px-4 py-1 rounded-full border border-gray-300 bg-white text-sm font-black text-dark hover:bg-gray-50 focus:z-10 focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500"
:href="downloadURL"
>
Download
</a>
Expand Down Expand Up @@ -199,7 +200,20 @@ export default {
],
};
},
computed: {},
computed: {
downloadURL() {
return (
this.url +
"/" +
this.project.data.owner.username +
"/datasets/" +
this.project.data.slug
);
},
url() {
return String(this.$page.props.url);
},
},
mounted() {},
methods: {
toggleUpVote() {
Expand Down
22 changes: 11 additions & 11 deletions resources/js/Pages/Public/Project/Study.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,18 @@ export default {
};
iframe.postMessage({ type: `nmr-wrapper:load`, data }, "*");
} else {
console.log("Loading spectra from object");
let nmrium_info = JSON.parse(
this.selectedDataset.nmrium_info
);
let mols = JSON.parse(nmrium_info.molecules);
if (mols) {
this.currentMolecules = mols;
let nmrium_info = this.parseJSON(this.selectedDataset.nmrium_info)
let mols = []
if(nmrium_info.molecules){
let mols = this.parseJSON(nmrium_info.molecules);
if (mols) {
this.currentMolecules = mols;
mols.forEach((mol) => {
mol.molfile = "\n" + mol.molfile + "\n";
});
}
}
mols.forEach((mol) => {
mol.molfile = "\n" + mol.molfile + "\n";
});
let spectra = JSON.parse(nmrium_info.spectra);
let spectra = nmrium_info.spectra;
this.selectedSpectraData = spectra;
let data = {
data: {
Expand Down
18 changes: 9 additions & 9 deletions resources/js/Pages/Study/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
<dd
class="mt-1 text-md text-gray-900 space-y-5"
>
<p
style="max-width: 100ch !important"
class="prose mt-1 text-sm text-blue-gray-500"
v-html="md(study.description)"
></p>
<p
style="max-width: 100ch !important"
class="prose mt-1 text-sm text-blue-gray-500"
v-html="md(study.description)"
></p>
</dd>
</div>
<div class="mb-4">
Expand Down Expand Up @@ -176,10 +176,10 @@
v-if="license"
class="text-md text-gray-900 space-y-5"
>
<p
style="max-width: 100ch !important"
class="prose mt-1 text-sm text-blue-gray-500"
>
<p
style="max-width: 100ch !important"
class="prose mt-1 text-sm text-blue-gray-500"
>
{{ license.title }}
<ToolTip
v-if="study.license_id"
Expand Down
8 changes: 7 additions & 1 deletion resources/js/Pages/Study/Datasets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,13 @@ export default {
this.study.datasets[i] = response.data;
this.selectedDataset =
this.study.datasets[i];
this.selectedSpectraData = null;
let nmrium_info = JSON.parse(
this.selectedDataset.nmrium_info
);
if (nmrium_info) {
this.selectedSpectraData =
nmrium_info["spectra"];
}
}
i = i + 1;
});
Expand Down
27 changes: 21 additions & 6 deletions resources/js/Shared/Submission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1610,12 +1610,17 @@
>
Quick links
</h3>
<jet-button
type="submit"
class="mr-4 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"
<div
v-if="downloadURL"
class="ml-4 flex-shrink-0"
>
Download Zip
</jet-button>
<a
:href="downloadURL"
class="mr-4 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"
>
Download
</a>
</div>
<!-- <jet-button
type="submit"
class="mr-4 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"
Expand Down Expand Up @@ -2456,6 +2461,16 @@ export default {
return this.tabs.find((t) => t.current);
},
downloadURL() {
return (
this.url +
"/" +
this.project.owner.username +
"/datasets/" +
this.project.slug
);
},
nmriumURL() {
return this.$page.props.nmriumURL
? String(
Expand Down Expand Up @@ -3086,7 +3101,7 @@ export default {
this.studies.length - 1
) {
setTimeout(() => {
this.selectedDSIndex = 0;
this.selectedDSIndex = -1;
this.selectStudy(
this.studies[
this.selectedStudyIndex + 1
Expand Down

0 comments on commit e278b97

Please sign in to comment.