diff --git a/src/breeding-insight/model/Sort.ts b/src/breeding-insight/model/Sort.ts index 4ae6b2898..fddd724a6 100644 --- a/src/breeding-insight/model/Sort.ts +++ b/src/breeding-insight/model/Sort.ts @@ -55,7 +55,8 @@ export enum OntologySortField { MethodDescription = 'methodDescription', ScaleClass = 'scaleClass', ScaleName = 'scaleName', - entityAttributeSortLabel = 'entityAttribute' + entityAttributeSortLabel = 'entityAttribute', + TermType = 'termType' } export class OntologySort { diff --git a/src/breeding-insight/model/Trait.ts b/src/breeding-insight/model/Trait.ts index 214f9ce8a..9b1ad4da1 100644 --- a/src/breeding-insight/model/Trait.ts +++ b/src/breeding-insight/model/Trait.ts @@ -18,6 +18,7 @@ import {ProgramObservationLevel} from "@/breeding-insight/model/ProgramObservationLevel"; import {Method} from "@/breeding-insight/model/Method"; import {Scale} from "@/breeding-insight/model/Scale"; +import {TermType} from "@/breeding-insight/model/TraitSelector"; export class Trait { id?: string; @@ -35,6 +36,7 @@ export class Trait { tags?: string[] = []; fullName?: string; isDup?: boolean; + termType: TermType = TermType.PHENOTYPE; //Phenotype is default constructor(id?: string, traitName?: string, @@ -50,6 +52,7 @@ export class Trait { tags?: string[], fullName?: string, isDup?: boolean, + termType?: TermType ) { this.id = id; this.traitName = traitName; @@ -85,11 +88,14 @@ export class Trait { } this.fullName = fullName; this.isDup = isDup; + if (termType) { + this.termType = termType; + } } static assign(trait: Trait): Trait { return new Trait(trait.id, trait.traitName, trait.observationVariableName, trait.programObservationLevel, trait.entity, trait.attribute, - trait.traitDescription, trait.method, trait.scale, trait.synonyms, trait.active, trait.tags, trait.fullName, trait.isDup); + trait.traitDescription, trait.method, trait.scale, trait.synonyms, trait.active, trait.tags, trait.fullName, trait.isDup, trait.termType); } checkStringListEquals(list: string[] | undefined, otherList: string[] | undefined): boolean { @@ -111,6 +117,7 @@ export class Trait { (this.traitName === trait.traitName) && (this.observationVariableName === trait.observationVariableName) && (this.fullName === trait.fullName) && + (this.termType === trait.termType) && (this.checkStringListEquals(this.synonyms, trait.synonyms)) && (this.mainAbbreviation === trait.mainAbbreviation) && (this.entity === trait.entity) && diff --git a/src/breeding-insight/model/TraitSelector.ts b/src/breeding-insight/model/TraitSelector.ts index 9b651ac1b..55e4db337 100644 --- a/src/breeding-insight/model/TraitSelector.ts +++ b/src/breeding-insight/model/TraitSelector.ts @@ -18,7 +18,14 @@ export enum TraitField { CREATED_BY_USER_ID = 'createdByUserId', CREATED_BY_USER_NAME = 'createdByUserName', UPDATED_BY_USER_ID = 'updatedByUserId', - UPDATED_BY_USER_NAME = 'updatedByUserName' + UPDATED_BY_USER_NAME = 'updatedByUserName', + TERM_TYPE = 'termType' +} + +export enum TermType { + PHENOTYPE = 'Phenotype', + GERM_ATTRIBUTE = 'Germplasm Attribute', + GERM_PASSPORT = 'Germplasm Passport' } export class TraitFilter { diff --git a/src/breeding-insight/utils/EnumUtils.ts b/src/breeding-insight/utils/EnumUtils.ts new file mode 100644 index 000000000..58cb6082e --- /dev/null +++ b/src/breeding-insight/utils/EnumUtils.ts @@ -0,0 +1,28 @@ +/* + * 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. + */ + +export class EnumUtils { + static enumKeyToValue(enumKey: string, enumType: Object){ + let index = Object.keys(enumType).indexOf(enumKey); + return Object.values(enumType)[index]; + } + + static enumValueToKey(enumVal: string, enumType: Object){ + let index = Object.values(enumType).indexOf(enumVal); + return Object.keys(enumType)[index]; + } +} \ No newline at end of file diff --git a/src/breeding-insight/utils/TraitStringFormatters.ts b/src/breeding-insight/utils/TraitStringFormatters.ts index 48a61c111..1ae08827a 100644 --- a/src/breeding-insight/utils/TraitStringFormatters.ts +++ b/src/breeding-insight/utils/TraitStringFormatters.ts @@ -17,6 +17,8 @@ import {Scale, DataType} from "@/breeding-insight/model/Scale"; import {StringFormatters} from "@/breeding-insight/utils/StringFormatters"; +import {TermType} from "@/breeding-insight/model/TraitSelector"; +import {EnumUtils} from "@/breeding-insight/utils/EnumUtils"; export class TraitStringFormatters { @@ -32,4 +34,8 @@ export class TraitStringFormatters { return undefined; } + static getTermTypeString(termType: TermType): string | undefined { + return EnumUtils.enumKeyToValue(termType,TermType); + } + } \ No newline at end of file diff --git a/src/components/ontology/OntologyTable.vue b/src/components/ontology/OntologyTable.vue index 804a5c7d8..0ae2c148e 100644 --- a/src/components/ontology/OntologyTable.vue +++ b/src/components/ontology/OntologyTable.vue @@ -122,6 +122,18 @@ > {{ data.observationVariableName }} + + {{ TraitStringFormatters.getTermTypeString(data.termType) }} + {{data.traitDescription}} + +
+
+ Term Type +
+
+ {{TraitStringFormatters.getTermTypeString(data.termType)}} +
+
+