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 Apr 12, 2022
2 parents dfe4c89 + 4b26867 commit 847c0c4
Show file tree
Hide file tree
Showing 47 changed files with 776 additions and 768 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { TagLinkableOrganization } from "@app/components/organizations/organization-tag/organization-tag.component";
import { TagLinkableUser } from "@app/components/users/user-tag/user-tag.component";
import { environment } from "environments/environment";

interface SelectableAction { id: EventAction }

Expand Down Expand Up @@ -65,7 +66,11 @@ export class CvcEventFeedComponent implements OnInit {
showFilters: this.showFilters
}

this.queryRef = this.gql.watch(this.initialQueryVars, {});
if(environment.production) {
this.queryRef = this.gql.watch(this.initialQueryVars, {pollInterval: 30000});
} else {
this.queryRef = this.gql.watch(this.initialQueryVars);
}
this.results$ = this.queryRef.valueChanges;

this.pageInfo$ = this.results$.pipe(
Expand Down
2 changes: 2 additions & 0 deletions client/src/app/components/flags/flaggable/flaggable.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { NzTypographyModule } from 'ng-zorro-antd/typography';
import { NzBadgeModule } from 'ng-zorro-antd/badge';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { RouterModule } from '@angular/router';

@NgModule({
declarations: [CvcFlaggableComponent, CvcFlaggableOptionsDirective],
imports: [
CommonModule,
RouterModule,
NzIconModule,
NzBadgeModule,
NzToolTipModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
nzTheme="outline"></i>
</button>
<nz-badge [nzCount]="unreadCount"
nzShowZero
[nzOverflowCount]="999"
[nzStyle]="{ backgroundColor: '#096dd9', color: '#fff1f0', boxShadow: '0 0 0 1px #1890ff inset' }"
*nzSpaceItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Viewer, ViewerService } from '@app/core/services/viewer/viewer.service'
import { Maybe, ViewerNotificationCountGQL } from '@app/generated/civic.apollo';
import { startWith, map } from 'rxjs/operators';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { environment } from 'environments/environment';

@Component({
selector: 'cvc-viewer-button',
Expand All @@ -18,12 +19,19 @@ export class CvcViewerButtonComponent {

constructor(private queryService: ViewerService, private unreadCountGql: ViewerNotificationCountGQL) {
this.viewer$ = this.queryService.viewer$;
// this.unreadCount$ = this.unreadCountGql.watch(undefined, {pollInterval: 3000})
this.unreadCount$ = this.unreadCountGql.watch(undefined)
.valueChanges.pipe(
map(({data}) => data.notifications.unreadCount),
startWith(0)
)
if(environment.production) {
this.unreadCount$ = this.unreadCountGql.watch(undefined, {pollInterval: 5000})
.valueChanges.pipe(
map(({data}) => data.notifications.unreadCount),
startWith(0)
)
} else {
this.unreadCount$ = this.unreadCountGql.watch(undefined)
.valueChanges.pipe(
map(({data}) => data.notifications.unreadCount),
startWith(0)
)
}
}

signOut(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@
</td>
<td *ngIf="viewer.signedIn">
<nz-button-group>
<button [disabled]="suggestion.status != status.New"
<!-- <button [disabled]="suggestion.status != status.New" -->
<button [disabled]="true"
nz-button nzSize="small"
nz-tooltip nzTooltipTitle="Curate an Evidence Item from this Source Suggestion" >
nz-tooltip nzTooltipTitle="(Coming Soon) Curate an Evidence Item from this Source Suggestion" >
<i nz-icon nzType="plus"></i>
</button>
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
nzShowIcon></nz-alert>
<ng-template #successMessage
nzSize="small">
<p>View it on the <a routerLink="../../revisions">Revisions Page</a> or suggest another revision below.</p>
<p>View it on the <a routerLink="../../revisions">Revisions Page</a>.</p>
</ng-template>
</ng-container>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ensemblVersionValidator, EnsemblInputType, ensemblInputTypeOption, ense
import { FormlyModule } from '@ngx-formly/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
import { NzInputModule } from 'ng-zorro-antd/input';

@NgModule({
declarations: [EnsemblInputType],
Expand All @@ -16,7 +17,7 @@ import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
validators: [ensemblVersionValidator],
validationMessages: [ensemblVersionValidationMessage]
}),
NzInputNumberModule,
NzInputNumberModule
]
})
export class CvcEnsemblInputTypeModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const ensemblVersionValidator: ValidatorOption = {
return null;
} else {
let versionNum = +c.value;
if (versionNum < 76 || versionNum > 150) {
if (versionNum < 75 || versionNum > 150) {
return { 'ensembl-version': true };
}
return null;
Expand All @@ -41,7 +41,7 @@ export const ensemblVersionValidator: ValidatorOption = {
export const ensemblVersionValidationMessage: ValidationMessageOption = {
name: 'ensembl-version',
message: (_err: any, field: FormlyFieldConfig): string => {
return `${field.formControl?.value} is not a valid version of Ensembl. Must be an number between 76 and the latest version of Ensembl.`;
return `${field.formControl?.value} is not a valid version of Ensembl. Must be an number between 75 and the latest version of Ensembl.`;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div [ngClass]="{ 'hidden': to.hidden === true }">
<nz-form-item *ngIf="field.fieldGroup?.length === 0">
<nz-form-control [nzValidateStatus]="errorState"
[nzErrorTip]="errorTpl">
<nz-form-control [nzValidateStatus]="errorState">
<!--
<button nz-button
Expand All @@ -15,10 +14,6 @@
<i nz-icon nzType="plus"></i>
{{ to.addText }}
</nz-tag>
<ng-template #errorTpl
let-control>
<formly-validation-message [field]="field"></formly-validation-message>
</ng-template>
</nz-form-control>
</nz-form-item>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FieldType } from '@ngx-formly/core';
import { Maybe, Organization } from '@app/generated/civic.apollo';
import {TypeOption} from "@ngx-formly/core/lib/services/formly.config";

@Component({
selector: 'cvc-submit-button-type',
templateUrl: './submit-button.type.html',
styleUrls: ['./submit-button.type.less']
styleUrls: ['./submit-button.type.less'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SubmitButtonComponent extends FieldType {
_selectedOrg: Maybe<Organization> = undefined;
Expand Down
22 changes: 22 additions & 0 deletions client/src/app/forms/config/types/tag-input/tag-input.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TagInputType, TagInputTypeOption } from './tag-input.type';
import { ReactiveFormsModule } from '@angular/forms';
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';

// MultiFieldTypeOption,
@NgModule({
declarations: [TagInputType],
imports: [
CommonModule,
ReactiveFormsModule,
ReactiveComponentModule,
FormlyModule.forChild({ types: [TagInputTypeOption] }),
NzTagModule,
NzInputModule
]
})
export class CvcTagInputTypeModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<ng-container *ngIf="!formControl.value; else tagItem">
<input nz-input
[formControl]="formControl"
[formlyAttributes]="field"
(keydown.enter)="onEnter($event)"/>
</ng-container>
<ng-template #tagItem>
<nz-tag>{{formControl.value}}</nz-tag>
</ng-template>
Empty file.
41 changes: 41 additions & 0 deletions client/src/app/forms/config/types/tag-input/tag-input.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
ChangeDetectionStrategy,
Component,
} from '@angular/core';
import { FormControl } from '@angular/forms';
import { FieldType } from '@ngx-formly/core';
import { TypeOption } from "@ngx-formly/core/lib/services/formly.config";

@Component({
selector: 'cvc-tag-input-type',
templateUrl: './tag-input.type.html',
styleUrls: ['./tag-input.type.less'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TagInputType extends FieldType {
formControl!: FormControl;

constructor() {
super();
this.defaultOptions = {
templateOptions: {
placeholder: 'Enter value',
},
modelOptions: {
updateOn: 'blur'
}
};
}

onEnter(e: any): void {
const input = e.target as HTMLInputElement;
this.formControl.setValue(input.value);
}

}


export const TagInputTypeOption: TypeOption = {
name: 'tag-input',
component: TagInputType,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<textarea nz-input
[nzAutosize]="to.autosize"
[formControl]="formControl"
[formlyAttributes]="field"></textarea>
[formlyAttributes]="field"
[nzAutosize]="to.autosize"
[placeholder]="to.placeholder">
</textarea>
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,54 @@ import {
ReferenceBuild,
} from '@app/generated/civic.apollo';

export function toClinvarInput(
ids?: string[],
): ClinvarInput {
let na, nf;
if (ids && ids.includes('N/A')) {
ids = undefined;
nf = undefined;
na = true;
} else if (!ids) {
ids = undefined;
na = undefined;
nf = true;
}
export enum ClinvarOptions {
NotApplicable,
NoneFound,
Found
}

export function toClinvarInput( ids: string[], optionValue: ClinvarOptions ): ClinvarInput {
let na, nf: Maybe<boolean>;
let inputIds: Maybe<string[]>

if(optionValue == ClinvarOptions.Found) {
na = undefined
nf = undefined
inputIds = ids
} else if (optionValue == ClinvarOptions.NoneFound) {
nf = true
na = undefined
inputIds = undefined
} else {
na = true
nf = undefined
inputIds = undefined
}

return <ClinvarInput>{
ids: ids ? ids.map(id => +id) : undefined,
return {
ids: inputIds ? inputIds.map(id => +id) : undefined,
noneFound: nf,
notApplicable: na
};
}

export function toCoordinateInput(coord: Coordinate): CoordinateInput {
return <CoordinateInput>{
chromosome: undefinedIfEmpty(coord.chromosome),
representativeTranscript: undefinedIfEmpty(coord.representativeTranscript),
start: coord.start ? +coord.start: undefined,
stop: coord.stop ? +coord.stop: undefined,
};
export function toCoordinateInput(coord: Maybe<Coordinate>): CoordinateInput {
if (coord) {
return {
chromosome: undefinedIfEmpty(coord.chromosome),
representativeTranscript: undefinedIfEmpty(coord.representativeTranscript),
start: coord.start ? +coord.start: undefined,
stop: coord.stop ? +coord.stop: undefined,
};
}
else {
return {
chromosome: undefined,
representativeTranscript: undefined,
start: undefined,
stop: undefined,
}
}
}

export function toNullableReferenceBuildInput(
Expand Down Expand Up @@ -83,4 +103,4 @@ export const Chromosomes = [
{value: 'X', label: 'X'},
{value: 'Y', label: 'Y'},
{value: 'MT', label: 'MT'}
];
];
38 changes: 36 additions & 2 deletions client/src/app/forms/config/validators/default.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,52 @@ export const defaultMessages: ValidationMessageOption[] = [
return `Value must be an integer.`;
}
},

{
name: 'nucleotide',
message: (_err: any, ffc: FormlyFieldConfig): string => {
return `Value must only contain A, C, T, G, and/or /.`;
}
},
{
name: 'clinvar',
message: (_err: any, ffc: FormlyFieldConfig): string => {
return `Value must be an integer.`;
}
}
];

export const defaultValidators: ValidatorOption[] = [
{
name: 'integer',
validation: (fc: AbstractControl, ffc: FormlyFieldConfig): ValidationErrors | null => {
if (fc.value === '' || fc.value === undefined) {
if (fc.value === '' || fc.value === undefined || fc.value === null) {
return null;
} else {
return /^\d+$/.test(fc.value) ? null : { 'integer': true }
}
},
},
{
name: 'nucleotide',
validation: (fc: AbstractControl, ffc: FormlyFieldConfig): ValidationErrors | null => {
if (fc.value === '' || fc.value === undefined || fc.value === null) {
return null;
} else {
return /^[ACTG\/]+$/.test(fc.value) ? null : { 'nucleotide': true }
}
}
},
{
name: 'clinvar',
validation: (fc: AbstractControl, ffc: FormlyFieldConfig): ValidationErrors | null => {
for (var value of fc.value) {
if (!(value === '' || value === undefined || value === null)) {
if ( !(/^\d+$/.test(value)) ) {
return {'clinvar': true}
}
}
}
return null
}
}
];
Loading

0 comments on commit 847c0c4

Please sign in to comment.