Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Jun 16, 2022
2 parents 81682a3 + fc10d75 commit 2ff9c56
Show file tree
Hide file tree
Showing 34 changed files with 213 additions and 41 deletions.
17 changes: 17 additions & 0 deletions client/src/app/directives/auto-focus/auto-focus.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Directive, ElementRef, Input } from '@angular/core';

@Directive({
selector: '[autofocus]'
})
export class CvcAutofocusDirective {
@Input() autofocus: 'click' | 'focus' = 'focus'
constructor(private host: ElementRef) {}

ngAfterViewInit() {
if (this.autofocus == 'click') {
this.host.nativeElement.click();
} else {
this.host.nativeElement.focus();
}
}
}
12 changes: 12 additions & 0 deletions client/src/app/directives/auto-focus/auto-focus.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CvcAutofocusDirective } from '../auto-focus/auto-focus.directive';

@NgModule({
declarations: [CvcAutofocusDirective],
imports: [
CommonModule
],
exports: [CvcAutofocusDirective],
})
export class CvcAutofocusModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
import { ReactiveComponentModule } from '@ngrx/component';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { CvcFormFieldWrapperModule } from '../../wrappers/form-field/form-field.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [AcmgCodeInputType],
Expand All @@ -23,7 +24,8 @@ import { CvcFormFieldWrapperModule } from '../../wrappers/form-field/form-field.
NzSpaceModule,
CvcPipesModule,
FormlyModule.forChild({types: [acmgCodeSelectTypeOption],}),
CvcFormFieldWrapperModule
CvcFormFieldWrapperModule,
CvcAutofocusModule
]
})
export class CvcAcmgCodeSelectTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else acmgCodeItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { NzButtonModule } from 'ng-zorro-antd/button';
import { CvcFormErrorsAlertModule } from '../../components/form-errors-alert/form-errors-alert.module';
import { NzInputModule } from 'ng-zorro-antd/input';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [DiseaseInputType],
Expand All @@ -28,7 +29,8 @@ import { CvcPipesModule } from '@app/core/pipes/pipes.module';
CvcFormErrorsAlertModule,
NzInputModule,
FormsModule,
CvcPipesModule
CvcPipesModule,
CvcAutofocusModule
],
})
export class CvcDiseaseInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else diseaseListItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { CvcFormErrorsAlertModule } from '../../components/form-errors-alert/for
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzInputModule } from 'ng-zorro-antd/input';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [DrugInputType],
Expand All @@ -28,7 +29,8 @@ import { CvcPipesModule } from '@app/core/pipes/pipes.module';
NzInputModule,
CvcDrugTagModule,
CvcFormErrorsAlertModule,
CvcPipesModule
CvcPipesModule,
CvcAutofocusModule
],
})
export class CvcDrugInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else drugListItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { NzInputModule } from 'ng-zorro-antd/input';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { EvidenceInputType, EvidenceInputTypeOption } from './evidence-input.type';
import { CvcEvidenceTagModule } from '@app/components/evidence/evidence-tag/evidence-tag.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [EvidenceInputType],
Expand All @@ -28,7 +29,8 @@ import { CvcEvidenceTagModule } from '@app/components/evidence/evidence-tag/evid
NzInputModule,
CvcEvidenceTagModule,
CvcFormErrorsAlertModule,
CvcPipesModule
CvcPipesModule,
CvcAutofocusModule
],
})
export class CvcEvidenceInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else eidListItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { NzSpaceModule } from 'ng-zorro-antd/space';
import { NzTypographyModule } from 'ng-zorro-antd/typography';
import { ReactiveComponentModule } from '@ngrx/component';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [GeneInputType],
Expand All @@ -21,7 +22,8 @@ import { CvcPipesModule } from '@app/core/pipes/pipes.module';
NzSpaceModule,
NzTypographyModule,
CvcGeneTagModule,
CvcPipesModule
CvcPipesModule,
CvcAutofocusModule
]
})
export class CvcGeneInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else geneListItem">
<nz-select #focusInput nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { FormlyModule } from '@ngx-formly/core';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { ReactiveComponentModule } from '@ngrx/component';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

