diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index c8030afcf..8cd480adb 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -21,7 +21,7 @@ import { GraphQLModule } from '@app/graphql/graphql.module' import { NzIconModule } from 'ng-zorro-antd/icon' import { CvcNetworkErrorAlertModule } from './components/app/network-error-alert/network-error-alert.module' import { Observable } from 'rxjs' -import { AppLoadErrorHandler } from './core/utilities/app-reload-handler' +import { AppErrorHandler } from './core/utilities/app-error-handler' import { CvcForms2Module } from '@app/forms/forms.module' registerLocaleData(en) @@ -59,7 +59,7 @@ function initializeApiFactory(httpClient: HttpClient): () => Observable { CookieService, { provide: ErrorHandler, - useClass: AppLoadErrorHandler, + useClass: AppErrorHandler, }, { provide: NZ_I18N, useValue: en_US }, { diff --git a/client/src/app/components/variants/variants-menu/variants-menu.component.ts b/client/src/app/components/variants/variants-menu/variants-menu.component.ts index 016225b7e..2fdf78169 100644 --- a/client/src/app/components/variants/variants-menu/variants-menu.component.ts +++ b/client/src/app/components/variants/variants-menu/variants-menu.component.ts @@ -86,8 +86,7 @@ export class CvcVariantsMenuComponent implements OnInit { ) this.menuVariants$ = connection$.pipe( - map((c) => c.nodes), - filter(isNonNulled) + map((c) => c.edges.map((e) => e.node), filter(isNonNulled)) ) this.totalVariants$ = connection$.pipe(map((c) => c.totalCount)) diff --git a/client/src/app/components/variants/variants-menu/variants-menu.gql b/client/src/app/components/variants/variants-menu/variants-menu.gql index 90aaed734..86108f911 100644 --- a/client/src/app/components/variants/variants-menu/variants-menu.gql +++ b/client/src/app/components/variants/variants-menu/variants-menu.gql @@ -27,8 +27,11 @@ query VariantsMenu( hasPreviousPage hasNextPage } - nodes { - ...menuVariant + edges{ + cursor + node { + ...menuVariant + } } } } diff --git a/client/src/app/core/utilities/app-error-handler.ts b/client/src/app/core/utilities/app-error-handler.ts new file mode 100644 index 000000000..2ad71b5b4 --- /dev/null +++ b/client/src/app/core/utilities/app-error-handler.ts @@ -0,0 +1,22 @@ +import { ErrorHandler, Injectable } from '@angular/core' +import { environment } from 'environments/environment' + +@Injectable() +export class AppErrorHandler implements ErrorHandler { + handleError(error: any): void { + if (environment.production) { + const chunkFailedMessage = /Loading chunk [\d]+ failed/ + if (chunkFailedMessage.test(error.message)) { + if ( + confirm( + 'There is an updated version of CiVIC available. Click OK to reload.' + ) + ) { + window.location.reload() + } + } + } else { + console.error(error) + } + } +} diff --git a/client/src/app/core/utilities/app-reload-handler.ts b/client/src/app/core/utilities/app-reload-handler.ts deleted file mode 100644 index 9b0c3aab7..000000000 --- a/client/src/app/core/utilities/app-reload-handler.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ErrorHandler, Injectable } from '@angular/core' - -@Injectable() -export class AppLoadErrorHandler implements ErrorHandler { - handleError(error: any): void { - const chunkFailedMessage = /Loading chunk [\d]+ failed/ - if (chunkFailedMessage.test(error.message)) { - if ( - confirm( - 'There is an updated version of CiVIC available. Click OK to reload.' - ) - ) { - window.location.reload() - } - } - } -} diff --git a/client/src/app/generated/civic.apollo.ts b/client/src/app/generated/civic.apollo.ts index fddac1228..6115ff425 100644 --- a/client/src/app/generated/civic.apollo.ts +++ b/client/src/app/generated/civic.apollo.ts @@ -90,7 +90,7 @@ export type ActivityInterface = { /** The connection type for ActivityInterface. */ export type ActivityInterfaceConnection = { __typename: 'ActivityInterfaceConnection'; - /** List of activity types that have occured on this entity. */ + /** List of activity types that have occurred on this entity. */ activityTypes: Array; /** A list of edges. */ edges: Array; @@ -1594,7 +1594,7 @@ export type EventConnection = { __typename: 'EventConnection'; /** A list of edges. */ edges: Array; - /** List of event types that have occured on this entity. */ + /** List of event types that have occurred on this entity. */ eventTypes: Array; /** A list of nodes. */ nodes: Array; @@ -3305,7 +3305,7 @@ export enum MolecularProfileDisplayFilter { WithAccepted = 'WITH_ACCEPTED', /** Display only molecular profiles which have evidence in either an accepted or submitted state. */ WithAcceptedOrSubmitted = 'WITH_ACCEPTED_OR_SUBMITTED', - /** Display molecular profiles which have at least one submited evidence item. */ + /** Display molecular profiles which have at least one submitted evidence item. */ WithSubmitted = 'WITH_SUBMITTED' } @@ -3415,7 +3415,7 @@ export type Mutation = { */ rejectRevisions?: Maybe; /** - * Resolve a flag on a CIViC entity indicating that it was either erronously flagged or the issue has been resolved. + * Resolve a flag on a CIViC entity indicating that it was either erroneously flagged or the issue has been resolved. * Any user may resolve their own flag however only editors with valid conflict * of interest statements can resolve other flags. */ @@ -3448,7 +3448,7 @@ export type Mutation = { suggestVariantGroupRevision?: Maybe; /** Unsubscribe from a CIViC entity to stop receiving notifications about it. */ unsubscribe?: Maybe; - /** Update the currentlly logged in User's Conflict of Interest statement */ + /** Update the currently logged in User's Conflict of Interest statement */ updateCoi?: Maybe; /** Mark one or more notifications as read/unread. The notification IDs provided must belong to the requesting user. */ updateNotificationStatus?: Maybe; @@ -3765,7 +3765,7 @@ export type NotificationConnection = { __typename: 'NotificationConnection'; /** A list of edges. */ edges: Array; - /** List of event types that have occured on this entity. */ + /** List of event types that have occurred on this entity. */ eventTypes: Array; /** Users who have mentioned you. */ mentioningUsers: Array; @@ -4265,6 +4265,8 @@ export type QueryActivitiesArgs = { first?: InputMaybe; last?: InputMaybe; mode?: InputMaybe; + occuredAfter?: InputMaybe; + occuredBefore?: InputMaybe; organizationId?: InputMaybe>; sortBy?: InputMaybe; subject?: InputMaybe>; @@ -7590,7 +7592,7 @@ export type VariantsMenuQueryVariables = Exact<{ }>; -export type VariantsMenuQuery = { __typename: 'Query', variants: { __typename: 'VariantInterfaceConnection', totalCount: number, pageInfo: { __typename: 'PageInfo', startCursor?: string | undefined, endCursor?: string | undefined, hasPreviousPage: boolean, hasNextPage: boolean }, nodes: Array<{ __typename: 'FactorVariant', id: number, name: string, link: string, flagged: boolean } | { __typename: 'GeneVariant', id: number, name: string, link: string, flagged: boolean } | { __typename: 'Variant', id: number, name: string, link: string, flagged: boolean }> } }; +export type VariantsMenuQuery = { __typename: 'Query', variants: { __typename: 'VariantInterfaceConnection', totalCount: number, pageInfo: { __typename: 'PageInfo', startCursor?: string | undefined, endCursor?: string | undefined, hasPreviousPage: boolean, hasNextPage: boolean }, edges: Array<{ __typename: 'VariantInterfaceEdge', cursor: string, node?: { __typename: 'FactorVariant', id: number, name: string, link: string, flagged: boolean } | { __typename: 'GeneVariant', id: number, name: string, link: string, flagged: boolean } | { __typename: 'Variant', id: number, name: string, link: string, flagged: boolean } | undefined }> } }; export type VariantTypesForFeatureQueryVariables = Exact<{ featureId?: InputMaybe; @@ -13347,8 +13349,11 @@ export const VariantsMenuDocument = gql` hasPreviousPage hasNextPage } - nodes { - ...menuVariant + edges { + cursor + node { + ...menuVariant + } } } } diff --git a/server/app/jobs/flag_duplicate_allele_registry_ids.rb b/server/app/jobs/flag_duplicate_allele_registry_ids.rb index 0d5e20c33..6867bd4cd 100644 --- a/server/app/jobs/flag_duplicate_allele_registry_ids.rb +++ b/server/app/jobs/flag_duplicate_allele_registry_ids.rb @@ -11,7 +11,7 @@ def perform variants = Variant.where(id: ids) variants.each do |variant| if variant.flags.select{|f| f.state == 'open' && f.open_activity.note =~ /This Variant may be a duplicate and may need to be deprecated/ && f.open_activity.user_id == 385}.count == 0 - Activity::FlagEntity.new( + Activities::FlagEntity.new( flagging_user: civicbot_user, flaggable: variant, organization_id: nil, diff --git a/server/app/lib/importer/disease_ontology_mirror.rb b/server/app/lib/importer/disease_ontology_mirror.rb index 0b1036e60..a72bf3518 100644 --- a/server/app/lib/importer/disease_ontology_mirror.rb +++ b/server/app/lib/importer/disease_ontology_mirror.rb @@ -142,8 +142,8 @@ def url_from_doid(doid) def add_flags(disease, text) civicbot_user = User.find(385) (disease.evidence_items + disease.assertions).each do |obj| - if obj.flags.select{|f| f.state == 'open' && f.open_activity.note == text && c.open_activity.user_id == 385}.count == 0 - Activity::FlagEntity.new( + if obj.flags.select{|f| f.state == 'open' && f.open_activity.note == text && f.open_activity.user_id == 385}.count == 0 + Activities::FlagEntity.new( flagging_user: civicbot_user, flaggable: obj, organization_id: nil, diff --git a/server/app/lib/importer/sequence_ontology_mirror.rb b/server/app/lib/importer/sequence_ontology_mirror.rb index 3f3edf7cd..d9efecb3a 100644 --- a/server/app/lib/importer/sequence_ontology_mirror.rb +++ b/server/app/lib/importer/sequence_ontology_mirror.rb @@ -91,12 +91,12 @@ def process_obsolete_terms text += " Replaced by #{term['replaced_by']}." end obsolete_type.variants.each do |variant| - if variant.flags.select{|f| f.state == 'open' && f.comments.select{|c| c.text =~ /obsolete Sequence Ontology term/ && c.user_id == 385}.count > 0}.count == 0 - Actions::FlagEntity.new( + if variant.flags.select{|f| f.state == 'open' && f.open_activity.note =~ /obsolete Sequence Ontology term/ && f.open_activity.user_id == 385}.count == 0 + Activities::FlagEntity.new( flagging_user: civicbot_user, flaggable: variant, organization_id: nil, - comment: text + note: text ).perform end end diff --git a/server/app/lib/scrapers/human_phenotype_ontology.rb b/server/app/lib/scrapers/human_phenotype_ontology.rb index c703ce834..507003afb 100644 --- a/server/app/lib/scrapers/human_phenotype_ontology.rb +++ b/server/app/lib/scrapers/human_phenotype_ontology.rb @@ -44,7 +44,7 @@ def self.update civicbot_user = User.find(385) (p.evidence_items + p.assertions).each do |obj| if obj.flags.select{|f| f.state == 'open' && f.open_activity.note =~ /deprecated HPO term/ && f.open_activity.user_id == 385}.count == 0 - Activity::FlagEntity.new( + Activities::FlagEntity.new( flagging_user: civicbot_user, flaggable: obj, organization_id: nil, diff --git a/server/config/initializers/sidekiq.rb b/server/config/initializers/sidekiq.rb index 4e30c283e..4fb3e6c59 100644 --- a/server/config/initializers/sidekiq.rb +++ b/server/config/initializers/sidekiq.rb @@ -7,7 +7,7 @@ config.on(:startup) do schedule_file = Rails.root.join("config", "scheduled_tasks.yml") - if File.exists?(schedule_file) && Rails.env.production? + if File.exist?(schedule_file) && Rails.env.production? Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) end end