Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
susannasiebert committed Apr 15, 2022
2 parents 701934e + 800a203 commit 9f2bc6c
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<th nzWidth="3%"
[nzColumnKey]="sortColumns.EvidenceItemsCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count"><i nz-icon
nzType="civic:evidence"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
nzRight
[nzColumnKey]="sortColumns.SourceCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Source Count">
<i nz-icon nzType="civic:source"></i>
Expand All @@ -30,6 +31,7 @@
nzRight
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count">
<i nz-icon nzType="civic:evidence"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,31 @@
<th nzWidth="8%"
[nzColumnKey]="sortColumns.GeneCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Gene Count">
<i nz-icon nzType="civic:gene"></i>
</th>
<th nzWidth="8%"
[nzColumnKey]="sortColumns.VariantCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Variant Count">
<i nz-icon nzType="civic:variant"></i>
</th>
<th nzWidth="8%"
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count">
<i nz-icon nzType="civic:evidence"></i>
</th>
<th nzWidth="8%"
[nzColumnKey]="sortColumns.AssertionCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Assertion Count">
<i nz-icon nzType="civic:assertion"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<th nzWidth="10%"
nzRight
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortDirections]="['descend', 'ascend', null]"
[nzSortFn]="true"
nz-tooltip
nzTooltipTitle="Evidence Count">
Expand All @@ -29,6 +30,7 @@
<th nzWidth="10%"
nzRight
[nzColumnKey]="sortColumns.AssertionCount"
[nzSortDirections]="['descend', 'ascend', null]"
[nzSortFn]="true"
nz-tooltip
nzTooltipTitle="Assertion Count">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
</th>
<th nzWidth="5%"
[nzColumnKey]="sortColumns.EvidenceRating"
[nzSortDirections]="['descend', 'ascend', null]"
[nzSortFn]="true"
nzAlign="center"
nz-tooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
nzRight
[nzColumnKey]="sortColumns.VariantCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Variant Count">
<i nz-icon nzType="civic:variant"></i>
Expand All @@ -34,6 +35,7 @@
nzRight
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count">
<i nz-icon nzType="civic:evidence"></i>
Expand All @@ -42,6 +44,7 @@
nzRight
[nzColumnKey]="sortColumns.AssertionCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Assertion Count">
<i nz-icon nzType="civic:assertion"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
nzRight
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count">
<i nz-icon nzType="civic:evidence"></i>
Expand All @@ -30,6 +31,7 @@
nzRight
[nzColumnKey]="sortColumns.AssertionCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Assertion Count">
<i nz-icon nzType="civic:assertion"></i>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges, Output, EventEmitter, OnDestroy} from '@angular/core';
import { AcceptRevisionGQL, AcceptRevisionMutation, AcceptRevisionMutationVariables, Maybe, Organization, RejectRevisionGQL, RejectRevisionMutation, RejectRevisionMutationVariables, Revision, ValidateRevisionsForAcceptanceGQL, ValidateRevisionsForAcceptanceQuery, ValidateRevisionsForAcceptanceQueryVariables, ValidationErrorFragment } from '@app/generated/civic.apollo';
import { Observable, Subject, Subscription } from 'rxjs';
import { AcceptRevisionGQL, AcceptRevisionMutation, AcceptRevisionMutationVariables, Maybe, Organization, RejectRevisionGQL, RejectRevisionMutation, RejectRevisionMutationVariables, Revision, ValidateRevisionsForAcceptanceGQL, ValidateRevisionsForAcceptanceQuery, ValidateRevisionsForAcceptanceQueryVariables, ValidationErrorFragment, VariantDetailGQL } from '@app/generated/civic.apollo';
import { Observable, Subject } from 'rxjs';
import { Viewer, ViewerService } from '@app/core/services/viewer/viewer.service';
import { MutationState, MutatorWithState } from '@app/core/utilities/mutation-state-wrapper';
import { NetworkErrorsService } from '@app/core/services/network-errors.service';
import { map, startWith, takeUntil } from 'rxjs/operators';
import { QueryRef } from 'apollo-angular';
import { InternalRefetchQueryDescriptor } from '@apollo/client/core/types';

type SuccessType = false | 'accepted' | 'rejected'

