Skip to content

Commit

Permalink
Merge pull request #1345 from microbiomedata/update-funding-source-te…
Browse files Browse the repository at this point in the history
…xt-box

Update funding source entry text box and description
  • Loading branch information
pkalita-lbl authored Aug 21, 2024
2 parents 5fd1083 + ae0edc9 commit 5ad07cc
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 19 deletions.
2 changes: 0 additions & 2 deletions nmdc_server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,6 @@ def create_github_issue(submission, user):
omicsprocessingtypes = ", ".join(multiomicsform["omicsProcessingTypes"])
sampletype = ", ".join(submission.metadata_submission["templates"])
sampledata = submission.metadata_submission["sampleData"]
fundingsource = studyform["fundingSource"]
numsamples = 0
for key in sampledata:
numsamples = max(numsamples, len(sampledata[key]))
Expand Down Expand Up @@ -817,7 +816,6 @@ def create_github_issue(submission, user):
f"Data types: {omicsprocessingtypes}",
f"Sample type:{sampletype}",
f"Number of samples:{numsamples}",
f"Funding source:{fundingsource}",
] + valid_ids
body_string = " \n ".join(body_lis)
payload_dict = {
Expand Down
2 changes: 1 addition & 1 deletion nmdc_server/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class Meta:
"piEmail": "",
"piOrcid": "",
"linkOutWebpage": [],
"fundingSource": "",
"fundingSources": [],
"description": "",
"notes": "",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion nmdc_server/schemas_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class StudyForm(BaseModel):
piName: str
piEmail: str
piOrcid: str
fundingSource: Optional[str]
fundingSources: Optional[List[str]]
linkOutWebpage: List[str]
studyDate: Optional[str]
description: str
Expand Down
2 changes: 1 addition & 1 deletion web/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Definitions = {
piName: 'The Principal Investigator who led the study and/or generated the data.',
piEmail: 'An email address for the Principal Investigator.',
piOrcid: '<a href="https://orcid.org" target="_blank" rel="noopener noreferrer">ORCID iD</a> of the Principal Investigator.',
fundingSource: 'Source of funding for the study.',
fundingSources: 'The source of funding for your study. As an example please see <a href="https://data.microbiomedata.org/details/study/nmdc:sty-11-8fb6t785" target="_blank" rel="noopener noreferrer">study\'s funding source</a>.',
linkOutWebpage: 'Link to the Principal Investigator\'s research lab webpage or the study webpage associated with this collection of samples. Multiple links can be provided.',
studyDescription: 'Provide a description of your study. This should include some general context of your research goals and study design. For examples, please see existing study landing pages on <a href="http://data.microbiomedata.org" target="_blank" rel="noopener noreferrer">the data portal</a>.',
studyOptionalNotes: 'Add any additional notes or comments about this study.',
Expand Down
75 changes: 62 additions & 13 deletions web/src/views/SubmissionPortal/Components/StudyForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ export default defineComponent({
});
}
function addFundingSource() {
if (studyForm.fundingSources === null || studyForm.fundingSources.length === 0) {
studyForm.fundingSources = [''];
} else {
studyForm.fundingSources.push('');
}
}
function requiredRules(msg: string, otherRules: ((v: string) => unknown)[] = []) {
return [
(v: string) => !!v || msg,
Expand Down Expand Up @@ -94,6 +102,7 @@ export default defineComponent({
NmdcSchema,
Definitions,
addContributor,
addFundingSource,
requiredRules,
permissionLevelChoices,
isOwner,
Expand Down Expand Up @@ -203,19 +212,6 @@ export default defineComponent({
<span v-html="message" />
</template>
</v-textarea>
<v-text-field
v-model="studyForm.fundingSource"
label="Funding Source"
outlined
:hint="Definitions.fundingSource"
persistent-hint
dense
class="my-2"
>
<template #message="{ message }">
<span v-html="message" />
</template>
</v-text-field>
<v-text-field
v-model="studyForm.notes"
label="Optional Notes"
Expand All @@ -225,6 +221,59 @@ export default defineComponent({
dense
class="my-2"
/>
<div class="text-h4">
Funding Sources
</div>
<div class="text-body-1 mb-2">
{{ "Sources of funding for this study." }}
</div>
<div
v-for="_, i in studyForm.fundingSources"
:key="`fundingSource${i}`"
class="d-flex"
>
<v-card class="d-flex flex-column grow pa-4 mb-4">
<div class="d-flex">
<v-text-field
v-if="studyForm.fundingSources !== null"
v-model="studyForm.fundingSources[i]"
:rules="requiredRules('Field cannot be empty.')"
label="Funding Source *"
:hint="Definitions.fundingSources"
outlined
dense
persistent-hint
class="mb-2 mr-3"
>
<template #message="{ message }">
<span v-html="message" />
</template>
</v-text-field>
</div>
</v-card>
<v-btn
v-if="studyForm.fundingSources !== null"
icon
:disabled="!isOwner()"
@click="studyForm.fundingSources.splice(i, 1)"
>
<v-icon>mdi-minus-circle</v-icon>
</v-btn>
</div>
<v-btn
class="mb-4"
depressed
:disabled="!canEditSubmissionMetadata()"
@click="addFundingSource"
>
<v-icon class="pr-1">
mdi-plus-circle
</v-icon>
Add Funding Source
</v-btn>
<template #message="{ message }">
<span v-html="message" />
</template>
<div class="text-h4">
Contributors
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/SubmissionPortal/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const studyFormDefault = {
piOrcid: '',
linkOutWebpage: [],
studyDate: null,
fundingSource: '',
fundingSources: [] as string[] | null,
description: '',
notes: '',
contributors: [] as {
Expand Down

0 comments on commit 5ad07cc

Please sign in to comment.