// MultiFieldTypeOption,
@NgModule({
Expand All @@ -18,7 +19,8 @@ import { CvcPipesModule } from '@app/core/pipes/pipes.module';
FormlyModule.forChild({ types: [PhenotypeInputTypeOption] }),
NzSelectModule,
CvcPhenotypeTagModule,
CvcPipesModule
CvcPipesModule,
CvcAutofocusModule
]
})
export class CvcPhenotypeInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else drugListItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SourceSelectorTypeaheadType, SourceSelectorTypeaheadTypeOption } from '
import { ReactiveFormsModule } from '@angular/forms';
import { FormlyModule } from '@ngx-formly/core';
import { SourceSelectorLoaderModule } from '../source-selector-loader/source-selector-loader.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [SourceSelectorTypeaheadType],
Expand All @@ -14,6 +15,7 @@ import { SourceSelectorLoaderModule } from '../source-selector-loader/source-sel
FormlyModule.forChild({ types: [SourceSelectorTypeaheadTypeOption] }),
NzSelectModule,
SourceSelectorLoaderModule,
CvcAutofocusModule
]
})
export class CvcSourceSelectorTypeaheadTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
(ngModelChange)="to.modelChange($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FormlyModule } from '@ngx-formly/core';
import { ReactiveComponentModule } from '@ngrx/component';
import { NzTagModule } from 'ng-zorro-antd/tag';
import { NzInputModule } from 'ng-zorro-antd/input';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

// MultiFieldTypeOption,
@NgModule({
Expand All @@ -16,7 +17,8 @@ import { NzInputModule } from 'ng-zorro-antd/input';
ReactiveComponentModule,
FormlyModule.forChild({ types: [TagInputTypeOption] }),
NzTagModule,
NzInputModule
NzInputModule,
CvcAutofocusModule
]
})
export class CvcTagInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ng-container *ngIf="!formControl.value; else tagItem">
<input nz-input
autofocus="focus"
[formControl]="formControl"
[formlyAttributes]="field"
(keydown.enter)="onEnter($event)"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { NzIconModule } from 'ng-zorro-antd/icon';
import { CvcPipesModule } from '@app/core/pipes/pipes.module';
import { NzSpaceModule } from 'ng-zorro-antd/space';
import { NzTypographyModule } from 'ng-zorro-antd/typography';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [VariantInputType],
Expand All @@ -27,7 +28,8 @@ import { NzTypographyModule } from 'ng-zorro-antd/typography';
NzTypographyModule,
CvcVariantTagModule,
CvcFormErrorsAlertModule,
CvcPipesModule
CvcPipesModule,
CvcAutofocusModule
]
})
export class CvcVariantInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else variantListItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FormlyModule } from '@ngx-formly/core';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { ReactiveComponentModule } from '@ngrx/component';
import { CvcVariantTypeTagModule } from '@app/components/variant-types/variant-type-tag/variant-type-tag.module';
import { CvcAutofocusModule } from '@app/directives/auto-focus/auto-focus.module';

