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 Mar 7, 2024
2 parents 0feb1e3 + e629a86 commit 747853b
Show file tree
Hide file tree
Showing 27 changed files with 2,128 additions and 4,964 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}

Expand All @@ -24,9 +24,9 @@ jobs:
ruby-version: '3.0'

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- run: npm install -g yarn
working-directory: ./client
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit } from '@angular/core'
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Input,
OnDestroy,
OnInit,
} from '@angular/core'
import { UntypedFormGroup } from '@angular/forms'
import { NetworkErrorsService } from '@app/core/services/network-errors.service'
import { MutationState, MutatorWithState } from '@app/core/utilities/mutation-state-wrapper'
import { assertionReviseFormInitialModel, AssertionReviseModel } from '@app/forms/models/assertion-revise.model'
import {
MutationState,
MutatorWithState,
} from '@app/core/utilities/mutation-state-wrapper'
import {
assertionReviseFormInitialModel,
AssertionReviseModel,
} from '@app/forms/models/assertion-revise.model'
import { AssertionState } from '@app/forms/states/assertion.state'
import { AssertionRevisableFieldsGQL, Maybe, SuggestAssertionRevisionGQL, SuggestAssertionRevisionMutation, SuggestAssertionRevisionMutationVariables } from '@app/generated/civic.apollo'
import {
AssertionRevisableFieldsGQL,
Maybe,
SuggestAssertionRevisionGQL,
SuggestAssertionRevisionMutation,
SuggestAssertionRevisionMutationVariables,
} from '@app/generated/civic.apollo'
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core'
import { assertionReviseFields } from './assertion-revise.form.config'
import { assertionFormModelToReviseInput, assertionToModelFields } from '@app/forms/utilities/assertion-to-model-fields'
import {
assertionFormModelToReviseInput,
assertionToModelFields,
} from '@app/forms/utilities/assertion-to-model-fields'