Expand All @@ -16,6 +17,7 @@ type SuccessType = false | 'accepted' | 'rejected'
})
export class RevisionListComponent implements OnInit, OnChanges, OnDestroy {
@Input() revisions?: Revision[];
@Input() refetchQuery!: InternalRefetchQueryDescriptor

mostRecentOrg!: Maybe<Organization>;

Expand Down Expand Up @@ -54,7 +56,7 @@ export class RevisionListComponent implements OnInit, OnChanges, OnDestroy {
private networkErrorService: NetworkErrorsService,
private acceptRevisionsGql: AcceptRevisionGQL,
private rejectRevisionsGql: RejectRevisionGQL,
private validationGql: ValidateRevisionsForAcceptanceGQL
private validationGql: ValidateRevisionsForAcceptanceGQL,
) {
this.acceptRevisionsMutator= new MutatorWithState(networkErrorService)
this.rejectRevisionsMutator = new MutatorWithState(networkErrorService)
Expand Down Expand Up @@ -143,7 +145,10 @@ export class RevisionListComponent implements OnInit, OnChanges, OnDestroy {
ids: this.selectedRevisionIds,
organizationId: this.mostRecentOrg?.id,
comment: this.revisionComment
}
},
},
{
refetchQueries: [this.refetchQuery]
})
this.setupMutationResultHandlers(state, 'rejected')
}
Expand All @@ -157,6 +162,9 @@ export class RevisionListComponent implements OnInit, OnChanges, OnDestroy {
organizationId: this.mostRecentOrg?.id,
comment: this.revisionComment === "" ? undefined : this.revisionComment
}
},
{
refetchQueries: [this.refetchQuery]
})
this.setupMutationResultHandlers(state, 'accepted')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<nz-row [nzGutter]="16">
<nz-col nzSpan="18">
<nz-space nzDirection="vertical">
<cvc-revision-list [revisions]="revisions$ | ngrxPush" (revisionSetSelectedEvent)="onRevisionSetSelected($event)" (revisionMutationCompleted)="refresh()" *nzSpaceItem></cvc-revision-list>
<cvc-revision-list [revisions]="revisions$ | ngrxPush" (revisionSetSelectedEvent)="onRevisionSetSelected($event)" (revisionMutationCompleted)="refresh()"
[refetchQuery]="this.refetchQuery" *nzSpaceItem></cvc-revision-list>
<ng-container *ngrxLet="pageInfo$ as pageInfo">
<ng-container *ngIf="pageInfo?.hasNextPage">
<button nz-button nzBlock nzType="default" (click)="loadMore(pageInfo?.endCursor)" *nzSpaceItem>Load More</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { RevisionsGQL, RevisionsQuery, RevisionsQueryVariables, Maybe, Organization, RevisionFragment, ModeratedEntities, RevisionStatus, PageInfo } from '@app/generated/civic.apollo';
import { RevisionsGQL, RevisionsQuery, RevisionsQueryVariables, Maybe, RevisionFragment, ModeratedEntities, RevisionStatus, PageInfo, VariantDetailGQL, AssertionDetailGQL, GeneDetailGQL, EvidenceDetailGQL, VariantGroupDetailGQL} from '@app/generated/civic.apollo';
import { Observable, Subscription } from 'rxjs';
import { QueryRef } from 'apollo-angular';
import { map, pluck, startWith } from 'rxjs/operators';
import { InternalRefetchQueryDescriptor } from '@apollo/client/core/types';

export interface SelectableFieldName {
id: number
Expand Down Expand Up @@ -55,9 +56,16 @@ export class RevisionsListAndFilterComponent implements OnDestroy, OnInit {

private defaultPageSize = 10

refetchQuery!: InternalRefetchQueryDescriptor

constructor(
private gql: RevisionsGQL,
private route: ActivatedRoute
private route: ActivatedRoute,
private variantDetailGql: VariantDetailGQL,
private variantGroupDetailGql: VariantGroupDetailGQL,
private assertionDetailGql: AssertionDetailGQL,
private geneDetailGql: GeneDetailGQL,
private evidenceDetailGql: EvidenceDetailGQL,
) {
}

Expand Down Expand Up @@ -109,6 +117,39 @@ export class RevisionsListAndFilterComponent implements OnDestroy, OnInit {
pluck('data', 'revisions', 'unfilteredCountForSubject')
)
});

