Skip to content

Commit

Permalink
Fix alt cat not deleted and add tooltip to alt cat badge
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinlu3 committed Sep 12, 2024
1 parent 0fbffb5 commit f60ba40
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ const MutationCollapsibleTitle = ({ name, mutationAlterations, alterationCategor
<div className={classNames(shouldGroupBadges ? styles.flagWrapper : undefined)}>
{alterationCategories.flags.map(flag => {
const matchedFlagEntity = flagEntities.find(flagEntity => isFlagEqualToIFlag(flag, flagEntity));
return <DefaultBadge key={matchedFlagEntity?.flag || flag.flag} color={'primary'} text={matchedFlagEntity?.name || flag.flag} />;
return (
<DefaultBadge
key={matchedFlagEntity?.flag || flag.flag}
color={'primary'}
text={matchedFlagEntity?.name || flag.flag}
tooltipOverlay={matchedFlagEntity?.description ? matchedFlagEntity.description : undefined}
/>
);
})}
{tooltipOverlay ? <InfoIcon className="me-1" overlay={tooltipOverlay} /> : undefined}
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/app/shared/modal/AddMutationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,8 @@ function AddMutationModal({
if (field === 'comment') {
setStringMutationComment(value as string);
} else if (field === 'flags') {
/* eslint-disable no-console */
console.log('value is ', value);
const flagOptions = value as DropdownOption[];
setSelectedStringMutationFlags(flagOptions.map(option => option.value));
}
Expand Down Expand Up @@ -1199,7 +1201,7 @@ function AddMutationModal({

async function handleAlterationCategoriesConfirm() {
let newAlterationCategories: AlterationCategories | null = new AlterationCategories();
if (stringMutationComment === '' && selectedStringMutationFlags.length === 0) {
if (selectedStringMutationFlags.length === 0) {
newAlterationCategories = null;
} else {
newAlterationCategories.comment = stringMutationComment;
Expand Down Expand Up @@ -1240,9 +1242,7 @@ function AddMutationModal({
newMutation.name = newAlterations.map(alteration => alteration.name).join(', ');
newMutation.alterations = newAlterations;
const newAlterationCategories = await handleAlterationCategoriesConfirm();
if (newAlterationCategories) {
newMutation.alteration_categories = newAlterationCategories;
}
newMutation.alteration_categories = newAlterationCategories;

setErrorMessagesEnabled(false);
setIsConfirmPending(true);
Expand Down
3 changes: 1 addition & 2 deletions src/main/webapp/app/shared/model/firebase/firebase.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AlterationTypeEnum, Gene as OncoKBGene } from 'app/shared/api/generated
import { generateUuid } from 'app/shared/util/utils';
import _ from 'lodash';
import { ICancerType } from '../cancer-type.model';
import { IFlag } from '../flag.model';

export type MetaCollection = {
[hugoSymbol: string]: Meta;
Expand Down Expand Up @@ -215,7 +214,7 @@ export class Mutation {
mutation_effect: MutationEffect = new MutationEffect();
mutation_effect_uuid: string = generateUuid();
mutation_effect_comments?: Comment[] = []; // used for somatic
alteration_categories?: AlterationCategories;
alteration_categories?: AlterationCategories | null;
name: string = '';
name_comments?: Comment[] = [];
name_review?: Review;
Expand Down

0 comments on commit f60ba40

Please sign in to comment.