@UntilDestroy()
@Component({
selector: 'cvc-assertion-revise-form',
templateUrl: './assertion-revise.form.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CvcAssertionReviseForm implements OnInit, AfterViewInit, OnDestroy {
export class CvcAssertionReviseForm
implements OnInit, AfterViewInit, OnDestroy
{
@Input() assertionId!: number

model?: AssertionReviseModel
Expand All @@ -40,20 +65,25 @@ export class CvcAssertionReviseForm implements OnInit, AfterViewInit, OnDestroy
private submitRevisionsGQL: SuggestAssertionRevisionGQL,
private networkErrorService: NetworkErrorsService,
private cdr: ChangeDetectorRef

) {
this.form = new UntypedFormGroup({})
this.fields = assertionReviseFields
this.state = new AssertionState()
this.options = { formState: this.state}
this.state.formMode = 'revise'
this.options = { formState: this.state }
this.reviseAssertionMutator = new MutatorWithState(networkErrorService)
}

onSubmit(model: AssertionReviseModel) {
if(!this.assertionId) { return }
if (!this.assertionId) {
return
}
let input = assertionFormModelToReviseInput(this.assertionId, model)
if (input) {
this.mutationState = this.reviseAssertionMutator.mutate(this.submitRevisionsGQL, {input: input })
this.mutationState = this.reviseAssertionMutator.mutate(
this.submitRevisionsGQL,
{ input: input }
)
}
}

Expand All @@ -62,26 +92,27 @@ export class CvcAssertionReviseForm implements OnInit, AfterViewInit, OnDestroy
}

ngAfterViewInit(): void {
this.revisableFieldsGQL.fetch({assertionId: this.assertionId})
.pipe(untilDestroyed(this))
.subscribe({
next: ({data: { assertion }}) => {
if (assertion) {
this.model = {
id: assertion.id,
fields: assertionToModelFields(assertion)
this.revisableFieldsGQL
.fetch({ assertionId: this.assertionId })
.pipe(untilDestroyed(this))
.subscribe({
next: ({ data: { assertion } }) => {
if (assertion) {
this.model = {
id: assertion.id,
fields: assertionToModelFields(assertion),
}
this.cdr.detectChanges()
}
this.cdr.detectChanges()
}
},
error: (error) => {
console.log("Error retrieving Assertion")
console.log(error)
},
complete: () => {
this.state.formReady$.next(true)
}
})
},
error: (error) => {
console.log('Error retrieving Assertion')
console.log(error)
},
complete: () => {
this.state.formReady$.next(true)
},
})
}

ngOnDestroy(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,18 @@ const formFieldConfig: FormlyFieldConfig[] = [
wrappers: ['form-field'],
props: {
label: 'Aliases',
description:
'List any aliases commonly used to refer to this Molecular Profile',
},
expressions: {
'props.disabled': (field: FormlyFieldConfig) => {
return field.options?.formState.isSimpleMp
},
'props.description': (field: FormlyFieldConfig) => {
if (field.options?.formState.isSimpleMp) {
return 'Simple Molecular Profiles inherit their Aliases from the corresponding Variant.'
} else {
return 'List any aliases commonly used to refer to this Molecular Profile'
}
},
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@ import {
ChangeDetectorRef,
Component,
Input,
OnInit, } from '@angular/core'
OnInit,
} from '@angular/core'
import { UntypedFormGroup } from '@angular/forms'
import { MolecularProfileRevisableFieldsGQL, SuggestMolecularProfileRevisionGQL, SuggestMolecularProfileRevisionMutation, SuggestMolecularProfileRevisionMutationVariables } from '@app/generated/civic.apollo'
import {
MolecularProfileRevisableFieldsGQL,
SuggestMolecularProfileRevisionGQL,
SuggestMolecularProfileRevisionMutation,
SuggestMolecularProfileRevisionMutationVariables,
} from '@app/generated/civic.apollo'
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core'
import { MutationState, MutatorWithState } from '@app/core/utilities/mutation-state-wrapper'
import {
MutationState,
MutatorWithState,
} from '@app/core/utilities/mutation-state-wrapper'
import { NetworkErrorsService } from '@app/core/services/network-errors.service'
import { MolecularProfileReviseModel } from '@app/forms/models/molecular-profile-revise.model'
import { molecularProfileFormModelToReviseInput, molecularProfileToModelFields } from '@app/forms/utilities/molecular-profile-to-model-fields'
import {
molecularProfileFormModelToReviseInput,
molecularProfileToModelFields,
} from '@app/forms/utilities/molecular-profile-to-model-fields'
import { molecularProfileReviseFields } from './molecular-profile-revise.form.config'

@UntilDestroy()
Expand Down Expand Up @@ -46,22 +58,6 @@ export class CvcMolecularProfileReviseForm implements OnInit, AfterViewInit {
this.form = new UntypedFormGroup({})
this.options = { formState: { isSimpleMp: undefined } }

const aliasField = molecularProfileReviseFields[0]?.fieldGroup?.find(f => f.key == 'fields')?.fieldGroup?.find(f => f.key == "aliases")
if (aliasField) {
const originalDescription = aliasField.props?.description
aliasField.expressions = {
'props.disabled': (field: FormlyFieldConfig) => {
return field.options?.formState.isSimpleMp
},
'props.description': (field: FormlyFieldConfig) => {
if(field.options?.formState.isSimpleMp) {
return 'Simple Molecular Profiles inherit their Aliases from the corresponding Variant.'
} else {
return originalDescription
}
},
}
}
this.fields = molecularProfileReviseFields
this.reviseEvidenceMutator = new MutatorWithState(networkErrorService)
}
Expand All @@ -77,7 +73,6 @@ export class CvcMolecularProfileReviseForm implements OnInit, AfterViewInit {
.subscribe({
next: ({ data: { molecularProfile } }) => {
if (molecularProfile) {

this.options.formState.isSimpleMp = !molecularProfile.isComplex

this.model = {
Expand All @@ -91,16 +86,23 @@ export class CvcMolecularProfileReviseForm implements OnInit, AfterViewInit {
console.error('Error retrieving MolecularProfile.')
console.error(error)
},
complete: () => {
},
complete: () => {},
})
}

onSubmit(model: MolecularProfileReviseModel) {
if(!this.molecularProfileId) {return}
let input = molecularProfileFormModelToReviseInput(this.molecularProfileId, model)
if (!this.molecularProfileId) {
return
}
let input = molecularProfileFormModelToReviseInput(
this.molecularProfileId,
model
)
if (input) {
this.mutationState = this.reviseEvidenceMutator.mutate(this.submitRevisionsGQL, { input: input })
this.mutationState = this.reviseEvidenceMutator.mutate(
this.submitRevisionsGQL,
{ input: input }
)
}
}
}
1 change: 0 additions & 1 deletion server/.browserslistrc

This file was deleted.

4 changes: 1 addition & 3 deletions server/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem 'puma', '5.6.8'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
gem 'webpacker', '6.0.0.rc.6'

gem 'rack-cors', '~> 1.1.1'

Expand Down Expand Up @@ -50,8 +50,6 @@ gem 'typhoeus', '~>1.4.0'

gem 'audited', '~> 5.3'

gem 'graphiql-rails', '~> 1.8.0'

#user comment rendering
gem 'rinku', '~> 2.0.6'
gem 'sanitize', '~> 6.0.2'
Expand Down
Loading

0 comments on commit 747853b

Please sign in to comment.