-
Notifications
You must be signed in to change notification settings - Fork 1
[BI-1339] Germplasm Details page #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
48aa518
[BI-1339] Germplasm Details page
HMS17 2ad4233
Merge branch 'develop' of https://github.com/Breeding-Insight/bi-web …
HMS17 da4135c
Germplasm Retrieval and Display
HMS17 1766326
DateTime fix
HMS17 f6010dc
Linting
HMS17 6fb61e8
Linting again
HMS17 5393617
Linting some more
HMS17 3804d3c
Linting some more
HMS17 063dc18
Linting some more
HMS17 242f44f
Cleanup
HMS17 bedba79
Code review fixes
HMS17 2f73f76
Code review changes 3
HMS17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| import moment from "moment"; | ||
| import {Germplasm} from "@/breeding-insight/brapi/model/germplasm"; | ||
| import {ExternalReferences} from "@/breeding-insight/brapi/model/externalReferences"; | ||
|
|
||
| export class GermplasmUtils { | ||
| static getExternalUID(germplasm: Germplasm): string | undefined { | ||
| let val; | ||
| if (germplasm.externalReferences && germplasm.seedSource) { | ||
| val = germplasm.externalReferences!.filter(ref => ref.referenceSource == germplasm.seedSource!) | ||
| .map(ref => ref.referenceID); | ||
| return val ? val[0]: ""; | ||
| } | ||
| return ""; | ||
| } | ||
|
|
||
| static getCreatedDate(germplasm: Germplasm): string | undefined { | ||
| if (germplasm.additionalInfo && germplasm.additionalInfo.createdDate) { | ||
| let dateTime = moment(germplasm.additionalInfo!.createdDate!, "DD/MM/YYYY h:mm:ss"); | ||
| return dateTime.format("DD/MM/YYYY"); | ||
| } | ||
| return ""; | ||
| } | ||
|
|
||
| static getGermplasmUUID(references: ExternalReferences): string | undefined { | ||
| let val = references.find(ref => ref.referenceSource === process.env.VUE_APP_BI_REFERENCE_SOURCE); | ||
| return val ? val.referenceID : ""; | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| <!-- | ||
| - See the NOTICE file distributed with this work for additional information | ||
| - regarding copyright ownership. | ||
| - | ||
| - Licensed under the Apache License, Version 2.0 (the "License"); | ||
| - you may not use this file except in compliance with the License. | ||
| - You may obtain a copy of the License at | ||
| - | ||
| - http://www.apache.org/licenses/LICENSE-2.0 | ||
| - | ||
| - Unless required by applicable law or agreed to in writing, software | ||
| - distributed under the License is distributed on an "AS IS" BASIS, | ||
| - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| - See the License for the specific language governing permissions and | ||
| - limitations under the License. | ||
| --> | ||
|
|
||
| <template> | ||
| <div class="germplasm"> | ||
| <router-link v-bind:to="{name: 'germplasm-all', params: {programId: activeProgram.id}}"> | ||
| All Germplasm | ||
| </router-link> | ||
| <div class="mb-4"></div> | ||
| <h1 class="title"> | ||
| Germplasm Details | ||
| </h1> | ||
|
|
||
| <template v-if="!germplasmLoading && germplasm!=null"> | ||
| <div class="columns is-multiline is-align-items-stretch mt-4"> | ||
| <article class="column "> | ||
| <section> | ||
| <ul style="list-style-type: none;"> | ||
| <li><b>Preferred Name: </b> {{germplasm.defaultDisplayName}}</li> | ||
| <li><b>GID: </b> {{ germplasm.accessionNumber }}</li> | ||
| <li><b>Breeding Method: </b> {{ germplasm.additionalInfo.breedingMethod }}</li> | ||
| <li><b>Source: </b> {{ germplasm.seedSource }}</li> | ||
| <li><b>Pedigree: </b> {{ germplasm.additionalInfo.pedigreeByName }}</li> | ||
| <li><b>Pedigree GID(s): </b> {{ germplasm.pedigree }}</li> | ||
| </ul> | ||
| </section> | ||
| </article> | ||
| <article class="column px-2"> | ||
| <section> | ||
| <ul style="list-style-type: none;"> | ||
| <li><b>External UID: </b> {{ GermplasmUtils.getExternalUID(germplasm) }}</li> | ||
| <li><b>User: </b> {{ germplasm.additionalInfo.createdBy.userName }}</li> | ||
| <li><b>Creation Date: </b> {{ GermplasmUtils.getCreatedDate(germplasm) }}</li> | ||
| </ul> | ||
| </section> | ||
| </article> | ||
| </div> | ||
|
|
||
| <section> | ||
| <nav class="tabs is-boxed"> | ||
| <ul> | ||
| <router-link | ||
| v-bind:to="{name: '', params: {programId: activeProgram.id}}" | ||
| tag="li" | ||
| > | ||
| <a>Images</a> | ||
| </router-link> | ||
| <router-link | ||
| v-bind:to="{name: '', params: {programId: activeProgram.id}}" | ||
| tag="li" | ||
| > | ||
| <a>Pedigrees</a> | ||
| </router-link> | ||
| <router-link | ||
| v-bind:to="{name: '', params: {programId: activeProgram.id}}" | ||
| tag="li" | ||
| > | ||
| <a>Attributes</a> | ||
| </router-link> | ||
| </ul> | ||
| </nav> | ||
| </section> | ||
|
|
||
| <div class="tab-content"> | ||
| <router-view | ||
| @show-success-notification="$emit('show-success-notification', $event)" | ||
| @show-info-notification="$emit('show-info-notification', $event)" | ||
| @show-error-notification="$emit('show-error-notification', $event)" | ||
| /> | ||
| </div> | ||
| </template> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| import {Component, Watch} from 'vue-property-decorator' | ||
| import {mapGetters} from "vuex"; | ||
| import {Program} from "@/breeding-insight/model/Program"; | ||
| import GermplasmBase from "@/components/germplasm/GermplasmBase.vue"; | ||
| import {Germplasm} from "@/breeding-insight/brapi/model/germplasm"; | ||
| import {GermplasmService} from "@/breeding-insight/service/GermplasmService"; | ||
| import {GermplasmUtils} from '@/breeding-insight/utils/GermplasmUtils'; | ||
| import { Result } from '@/breeding-insight/model/Result'; | ||
|
|
||
| @Component({ | ||
| components: {}, | ||
| computed: { | ||
| ...mapGetters([ | ||
| 'activeProgram' | ||
| ]) | ||
| }, | ||
| data: () => ({GermplasmUtils}) | ||
| }) | ||
| export default class GermplasmDetails extends GermplasmBase { | ||
|
|
||
| private activeProgram?: Program; | ||
| private germplasm?: Germplasm; | ||
| private germplasmLoading: boolean = true; | ||
| private germplasmUUID: string = this.$route.params.germplasmId; | ||
|
|
||
| mounted() { | ||
| this.getGermplasm(); | ||
| } | ||
|
|
||
| async getGermplasm() { | ||
| this.germplasmLoading = true; | ||
| try { | ||
| const response: Result<Error, Germplasm> = await GermplasmService.getSingleGermplasm(this.activeProgram!.id!, this.germplasmUUID); | ||
| if(response.isErr()) throw response.value; | ||
| this.germplasm = response.value; | ||
| } catch (err) { | ||
| // Display error that germplasm cannot be loaded | ||
| this.$emit('show-error-notification', 'Error while trying to load germplasm'); | ||
| throw err; | ||
| } finally { | ||
| this.germplasmLoading = false | ||
| } | ||
| } | ||
ctucker3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| </script> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.