@NgModule({
declarations: [VariantTypeInputType],
Expand All @@ -15,7 +16,8 @@ import { CvcVariantTypeTagModule } from '@app/components/variant-types/variant-t
FormlyModule.forChild({ types: [VariantTypeInputTypeOption] }),
ReactiveComponentModule,
NzSelectModule,
CvcVariantTypeTagModule
CvcVariantTypeTagModule,
CvcAutofocusModule
]
})
export class CvcVariantTypeInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container *ngIf="!formControl.value?.id; else drugListItem">
<nz-select nzShowSearch
nzServerSearch
autofocus="click"
[formControl]="formControl"
[formlyAttributes]="field"
[nzPlaceHolder]="!to.placeholder ? null : to.placeholder"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class EvidenceReviseForm implements OnInit, AfterViewInit, OnDestroy {
phenotypeIds: fields.phenotypes.map((ph: FormPhenotype) => { return ph.id }),
rating: fields.evidenceRating!,
drugIds: fields.drugs.map((dr: FormDrug) => { return dr.id! }),
drugInteractionType: fmt.toNullableInput(fields.drugInteractionType)
drugInteractionType: fmt.toNullableInput(fields.drugs.length > 1 ? fields.drugInteractionType : undefined)
},
organizationId: model.fields.organization?.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export class EvidenceSubmitForm implements AfterViewInit, OnDestroy {
phenotypeIds: fields.phenotypes.map((ph: FormPhenotype) => { return ph.id }),
rating: +fields.evidenceRating,
drugIds: fields.drugs.map((dr: FormDrug) => { return dr.id! }),
drugInteractionType: fmt.toNullableInput(fields.drugInteractionType)
drugInteractionType: fmt.toNullableInput(fields.drugs.length > 1 ? fields.drugInteractionType : undefined)
},
comment: fields.comment && fields.comment.length > 0 ? fields.comment : undefined,
organizationId: model?.fields.organization?.id
Expand Down
47 changes: 47 additions & 0 deletions client/src/app/generated/civic.apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7436,6 +7436,24 @@ export type DiseaseDetailQuery = (
)> }
);

export type DiseasesSummaryQueryVariables = Exact<{
diseaseId: Scalars['Int'];
}>;


export type DiseasesSummaryQuery = (
{ __typename: 'Query' }
& { disease?: Maybe<(
{ __typename: 'Disease' }
& DiseasesSummaryFieldsFragment
)> }
);

export type DiseasesSummaryFieldsFragment = (
{ __typename: 'Disease' }
& Pick<Disease, 'id' | 'name' | 'doid' | 'diseaseUrl' | 'displayName' | 'diseaseAliases' | 'link'>
);

export type DrugDetailQueryVariables = Exact<{
drugId: Scalars['Int'];
}>;
Expand Down Expand Up @@ -9715,6 +9733,17 @@ export const AssertionSummaryFieldsFragmentDoc = gql`
}
}
`;
export const DiseasesSummaryFieldsFragmentDoc = gql`
fragment DiseasesSummaryFields on Disease {
id
name
doid
diseaseUrl
displayName
diseaseAliases
link
}
`;
export const DrugsSummaryFieldsFragmentDoc = gql`
fragment DrugsSummaryFields on Drug {
id
Expand Down Expand Up @@ -12886,6 +12915,24 @@ export const DiseaseDetailDocument = gql`
export class DiseaseDetailGQL extends Apollo.Query<DiseaseDetailQuery, DiseaseDetailQueryVariables> {
document = DiseaseDetailDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
}
}
export const DiseasesSummaryDocument = gql`
query DiseasesSummary($diseaseId: Int!) {
disease(id: $diseaseId) {
...DiseasesSummaryFields
}
}
${DiseasesSummaryFieldsFragmentDoc}`;

@Injectable({
providedIn: 'root'
})
export class DiseasesSummaryGQL extends Apollo.Query<DiseasesSummaryQuery, DiseasesSummaryQueryVariables> {
document = DiseasesSummaryDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
</nz-page-header-extra>
<nz-page-header-content>
<div class="content">
<nz-descriptions nzSize="small"
[nzColumn]="1"
nzBordered="true">
<nz-descriptions-item *ngIf="disease.diseaseAliases.length > 0"
nzTitle="Aliases"
nzSpan="2">
{{ disease.diseaseAliases.join(", ") }}
</nz-descriptions-item>
</nz-descriptions>
<router-outlet></router-outlet>
</div>
</nz-page-header-content>
Expand Down
Loading

0 comments on commit 2ff9c56

Please sign in to comment.