switch (this.entityType) {
case ModeratedEntities.Variant:
this.refetchQuery = {
query: this.variantDetailGql.document,
variables: { variantId: this.id }
}
return
case ModeratedEntities.Assertion:
this.refetchQuery = {
query: this.assertionDetailGql.document,
variables: { assertionId: this.id }
}
return
case ModeratedEntities.EvidenceItem:
this.refetchQuery = {
query: this.evidenceDetailGql.document,
variables: { evidenceId: this.id }
}
return
case ModeratedEntities.Gene:
this.refetchQuery = {
query: this.geneDetailGql.document,
variables: { geneId: this.id }
}
return
case ModeratedEntities.VariantGroup:
this.refetchQuery = {
query: this.variantGroupDetailGql.document,
variables: { variantGroupId: this.id }
}
return
}
}

ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<th nzRight
[nzColumnKey]="sortColumns.EvidenceCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count">
<i nz-icon nzType="civic:evidence"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
<th nzWidth="10%"
[nzColumnKey]="sortColumns.VariantCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Variant Count">
<i nz-icon nzType="civic:variant"></i>
</th>
<th nzWidth="10%"
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Count">
<i nz-icon nzType="civic:evidence"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
nzRight
[nzColumnKey]="sortColumns.VariantCount"
[nzSortFn]="true"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Variant Count">
<i nz-icon nzType="civic:variant"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@
nzRight
[nzSortFn]="true"
[nzColumnKey]="sortColumns.EvidenceScore"
[nzSortDirections]="['descend', 'ascend', null]"
nz-tooltip
nzTooltipTitle="Evidence Score"><div style="min-width: 60px; text-align: right;">
<i nz-icon nzType="civic:evidence"></i>&nbsp;Score
</div></th>
<th nzWidth="3%"
nzRight
[nzColumnKey]="sortColumns.EvidenceItemCount"
[nzSortDirections]="['descend', 'ascend', null]"
[nzSortFn]="true"
nz-tooltip
nzTooltipTitle="Evidence Count"><i nz-icon nzType="civic:evidence"></i></th>
<th nzWidth="3%"
nzRight
[nzColumnKey]="sortColumns.AssertionCount"
[nzSortDirections]="['descend', 'ascend', null]"
[nzSortFn]="true"
nz-tooltip
nzTooltipTitle="Assertion Count"><i nz-icon nzType="civic:assertion"></i></th>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/core/pipes/color-name-for-status-pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class ColorNameForStatusPipe implements PipeTransform {
transform(status: Maybe<EvidenceStatus>): string {
switch(status) {
case(EvidenceStatus.Accepted):
return 'default'
return 'green'
case(EvidenceStatus.Rejected):
return 'red'
case(EvidenceStatus.Submitted):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class IconNameForSubscribableEntity implements PipeTransform {
return 'civic:variant';
case SubscribableEntities.VariantGroup:
case 'VARIANT_GROUP':
case 'VariantGrou':
case 'VariantGroup':
return 'civic:variant-group';
default:
console.log('String No icon name found for ' + e);
Expand Down
6 changes: 3 additions & 3 deletions client/src/app/core/utilities/mutation-state-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BehaviorSubject, Subject } from "rxjs";
import { Mutation} from 'apollo-angular'
import { EmptyObject } from "apollo-angular/types";
import { EmptyObject, MutationOptionsAlone } from "apollo-angular/types";
import { NetworkErrorsService } from "../services/network-errors.service";
import { finalize, takeUntil } from "rxjs/operators";
import { ApolloError, FetchResult } from '@apollo/client/core';
Expand All @@ -16,7 +16,7 @@ export class MutatorWithState<M extends Mutation<T, V>, T extends {}, V extends
constructor(private networkErrorService: NetworkErrorsService) { }

//TODO - define the data callback in terms of M, not any
mutate(mutation: M, vars: V, dataCallback?: (data: any) => void): MutationState {
mutate(mutation: M, vars: V, options?: MutationOptionsAlone<T, V>, dataCallback?: (data: any) => void): MutationState {
let destroy$ = new Subject();

let stateVals = {
Expand All @@ -28,7 +28,7 @@ export class MutatorWithState<M extends Mutation<T, V>, T extends {}, V extends

stateVals.isSubmitting$.next(true)

mutation.mutate(vars)
mutation.mutate(vars, options)
.pipe(
takeUntil(destroy$),
finalize(() => { stateVals.isSubmitting$.next(false)})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class AssertionSubmitForm implements OnDestroy {

let state = this.submitAssertionMutator.mutate(this.submitAssertionGQL, {
input: input
},
}, {},
(data) => {
this.newId = data.submitAssertion.assertion.id;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class DiseaseInputType extends FieldType implements AfterViewInit, OnInit
addDisease(diseaseName: string): void {
if(diseaseName && diseaseName != '') {
let doid = +this.enteredDoid ? +this.enteredDoid : undefined
let state = this.addDiseaseMutator.mutate(this.addDiseaseGQL, { name: diseaseName, doid: doid },
let state = this.addDiseaseMutator.mutate(this.addDiseaseGQL, { name: diseaseName, doid: doid }, {},
(data) => {
this.field.formControl?.setValue( {id: data.addDisease.disease.id, name: data.addDisease.disease.name} )
this.to.searchString = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class DrugInputType extends FieldType implements AfterViewInit, OnInit, O

addDrug(drugName: string): void {
if(drugName && drugName != '') {
let state = this.addDrugMutator.mutate(this.addDrugGQL, { name: drugName },
let state = this.addDrugMutator.mutate(this.addDrugGQL, { name: drugName }, {},

(data) => {
this.field.formControl?.setValue( {id: data.addDrug.drug.id, name: data.addDrug.drug.name} )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class EnsemblInputType extends FieldType {
export const ensemblVersionValidator: ValidatorOption = {
name: 'ensembl-version',
validation: (c: AbstractControl, f: FormlyFieldConfig): ValidationErrors | null => {
if (c.value === undefined) {
if (c.value === undefined || c.value === null) {
return null;
} else {
let versionNum = +c.value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class VariantInputType extends FieldType implements OnInit, AfterViewInit

addVariant(variantName: string): void {
if(variantName && variantName != '' && this.to.geneId) {
let state = this.addVariantMutator.mutate(this.addVariantGQL, { name: variantName, geneId: this.to.geneId },
let state = this.addVariantMutator.mutate(this.addVariantGQL, { name: variantName, geneId: this.to.geneId }, {},
(data) => {
this.field.formControl?.setValue( {id: data.addVariant.variant.id, name: data.addVariant.variant.name})
this.to.searchString = '';
Expand Down
Loading

0 comments on commit 9f2bc6c

Please sign in to comment.