diff --git a/end-to-end-test/remote/specs/core/results.logic.spec.js b/end-to-end-test/remote/specs/core/results.logic.spec.js index 5c929106d42..4dd5a3e59f5 100644 --- a/end-to-end-test/remote/specs/core/results.logic.spec.js +++ b/end-to-end-test/remote/specs/core/results.logic.spec.js @@ -295,6 +295,24 @@ describe('case set selection in modify query form', function() { }); }); +describe('gene list input', function() { + beforeEach(function() { + var url = `${CBIOPORTAL_URL}/index.do?cancer_study_id=coadread_tcga_pub&Z_SCORE_THRESHOLD=2&RPPA_SCORE_THRESHOLD=2&data_priority=0&case_set_id=coadread_tcga_pub_rppa&gene_list=KRAS%2520NRAS%2520BRAF&geneset_list=+&tab_index=tab_visualize&Action=Submit&genetic_profile_ids_PROFILE_MUTATION_EXTENDED=coadread_tcga_pub_mutations&genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION=coadread_tcga_pub_gistic`; + goToUrlAndSetLocalStorage(url); + $('#modifyQueryBtn').waitForExist({ timeout: 60000 }); + }); + + // we're testing this because it was broken + it('allows gene textarea update', () => { + $('#modifyQueryBtn').click(); + const textarea = getElementByTestHandle('geneSet'); + textarea.waitForDisplayed(); + textarea.setValue('TP53 BRAF'); + + assert(textarea.getValue() === 'TP53 BRAF'); + }); +}); + describe('genetic profile selection in modify query form', function() { beforeEach(function() { var url = `${CBIOPORTAL_URL}/index.do?cancer_study_id=chol_tcga&Z_SCORE_THRESHOLD=2.0&RPPA_SCORE_THRESHOLD=2.0&data_priority=0&case_set_id=chol_tcga_all&gene_list=EGFR&geneset_list=+&tab_index=tab_visualize&Action=Submit&genetic_profile_ids_PROFILE_MUTATION_EXTENDED=chol_tcga_mutations&genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION=chol_tcga_gistic&genetic_profile_ids_PROFILE_PROTEIN_EXPRESSION=chol_tcga_rppa_Zscores`; diff --git a/package.json b/package.json index 4e9d359091b..137164e024b 100644 --- a/package.json +++ b/package.json @@ -224,7 +224,6 @@ "mobx-react-lite": "3.0.1", "mobx-react-router": "4.1.0", "mobx-utils": "6.0.1", - "mobxpromise": "github:cbioportal/mobxpromise#c3429672eb39be54e54ce14a8636e8d843729db3", "numeral": "^2.0.6", "object-sizeof": "^1.2.0", "oncokb-frontend-commons": "^0.0.21", diff --git a/packages/cbioportal-frontend-commons/package.json b/packages/cbioportal-frontend-commons/package.json index 1c4dc26fc9d..107c8b86b69 100644 --- a/packages/cbioportal-frontend-commons/package.json +++ b/packages/cbioportal-frontend-commons/package.json @@ -43,7 +43,6 @@ "jquery": "^3.2.1", "lodash": "^4.17.15", "measure-text": "0.0.4", - "mobxpromise": "github:cbioportal/mobxpromise#303db72588860bff0a6862a4f07a4e8a3578c94f", "numeral": "^2.0.6", "object-sizeof": "^1.2.0", "oncokb-ts-api-client": "^1.3.3", diff --git a/packages/cbioportal-frontend-commons/src/api/remoteData.ts b/packages/cbioportal-frontend-commons/src/api/remoteData.ts index 0a46b4bfcaa..14d5a97d67d 100644 --- a/packages/cbioportal-frontend-commons/src/api/remoteData.ts +++ b/packages/cbioportal-frontend-commons/src/api/remoteData.ts @@ -3,8 +3,8 @@ import { MobxPromise, MobxPromiseFactory, MobxPromiseInputUnion, - hasObservers, -} from 'mobxpromise'; +} from '../lib/MobxPromise'; +import { hasObservers } from '../lib/mobxPromiseUtils'; type errorHandler = (error: Error) => void; diff --git a/packages/cbioportal-frontend-commons/src/index.tsx b/packages/cbioportal-frontend-commons/src/index.tsx index dfe10eb2950..938c9d46be6 100644 --- a/packages/cbioportal-frontend-commons/src/index.tsx +++ b/packages/cbioportal-frontend-commons/src/index.tsx @@ -53,6 +53,8 @@ export * from './lib/TextTruncationUtils'; export * from './lib/urls'; export * from './lib/webdriverUtils'; export * from './lib/TickUtils'; +export * from './lib/MobxPromise'; +export * from './lib/mobxPromiseUtils'; export { default as CBIOPORTAL_VICTORY_THEME } from './theme/cBioPortalTheme'; export * from './theme/cBioPortalTheme'; diff --git a/packages/cbioportal-frontend-commons/src/lib/MobxPromise.ts b/packages/cbioportal-frontend-commons/src/lib/MobxPromise.ts new file mode 100644 index 00000000000..1dd04f2d7ca --- /dev/null +++ b/packages/cbioportal-frontend-commons/src/lib/MobxPromise.ts @@ -0,0 +1,305 @@ +import { observable, action, computed, makeObservable } from 'mobx'; + +/** + * This tagged union type describes the interoperability of MobxPromise properties. + */ +type MobxPromiseStatus = 'pending' | 'error' | 'complete'; +export type MobxPromiseUnionType = ( + | { + status: 'pending'; + isPending: true; + isError: false; + isComplete: false; + result: R | undefined; + error: Error | undefined; + } + | { + status: 'error'; + isPending: false; + isError: true; + isComplete: false; + result: R | undefined; + error: Error; + } + | { + status: 'complete'; + isPending: false; + isError: false; + isComplete: true; + result: R; + error: Error | undefined; + } +) & { peekStatus: MobxPromiseStatus }; +export type MobxPromiseUnionTypeWithDefault = ( + | { + status: 'pending'; + isPending: true; + isError: false; + isComplete: false; + result: R; + error: Error | undefined; + } + | { + status: 'error'; + isPending: false; + isError: true; + isComplete: false; + result: R; + error: Error; + } + | { + status: 'complete'; + isPending: false; + isError: false; + isComplete: true; + result: R; + error: Error | undefined; + } +) & { peekStatus: MobxPromiseStatus }; + +export type MobxPromiseInputUnion = + | PromiseLike + | (() => PromiseLike) + | MobxPromiseInputParams; +export type MobxPromiseInputParams = { + /** + * A function that returns a list of MobxPromise objects which are dependencies of the invoke function. + */ + await?: MobxPromise_await; + + /** + * A function that returns the async result or a promise for the async result. + */ + invoke: MobxPromise_invoke; + + /** + * Default result in place of undefined + */ + default?: R; + + /** + * A function that will be called when the latest promise from invoke() is resolved. + * It will not be called for out-of-date promises. + */ + onResult?: (result?: R) => void; + + /** + * A function that will be called when the latest promise from invoke() is rejected. + * It will not be called for out-of-date promises. + */ + onError?: (error: Error) => void; +}; +export type MobxPromise_await = () => Array< + | MobxPromiseUnionTypeWithDefault + | MobxPromiseUnionType + | MobxPromise +>; +export type MobxPromise_invoke = () => PromiseLike; +export type MobxPromiseInputParamsWithDefault = { + await?: MobxPromise_await; + invoke: MobxPromise_invoke; + default: R; + onResult?: (result: R) => void; + onError?: (error: Error) => void; +}; + +/** + * MobxPromise provides an observable interface for a computed promise. + * @author adufilie http://github.com/adufilie + */ +export class MobxPromiseImpl { + static isPromiseLike(value: any) { + return ( + value != null && + typeof value === 'object' && + typeof value.then === 'function' + ); + } + + static normalizeInput( + input: MobxPromiseInputParamsWithDefault + ): MobxPromiseInputParamsWithDefault; + static normalizeInput( + input: MobxPromiseInputUnion, + defaultResult?: R + ): MobxPromiseInputParamsWithDefault; + static normalizeInput( + input: MobxPromiseInputUnion + ): MobxPromiseInputParams; + static normalizeInput( + input: MobxPromiseInputUnion, + defaultResult?: R + ) { + if (typeof input === 'function') + return { invoke: input, default: defaultResult }; + + if (MobxPromiseImpl.isPromiseLike(input)) + return { + invoke: () => input as PromiseLike, + default: defaultResult, + }; + + input = input as MobxPromiseInputParams; + if (defaultResult !== undefined) + input = { ...input, default: defaultResult }; + return input; + } + + constructor(input: MobxPromiseInputUnion, defaultResult?: R) { + makeObservable>(this); + + let norm = MobxPromiseImpl.normalizeInput(input, defaultResult); + this.await = norm.await; + this.invoke = norm.invoke; + this.defaultResult = norm.default; + this.onResult = norm.onResult; + this.onError = norm.onError; + } + + private await?: MobxPromise_await; + private invoke: MobxPromise_invoke; + private onResult?: (result?: R) => void; + private onError?: (error: Error) => void; + private defaultResult?: R; + private invokeId: number = 0; + private _latestInvokeId: number = 0; + + @observable private internalStatus: 'pending' | 'complete' | 'error' = + 'pending'; + @observable.ref private internalResult?: R = undefined; + @observable.ref private internalError?: Error = undefined; + + @computed get status(): 'pending' | 'complete' | 'error' { + // wait until all MobxPromise dependencies are complete + if (this.await) + for (let status of this.await().map(mp => mp.status)) // track all statuses before returning + if (status !== 'complete') return status; + + let status = this.internalStatus; // force mobx to track changes to internalStatus + if (this.latestInvokeId != this.invokeId) status = 'pending'; + return status; + } + + @computed get peekStatus(): 'pending' | 'complete' | 'error' { + // check status without triggering invoke + + // check status of all MobxPromise dependencies + if (this.await) + for (let status of this.await().map(mp => mp.peekStatus)) + if (status !== 'complete') return status; + + // otherwise, return internal status + return this.internalStatus; + } + + @computed get isPending() { + return this.status == 'pending'; + } + + @computed get isComplete() { + return this.status == 'complete'; + } + + @computed get isError() { + return this.status == 'error'; + } + + @computed get result(): R | undefined { + // checking status may trigger invoke + if (this.isError || this.internalResult == null) + return this.defaultResult; + + return this.internalResult; + } + + @computed get error(): Error | undefined { + // checking status may trigger invoke + if (!this.isComplete && this.await) + for (let error of this.await().map(mp => mp.error)) // track all errors before returning + if (error) return error; + + return this.internalError; + } + + /** + * This lets mobx determine when to call this.invoke(), + * taking advantage of caching based on observable property access tracking. + */ + @computed + private get latestInvokeId() { + window.clearTimeout(this._latestInvokeId); + let promise = this.invoke(); + let invokeId: number = window.setTimeout(() => + this.setPending(invokeId, promise) + ); + return (this._latestInvokeId = invokeId); + } + + @action + private setPending(invokeId: number, promise: PromiseLike) { + this.invokeId = invokeId; + promise.then( + result => this.setComplete(invokeId, result), + error => this.setError(invokeId, error) + ); + this.internalStatus = 'pending'; + } + + @action + private setComplete(invokeId: number, result: R) { + if (invokeId === this.invokeId) { + this.internalResult = result; + this.internalError = undefined; + this.internalStatus = 'complete'; + + if (this.onResult) this.onResult(result || this.defaultResult); // may use defaultResult + } + } + + @action + private setError(invokeId: number, error: Error) { + if (invokeId === this.invokeId) { + this.internalError = error; + this.internalResult = undefined; + this.internalStatus = 'error'; + + if (this.onError) this.onError(error); + } + } +} + +export type MobxPromiseFactory = { + // This provides more information for TypeScript code flow analysis + ( + input: MobxPromiseInputParamsWithDefault + ): MobxPromiseUnionTypeWithDefault; + ( + input: MobxPromiseInputUnion, + defaultResult: R + ): MobxPromiseUnionTypeWithDefault; + (input: MobxPromiseInputUnion): MobxPromiseUnionType; +}; + +export const MobxPromise = MobxPromiseImpl as { + // This provides more information for TypeScript code flow analysis + new ( + input: MobxPromiseInputParamsWithDefault + ): MobxPromiseUnionTypeWithDefault; + new ( + input: MobxPromiseInputUnion, + defaultResult: R + ): MobxPromiseUnionTypeWithDefault; + new (input: MobxPromiseInputUnion): MobxPromiseUnionType; +}; + +export interface MobxPromise + extends Pick< + MobxPromiseImpl, + | 'status' + | 'error' + | 'result' + | 'isPending' + | 'isError' + | 'isComplete' + | 'peekStatus' + > {} diff --git a/packages/cbioportal-frontend-commons/src/lib/mobxPromiseUtils.ts b/packages/cbioportal-frontend-commons/src/lib/mobxPromiseUtils.ts new file mode 100644 index 00000000000..52c797618c2 --- /dev/null +++ b/packages/cbioportal-frontend-commons/src/lib/mobxPromiseUtils.ts @@ -0,0 +1,96 @@ +import { + autorun, + getObserverTree, + IListenable, + IObservable, + _getAdministration, + getAtom, +} from 'mobx'; +import { MobxPromise } from './MobxPromise'; + +/** + * A decorator for creating a @computed property that will be cached + * after the first time it is accessed, even if it becomes unobserved later. + * @param target + * @param propertyKey + * @param descriptor + */ +export function cached( + target: any, + propertyKey: string | symbol, + descriptor: TypedPropertyDescriptor +) { + if (descriptor.get) { + let get = descriptor.get; + descriptor.get = function(...args: any[]) { + const atom = getAtom(this, propertyKey as string) as IObservable & + IListenable; + // to keep the cached value, add an observer if there are none + if (!atom.isBeingObserved_) autorun(() => atom); + + return get.apply(this, args); + }; + } + return descriptor; +} + +/** + * Checks if a property has observers. + */ +export function hasObservers(thing: T, property: keyof T) { + let tree = getObserverTree(thing, property as string); + return tree && tree.observers ? tree.observers.length > 0 : false; +} + +/** + * Update MobxPromise debug names to reflect their property names on a given object. + * @param target An object which has properties that are MobxPromises. + */ +export function labelMobxPromises(target: T) { + for (let key in target) { + let desc = Object.getOwnPropertyDescriptor(target, key); + if (desc && desc.value instanceof MobxPromise) { + let admin = _getAdministration(desc.value); + admin.name = `${key}(${admin.name})`; + } + } +} + +/** + * A function created with debounceAsync() returns a new Promise + * every time, but only the last promise created before invoking the + * original function will be resolved after a specified delay. + */ +export function debounceAsync PromiseLike>( + invoke: F, + delay = 0 +): F { + function invokeLater( + context: any, + args: any[], + resolve: (result: PromiseLike) => void, + reject: (error: Error) => void + ) { + try { + resolve(invoke.apply(context, args)); + } catch (e) { + reject(e); + } + } + + let timeout = 0; + return function(...args: any[]): PromiseLike { + return new Promise(function(resolve, reject) { + window.clearTimeout(timeout); + timeout = window.setTimeout( + invokeLater, + delay, + //@ts-ignore + this, + args, + resolve, + reject + ); + }); + } as F; +} diff --git a/packages/cbioportal-frontend-commons/src/lib/onMobxPromise/onMobxPromise.ts b/packages/cbioportal-frontend-commons/src/lib/onMobxPromise/onMobxPromise.ts index 4e19c8218b8..92bde291e2e 100644 --- a/packages/cbioportal-frontend-commons/src/lib/onMobxPromise/onMobxPromise.ts +++ b/packages/cbioportal-frontend-commons/src/lib/onMobxPromise/onMobxPromise.ts @@ -1,5 +1,5 @@ -import { MobxPromise } from 'mobxpromise'; import { autorun, IReactionDisposer } from 'mobx'; +import { MobxPromise } from '../MobxPromise'; export function onMobxPromise( promise: MobxPromise | Array>, diff --git a/packages/react-mutation-mapper/package.json b/packages/react-mutation-mapper/package.json index c19e62df1ba..b6dca1408e3 100644 --- a/packages/react-mutation-mapper/package.json +++ b/packages/react-mutation-mapper/package.json @@ -46,7 +46,6 @@ "jquery": "^3.2.1", "lodash": "^4.17.15", "memoize-weak-decorator": "^1.0.3", - "mobxpromise": "github:cbioportal/mobxpromise#303db72588860bff0a6862a4f07a4e8a3578c94f", "oncokb-frontend-commons": "^0.0.21", "oncokb-styles": "~1.4.2", "oncokb-ts-api-client": "^1.3.3", diff --git a/packages/react-mutation-mapper/src/store/DefaultMutationMapperFilterApplier.ts b/packages/react-mutation-mapper/src/store/DefaultMutationMapperFilterApplier.ts index 4aa2dc87934..42948fc33d5 100644 --- a/packages/react-mutation-mapper/src/store/DefaultMutationMapperFilterApplier.ts +++ b/packages/react-mutation-mapper/src/store/DefaultMutationMapperFilterApplier.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { defaultHotspotFilter, IHotspotIndex, diff --git a/packages/react-mutation-mapper/src/store/DefaultMutationMapperStore.ts b/packages/react-mutation-mapper/src/store/DefaultMutationMapperStore.ts index 22f6b46466b..d6c8b08ca9d 100644 --- a/packages/react-mutation-mapper/src/store/DefaultMutationMapperStore.ts +++ b/packages/react-mutation-mapper/src/store/DefaultMutationMapperStore.ts @@ -1,5 +1,5 @@ import autobind from 'autobind-decorator'; -import { remoteData } from 'cbioportal-frontend-commons'; +import { cached, MobxPromise, remoteData } from 'cbioportal-frontend-commons'; import { AggregatedHotspots, convertDbPtmToPtm, @@ -49,7 +49,6 @@ import { } from 'genome-nexus-ts-api-client'; import _ from 'lodash'; import { computed, observable, makeObservable } from 'mobx'; -import MobxPromise, { cached } from 'mobxpromise'; import { DataFilter, DataFilterType } from '../model/DataFilter'; import DataStore from '../model/DataStore'; diff --git a/packages/react-variant-view/package.json b/packages/react-variant-view/package.json index d9733600cdf..7e9539937b4 100644 --- a/packages/react-variant-view/package.json +++ b/packages/react-variant-view/package.json @@ -46,7 +46,6 @@ "genome-nexus-ts-api-client": "^1.1.31", "jquery": "^3.2.1", "lodash": "^4.17.15", - "mobxpromise": "github:cbioportal/mobxpromise#303db72588860bff0a6862a4f07a4e8a3578c94f", "oncokb-styles": "~1.4.2", "oncokb-ts-api-client": "^1.3.3", "react-bootstrap": "^0.31.5", diff --git a/packages/react-variant-view/src/store/VariantStore.ts b/packages/react-variant-view/src/store/VariantStore.ts index 4291350bdd9..9b1e4ac9cb2 100644 --- a/packages/react-variant-view/src/store/VariantStore.ts +++ b/packages/react-variant-view/src/store/VariantStore.ts @@ -1,8 +1,7 @@ -import { remoteData } from 'cbioportal-frontend-commons'; +import { MobxPromise, remoteData } from 'cbioportal-frontend-commons'; import { GenomeNexusAPI, VariantAnnotation } from 'genome-nexus-ts-api-client'; import _ from 'lodash'; import { computed, observable, makeObservable } from 'mobx'; -import MobxPromise from 'mobxpromise'; import { CuratedGene, IndicatorQueryResp, diff --git a/src/pages/groupComparison/GroupComparisonUtils.tsx b/src/pages/groupComparison/GroupComparisonUtils.tsx index 9dacc36a2a3..d881c49a46f 100644 --- a/src/pages/groupComparison/GroupComparisonUtils.tsx +++ b/src/pages/groupComparison/GroupComparisonUtils.tsx @@ -1,4 +1,3 @@ -import { MobxPromise } from 'mobxpromise/dist/src/MobxPromise'; import { Mutation, PatientIdentifier, @@ -25,6 +24,7 @@ import Loader from '../../shared/components/loadingIndicator/LoadingIndicator'; import ErrorMessage from '../../shared/components/ErrorMessage'; import { DefaultTooltip, + MobxPromise, stringListToIndexSet, } from 'cbioportal-frontend-commons'; import { GroupComparisonTab } from './GroupComparisonTabs'; diff --git a/src/pages/patientView/clinicalInformation/PatientViewPageStore.ts b/src/pages/patientView/clinicalInformation/PatientViewPageStore.ts index 6aa9364584e..16b9508461b 100644 --- a/src/pages/patientView/clinicalInformation/PatientViewPageStore.ts +++ b/src/pages/patientView/clinicalInformation/PatientViewPageStore.ts @@ -1,4 +1,4 @@ -import _, { result } from 'lodash'; +import _ from 'lodash'; import { CBioPortalAPIInternal, ClinicalData, @@ -25,9 +25,12 @@ import client from '../../../shared/api/cbioportalClientInstance'; import internalClient from '../../../shared/api/cbioportalInternalClientInstance'; import oncokbClient from '../../../shared/api/oncokbClientInstance'; import { computed, observable, action, makeObservable } from 'mobx'; -import { remoteData, stringListToSet } from 'cbioportal-frontend-commons'; +import { + cached, + remoteData, + stringListToSet, +} from 'cbioportal-frontend-commons'; import { IGisticData } from 'shared/model/Gistic'; -import { cached, labelMobxPromises } from 'mobxpromise'; import MrnaExprRankCache from 'shared/cache/MrnaExprRankCache'; import request from 'superagent'; import DiscreteCNACache from 'shared/cache/DiscreteCNACache'; @@ -169,7 +172,6 @@ import { CLINICAL_ATTRIBUTE_ID_ENUM, MIS_TYPE_VALUE, GENOME_NEXUS_ARG_FIELD_ENUM, - MSI_H_THRESHOLD, TMB_H_THRESHOLD, AlterationTypeConstants, DataTypeConstants, @@ -191,9 +193,7 @@ import { import { GenericAssayTypeConstants } from 'shared/lib/GenericAssayUtils/GenericAssayConfig'; import { - MutationalSignaturesVersion, MutationalSignatureStableIdKeyWord, - validateMutationalSignatureRawData, retrieveMutationalSignatureVersionFromData, } from 'shared/lib/GenericAssayUtils/MutationalSignaturesUtils'; import { getServerConfig } from 'config/config'; diff --git a/src/pages/patientView/mutation/MutationTableWrapper.tsx b/src/pages/patientView/mutation/MutationTableWrapper.tsx index dad5a11de76..adbe81be44c 100644 --- a/src/pages/patientView/mutation/MutationTableWrapper.tsx +++ b/src/pages/patientView/mutation/MutationTableWrapper.tsx @@ -1,14 +1,8 @@ import * as React from 'react'; import { observer } from 'mobx-react'; import { makeObservable, observable } from 'mobx'; -import _ from 'lodash'; -import { - CancerStudy, - ClinicalData, - GenePanelData, - MolecularProfile, - Mutation, -} from 'cbioportal-ts-api-client'; +import { ClinicalData, Mutation } from 'cbioportal-ts-api-client'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { IColumnVisibilityControlsProps } from 'shared/components/columnVisibilityControls/ColumnVisibilityControls'; import SampleManager from '../SampleManager'; import PubMedCache from 'shared/cache/PubMedCache'; @@ -18,27 +12,19 @@ import { ICivicGeneIndex, ICivicVariantIndex, IHotspotIndex, - IMyCancerGenomeData, - IMyVariantInfoIndex, IOncoKbData, RemoteData, } from 'cbioportal-utils'; import { CancerGene } from 'oncokb-ts-api-client'; -import { - calculateOncoKbContentWidthWithInterval, - DEFAULT_ONCOKB_CONTENT_WIDTH, -} from 'shared/lib/AnnotationColumnUtils'; +import { DEFAULT_ONCOKB_CONTENT_WIDTH } from 'shared/lib/AnnotationColumnUtils'; import { ILazyMobXTableApplicationDataStore } from 'shared/lib/ILazyMobXTableApplicationDataStore'; import PatientViewMutationTable from './PatientViewMutationTable'; import { getServerConfig, ServerConfigHelpers } from 'config/config'; -import VariantCountCache from 'shared/cache/VariantCountCache'; import DiscreteCNACache from 'shared/cache/DiscreteCNACache'; import GenomeNexusCache from 'shared/cache/GenomeNexusCache'; import GenomeNexusMutationAssessorCache from 'shared/cache/GenomeNexusMutationAssessorCache'; -import { MutationTableDownloadDataFetcher } from 'shared/lib/MutationTableDownloadDataFetcher'; import { IMutSigData } from 'shared/model/MutSig'; import { ICosmicData } from 'shared/model/Cosmic'; -import MobxPromise from 'mobxpromise'; import FeatureInstruction from 'shared/FeatureInstruction/FeatureInstruction'; import { getSamplesProfiledStatus } from 'pages/patientView/PatientViewPageUtils'; diff --git a/src/pages/resultsView/ResultsViewPageStore.ts b/src/pages/resultsView/ResultsViewPageStore.ts index 82500ac82ee..bbda3f51251 100644 --- a/src/pages/resultsView/ResultsViewPageStore.ts +++ b/src/pages/resultsView/ResultsViewPageStore.ts @@ -4,8 +4,6 @@ import { ClinicalAttributeCount, ClinicalAttributeCountFilter, ClinicalData, - ClinicalDataMultiStudyFilter, - ClinicalDataSingleStudyFilter, CopyNumberSeg, DiscreteCopyNumberData, DiscreteCopyNumberFilter, @@ -38,7 +36,9 @@ import { import client from 'shared/api/cbioportalClientInstance'; import { + cached, CanonicalMutationType, + MobxPromise, remoteData, stringListToSet, } from 'cbioportal-frontend-commons'; @@ -57,8 +57,6 @@ import { } from 'oncokb-frontend-commons'; import { VariantAnnotation } from 'genome-nexus-ts-api-client'; import { IndicatorQueryResp } from 'oncokb-ts-api-client'; -import { cached, MobxPromise } from 'mobxpromise'; -import PubMedCache from 'shared/cache/PubMedCache'; import GenomeNexusCache from 'shared/cache/GenomeNexusCache'; import GenomeNexusMutationAssessorCache from 'shared/cache/GenomeNexusMutationAssessorCache'; import CancerTypeCache from 'shared/cache/CancerTypeCache'; @@ -77,12 +75,10 @@ import { fetchGenes, fetchGermlineConsentedSamples, fetchStructuralVariantOncoKbData, - fetchStudiesForSamplesWithoutCancerTypeClinicalData, fetchVariantAnnotationsIndexedByGenomicLocation, filterAndAnnotateMolecularData, filterAndAnnotateMutations, generateDataQueryFilter, - generateUniqueSampleKeyToTumorTypeMap, getAllGenes, getGenomeBuildFromStudies, getSurvivalClinicalAttributesPrefix, @@ -101,7 +97,6 @@ import { import ResultsViewMutationMapperStore from './mutation/ResultsViewMutationMapperStore'; import { getServerConfig, ServerConfigHelpers } from 'config/config'; import _ from 'lodash'; -import { toSampleUuid } from '../../shared/lib/UuidUtils'; import MutationDataCache from '../../shared/cache/MutationDataCache'; import AccessorsForOqlFilter from '../../shared/lib/oql/AccessorsForOqlFilter'; import { @@ -180,7 +175,6 @@ import sessionServiceClient from '../../shared/api/sessionServiceInstance'; import comparisonClient from '../../shared/api/comparisonGroupClientInstance'; import { AppStore } from '../../AppStore'; import { getNumSamples } from '../groupComparison/GroupComparisonUtils'; -import autobind from 'autobind-decorator'; import { ChartMeta, ChartMetaDataTypeEnum, @@ -206,7 +200,6 @@ import { getGenericAssayMetaPropertyOrDefault, } from 'shared/lib/GenericAssayUtils/GenericAssayCommonUtils'; import { createVariantAnnotationsByMutationFetcher } from 'shared/components/mutationMapper/MutationMapperUtils'; -import { getGenomeNexusHgvsgUrl } from 'shared/api/urls'; import { isMixedReferenceGenome } from 'shared/lib/referenceGenomeUtils'; import { ALTERED_COLOR, diff --git a/src/pages/resultsView/ResultsViewPageStoreUtils.ts b/src/pages/resultsView/ResultsViewPageStoreUtils.ts index 62fba902882..6ab9c7e3370 100644 --- a/src/pages/resultsView/ResultsViewPageStoreUtils.ts +++ b/src/pages/resultsView/ResultsViewPageStoreUtils.ts @@ -30,11 +30,14 @@ import { import { Alteration } from '../../shared/lib/oql/oql-parser'; import { getOncoKbOncogenic, groupBy } from '../../shared/lib/StoreUtils'; import { ResultsViewPageStore } from './ResultsViewPageStore'; -import { remoteData } from 'cbioportal-frontend-commons'; +import { + MobxPromise, + MobxPromise_await, + remoteData, +} from 'cbioportal-frontend-commons'; import { IndicatorQueryResp } from 'oncokb-ts-api-client'; import _ from 'lodash'; import client from 'shared/api/cbioportalClientInstance'; -import MobxPromise, { MobxPromise_await } from 'mobxpromise'; import { calculateQValues } from '../../shared/lib/calculation/BenjaminiHochbergFDRCalculator'; import { SpecialAttribute } from '../../shared/cache/ClinicalDataCache'; import { isSampleProfiled } from 'shared/lib/isSampleProfiled'; diff --git a/src/pages/resultsView/cnSegments/CNSegments.tsx b/src/pages/resultsView/cnSegments/CNSegments.tsx index 04dd2ad6c70..9bb7b8daba0 100644 --- a/src/pages/resultsView/cnSegments/CNSegments.tsx +++ b/src/pages/resultsView/cnSegments/CNSegments.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { observer } from 'mobx-react'; import { action, computed, observable, makeObservable } from 'mobx'; -import MobxPromise from 'mobxpromise'; import { Nav, NavItem } from 'react-bootstrap'; import { ResultsViewPageStore } from '../ResultsViewPageStore'; @@ -21,7 +20,11 @@ import { default as ProgressIndicator, IProgressIndicatorItem, } from 'shared/components/progressIndicator/ProgressIndicator'; -import { DownloadControlOption, remoteData } from 'cbioportal-frontend-commons'; +import { + DownloadControlOption, + MobxPromise, + remoteData, +} from 'cbioportal-frontend-commons'; import CaseFilterWarning from 'shared/components/banners/CaseFilterWarning'; import { getServerConfig } from 'config/config'; diff --git a/src/pages/resultsView/coExpression/CoExpressionViz.tsx b/src/pages/resultsView/coExpression/CoExpressionViz.tsx index e0eb2cc2ba7..8b8daa1b144 100644 --- a/src/pages/resultsView/coExpression/CoExpressionViz.tsx +++ b/src/pages/resultsView/coExpression/CoExpressionViz.tsx @@ -20,8 +20,7 @@ import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicato import { SimpleGetterLazyMobXTableApplicationDataStore } from '../../../shared/lib/ILazyMobXTableApplicationDataStore'; import { logScalePossibleForProfile } from '../plots/PlotsTabUtils'; import CoExpressionPlot, { ICoExpressionPlotProps } from './CoExpressionPlot'; -import { remoteData } from 'cbioportal-frontend-commons'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise, remoteData } from 'cbioportal-frontend-commons'; import { computePlotData, requestAllDataMessage } from './CoExpressionVizUtils'; import { Button } from 'react-bootstrap'; import { CoExpressionCache } from './CoExpressionTab'; diff --git a/src/pages/resultsView/expression/ExpressionWrapper.tsx b/src/pages/resultsView/expression/ExpressionWrapper.tsx index f7c3f2aac77..1d601acb780 100644 --- a/src/pages/resultsView/expression/ExpressionWrapper.tsx +++ b/src/pages/resultsView/expression/ExpressionWrapper.tsx @@ -39,9 +39,12 @@ import { } from '../plots/PlotsTabUtils'; import { ResultsViewPageStore } from '../ResultsViewPageStore'; import OqlStatusBanner from '../../../shared/components/banners/OqlStatusBanner'; -import { remoteData, stringListToSet } from 'cbioportal-frontend-commons'; +import { + MobxPromise, + remoteData, + stringListToSet, +} from 'cbioportal-frontend-commons'; import MobxPromiseCache from '../../../shared/lib/MobxPromiseCache'; -import { MobxPromise } from 'mobxpromise'; import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator'; import BoxScatterPlot, { IBoxScatterPlotData, diff --git a/src/pages/resultsView/mutation/AddColumns.tsx b/src/pages/resultsView/mutation/AddColumns.tsx index 5ed7398f28a..ef64236616b 100644 --- a/src/pages/resultsView/mutation/AddColumns.tsx +++ b/src/pages/resultsView/mutation/AddColumns.tsx @@ -1,16 +1,12 @@ import * as React from 'react'; -import _ from 'lodash'; -import MobxPromise from 'mobxpromise'; import { observer } from 'mobx-react'; import { action, computed, makeObservable, observable } from 'mobx'; -import { Checkbox } from 'react-bootstrap'; -import { remoteData, getTextWidth } from 'cbioportal-frontend-commons'; +import { getTextWidth, MobxPromise } from 'cbioportal-frontend-commons'; import { ClinicalAttribute } from 'cbioportal-ts-api-client'; import { IColumnVisibilityControlsProps } from 'shared/components/columnVisibilityControls/ColumnVisibilityControls'; import { MSKTab, MSKTabs } from 'shared/components/MSKTabs/MSKTabs'; import CustomDropdown from 'shared/components/oncoprint/controls/CustomDropdown'; import AddChartByType from '../../studyView/addChartButton/addChartByType/AddChartByType'; -import { ChartDataCountSet } from '../../studyView/StudyViewUtils'; export interface IAddColumnsProps extends IColumnVisibilityControlsProps { clinicalAttributes: ClinicalAttribute[]; diff --git a/src/pages/resultsView/mutation/MutationRateSummary.tsx b/src/pages/resultsView/mutation/MutationRateSummary.tsx index 9a2275d7ee3..a6b0280b6c9 100644 --- a/src/pages/resultsView/mutation/MutationRateSummary.tsx +++ b/src/pages/resultsView/mutation/MutationRateSummary.tsx @@ -10,7 +10,7 @@ import { somaticMutationRate, } from 'shared/lib/MutationUtils'; import { computed, makeObservable } from 'mobx'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { observer } from 'mobx-react'; import MutationStatusSelector from './MutationStatusSelector'; diff --git a/src/pages/resultsView/mutation/ResultsViewMutationMapperStore.ts b/src/pages/resultsView/mutation/ResultsViewMutationMapperStore.ts index 77fb8c35420..b4119f30710 100644 --- a/src/pages/resultsView/mutation/ResultsViewMutationMapperStore.ts +++ b/src/pages/resultsView/mutation/ResultsViewMutationMapperStore.ts @@ -8,14 +8,13 @@ import { MolecularProfile, SampleIdentifier, } from 'cbioportal-ts-api-client'; -import { remoteData } from 'cbioportal-frontend-commons'; +import { MobxPromise, remoteData } from 'cbioportal-frontend-commons'; import { CancerGene } from 'oncokb-ts-api-client'; import { VariantAnnotation, GenomeNexusAPI, GenomeNexusAPIInternal, } from 'genome-nexus-ts-api-client'; -import { MobxPromise } from 'mobxpromise'; import { fetchCosmicData } from 'shared/lib/StoreUtils'; import MutationCountCache from 'shared/cache/MutationCountCache'; import ClinicalAttributeCache from 'shared/cache/ClinicalAttributeCache'; diff --git a/src/pages/resultsView/mutation/ResultsViewMutationTable.tsx b/src/pages/resultsView/mutation/ResultsViewMutationTable.tsx index 5a7ed68cb45..889d4b3c8e0 100644 --- a/src/pages/resultsView/mutation/ResultsViewMutationTable.tsx +++ b/src/pages/resultsView/mutation/ResultsViewMutationTable.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { IMutationTableProps, MutationTableColumnType, diff --git a/src/pages/resultsView/mutualExclusivity/MutualExclusivityTab.tsx b/src/pages/resultsView/mutualExclusivity/MutualExclusivityTab.tsx index 54af548537f..f4a229064f2 100644 --- a/src/pages/resultsView/mutualExclusivity/MutualExclusivityTab.tsx +++ b/src/pages/resultsView/mutualExclusivity/MutualExclusivityTab.tsx @@ -7,21 +7,16 @@ import styles from './styles.module.scss'; import { computed, observable, makeObservable } from 'mobx'; import { MutualExclusivity } from '../../../shared/model/MutualExclusivity'; import { ResultsViewPageStore } from '../ResultsViewPageStore'; -import DiscreteCNACache from '../../../shared/cache/DiscreteCNACache'; -import { If, Then, Else } from 'react-if'; import Loader from '../../../shared/components/loadingIndicator/LoadingIndicator'; import { getTrackPairsCountText, getData, getFilteredData, - AlteredStatus, getSampleAlteredFilteredMap, } from './MutualExclusivityUtil'; import OqlStatusBanner from '../../../shared/components/banners/OqlStatusBanner'; -import { OQLLineFilterOutput } from '../../../shared/lib/oql/oqlfilter'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { SampleAlteredMap } from '../ResultsViewPageStoreUtils'; -import Pluralize from 'pluralize'; import AlterationFilterWarning from '../../../shared/components/banners/AlterationFilterWarning'; import CaseFilterWarning from '../../../shared/components/banners/CaseFilterWarning'; diff --git a/src/pages/resultsView/plots/PlotsTab.tsx b/src/pages/resultsView/plots/PlotsTab.tsx index b2e59a06da4..90e064a99bb 100644 --- a/src/pages/resultsView/plots/PlotsTab.tsx +++ b/src/pages/resultsView/plots/PlotsTab.tsx @@ -101,6 +101,7 @@ import MultipleCategoryBarPlot from '../../groupComparison/MultipleCategoryBarPl import { RESERVED_CLINICAL_VALUE_COLORS } from 'shared/lib/Colors'; import { DownloadControlOption, + MobxPromise, onMobxPromise, } from 'cbioportal-frontend-commons'; import { showWaterfallPlot } from 'pages/resultsView/plots/PlotsTabUtils'; @@ -111,7 +112,6 @@ import { generateQuickPlots } from './QuickPlots'; import ResultsViewURLWrapper, { PlotsSelectionParam, } from '../ResultsViewURLWrapper'; -import MobxPromise from 'mobxpromise'; import { SpecialAttribute } from '../../../shared/cache/ClinicalDataCache'; import LabeledCheckbox from '../../../shared/components/labeledCheckbox/LabeledCheckbox'; import CaseFilterWarning from '../../../shared/components/banners/CaseFilterWarning'; diff --git a/src/pages/resultsView/plots/PlotsTabUtils.tsx b/src/pages/resultsView/plots/PlotsTabUtils.tsx index 77352814c2d..cf377067493 100644 --- a/src/pages/resultsView/plots/PlotsTabUtils.tsx +++ b/src/pages/resultsView/plots/PlotsTabUtils.tsx @@ -11,7 +11,6 @@ import { PlotsTabOption, SelectedColoringTypes, } from './PlotsTab'; -import { MobxPromise } from 'mobxpromise'; import { CancerStudy, ClinicalAttribute, @@ -26,7 +25,11 @@ import { import { StructuralVariant } from 'cbioportal-ts-api-client'; -import { remoteData, stringListToIndexSet } from 'cbioportal-frontend-commons'; +import { + remoteData, + MobxPromise, + stringListToIndexSet, +} from 'cbioportal-frontend-commons'; import MobxPromiseCache from '../../../shared/lib/MobxPromiseCache'; import { getSampleViewUrl, getStudySummaryUrl } from '../../../shared/api/urls'; import _ from 'lodash'; @@ -39,11 +42,7 @@ import { import { BLACK, DEFAULT_GREY, LIGHT_GREY } from 'shared/lib/Colors'; import { CoverageInformation } from '../../../shared/lib/GenePanelUtils'; import { IBoxScatterPlotData } from '../../../shared/components/plots/BoxScatterPlot'; -import { - AlterationTypeConstants, - DataTypeConstants, - CLINICAL_ATTRIBUTE_FIELD_ENUM, -} from 'shared/constants'; +import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants'; import numeral from 'numeral'; import GenesetMolecularDataCache from '../../../shared/cache/GenesetMolecularDataCache'; @@ -59,7 +58,6 @@ import { LegendDataWithId, } from '../../../shared/components/plots/PlotUtils'; import { isSampleProfiledInMultiple } from '../../../shared/lib/isSampleProfiled'; -import { SpecialChartsUniqueKeyEnum } from 'pages/studyView/StudyViewUtils'; import { ObservableMap } from 'mobx'; import { toFixedWithoutTrailingZeros } from '../../../shared/lib/FormatUtils'; import joinJsx from 'shared/lib/joinJsx'; diff --git a/src/pages/resultsView/structuralVariant/ResultsViewStructuralVariantMapperStore.ts b/src/pages/resultsView/structuralVariant/ResultsViewStructuralVariantMapperStore.ts index 7c315306c2f..d1e9d91fa38 100644 --- a/src/pages/resultsView/structuralVariant/ResultsViewStructuralVariantMapperStore.ts +++ b/src/pages/resultsView/structuralVariant/ResultsViewStructuralVariantMapperStore.ts @@ -18,7 +18,6 @@ * along with this program. If not, see . **/ -import { labelMobxPromises, MobxPromise } from 'mobxpromise'; import { computed, makeObservable } from 'mobx'; import { StructuralVariantExt } from 'shared/model/Fusion'; import ResultViewFusionMapperDataStore from './ResultsViewStructuralVariantMapperDataStore'; @@ -30,7 +29,11 @@ import { } from 'cbioportal-ts-api-client'; import { IOncoKbData } from 'cbioportal-utils'; import { CancerGene } from 'oncokb-ts-api-client'; -import { remoteData } from 'cbioportal-frontend-commons'; +import { + labelMobxPromises, + MobxPromise, + remoteData, +} from 'cbioportal-frontend-commons'; import { fetchCanonicalTranscripts, fetchEnsemblTranscriptsByEnsemblFilter, diff --git a/src/pages/staticPages/tools/mutationMapper/MutationMapperToolStore.ts b/src/pages/staticPages/tools/mutationMapper/MutationMapperToolStore.ts index d3c94099854..9e57c65333b 100644 --- a/src/pages/staticPages/tools/mutationMapper/MutationMapperToolStore.ts +++ b/src/pages/staticPages/tools/mutationMapper/MutationMapperToolStore.ts @@ -1,6 +1,5 @@ import { action, computed, observable, makeObservable } from 'mobx'; import _ from 'lodash'; -import { cached } from 'mobxpromise'; import { annotateMutations, getMyVariantInfoAnnotationsFromIndexedVariantAnnotations, @@ -10,7 +9,7 @@ import { resolveDefaultsForMissingValues, } from 'cbioportal-utils'; -import { remoteData } from 'cbioportal-frontend-commons'; +import { cached, remoteData } from 'cbioportal-frontend-commons'; import { EnsemblTranscript, VariantAnnotation, diff --git a/src/pages/staticPages/tools/oncoprinter/OncoprinterGeneticUtils.ts b/src/pages/staticPages/tools/oncoprinter/OncoprinterGeneticUtils.ts index 7171419e077..b500e44edcb 100644 --- a/src/pages/staticPages/tools/oncoprinter/OncoprinterGeneticUtils.ts +++ b/src/pages/staticPages/tools/oncoprinter/OncoprinterGeneticUtils.ts @@ -7,8 +7,6 @@ import { GeneticTrackDatum_Data, } from '../../../../shared/components/oncoprint/Oncoprint'; import { - alterationInfoForOncoprintTrackData, - formatGeneticTrackLabel, formatPercent, percentAltered, } from '../../../../shared/components/oncoprint/OncoprintUtils'; @@ -38,7 +36,6 @@ import { OncoKbAPI, } from 'oncokb-ts-api-client'; import { - cancerTypeForOncoKb, getOncoKbOncogenic, ONCOKB_DEFAULT, PUTATIVE_DRIVER, @@ -46,7 +43,7 @@ import { queryOncoKbData, } from '../../../../shared/lib/StoreUtils'; import { default as oncokbClient } from '../../../../shared/api/oncokbClientInstance'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { mutationCountByPositionKey } from '../../../resultsView/mutationCountHelpers'; import { getAlterationString } from '../../../../shared/lib/CopyNumberUtils'; import { GERMLINE_REGEXP } from '../../../../shared/lib/MutationUtils'; diff --git a/src/pages/studyView/StudyViewPageStore.ts b/src/pages/studyView/StudyViewPageStore.ts index 2b41ea4ba11..cc8893957ac 100644 --- a/src/pages/studyView/StudyViewPageStore.ts +++ b/src/pages/studyView/StudyViewPageStore.ts @@ -155,7 +155,6 @@ import { transformSampleDataToSelectedSampleClinicalData, updateCustomIntervalFilter, } from './StudyViewUtils'; -import MobxPromise from 'mobxpromise'; import { SingleGeneQuery } from 'shared/lib/oql/oql-parser'; import autobind from 'autobind-decorator'; import { @@ -167,7 +166,6 @@ import { convertToGene1Gene2String, parseOQLQuery, queryContainsStructVarAlteration, - STRUCTVARNullGeneStr, unparseOQLQueryLine, } from 'shared/lib/oql/oqlfilter'; import sessionServiceClient from 'shared/api//sessionServiceInstance'; @@ -187,6 +185,7 @@ import { } from '../../shared/api/urls'; import { DataType as DownloadDataType, + MobxPromise, onMobxPromise, pluralize, remoteData, @@ -277,15 +276,8 @@ import { import { PageType } from 'shared/userSession/PageType'; import { FeatureFlagEnum } from 'shared/featureFlags'; import intersect from 'fast_array_intersect'; -import { Simulate } from 'react-dom/test-utils'; -import select = Simulate.select; import { StructVarMultiSelectionTableRow } from 'pages/studyView/table/StructuralVariantMultiSelectionTable'; import { PillStore } from 'shared/components/PillTag/PillTag'; -import { toast, cssTransition } from 'react-toastify'; -import { - PatientIdentifier, - PatientIdentifierFilter, -} from 'shared/model/PatientIdentifierFilter'; import { doesStructVarMatchSingleGeneQuery, generateStructVarTableCellKey, @@ -304,7 +296,6 @@ import { } from './StudyViewQueryExtractor'; import { getAllowedSurvivalClinicalDataFilterId, - isSurvivalAttributeId, isSurvivalChart, } from './charts/survival/StudyViewSurvivalUtils'; diff --git a/src/pages/studyView/StudyViewUtils.spec.tsx b/src/pages/studyView/StudyViewUtils.spec.tsx index 829a6970dad..a500f9a62ed 100644 --- a/src/pages/studyView/StudyViewUtils.spec.tsx +++ b/src/pages/studyView/StudyViewUtils.spec.tsx @@ -83,7 +83,6 @@ import { Layout } from 'react-grid-layout'; import sinon, { spy } from 'sinon'; import internalClient from 'shared/api/cbioportalInternalClientInstance'; import { ChartDimension, ChartTypeEnum } from './StudyViewConfig'; -import { MobxPromise } from 'mobxpromise'; import { CLI_NO_COLOR, CLI_YES_COLOR, @@ -95,7 +94,11 @@ import { CustomChartIdentifierWithValue, VirtualStudy, } from 'shared/api/session-service/sessionServiceModels'; -import { remoteData, toPromise } from 'cbioportal-frontend-commons'; +import { + MobxPromise, + remoteData, + toPromise, +} from 'cbioportal-frontend-commons'; import { autorun, observable, runInAction } from 'mobx'; import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants'; diff --git a/src/pages/studyView/StudyViewUtils.tsx b/src/pages/studyView/StudyViewUtils.tsx index f6cd0283592..0816244612e 100644 --- a/src/pages/studyView/StudyViewUtils.tsx +++ b/src/pages/studyView/StudyViewUtils.tsx @@ -52,7 +52,6 @@ import { STUDY_VIEW_CONFIG, } from './StudyViewConfig'; import { IStudyViewDensityScatterPlotDatum } from './charts/scatterPlot/StudyViewDensityScatterPlot'; -import MobxPromise from 'mobxpromise'; import { CNA_COLOR_AMP, CNA_COLOR_DEFAULT, @@ -62,6 +61,7 @@ import { CNA_COLOR_HOMDEL, EditableSpan, getTextWidth, + MobxPromise, stringListToIndexSet, toPromise, } from 'cbioportal-frontend-commons'; @@ -91,8 +91,7 @@ import { BoundType, NumberRange } from 'range-ts'; import { ClinicalEventTypeCount } from 'cbioportal-ts-api-client/dist/generated/CBioPortalAPIInternal'; import { queryContainsStructVarAlteration } from 'shared/lib/oql/oqlfilter'; import { toast } from 'react-toastify'; -import { value } from 'numeral'; -import { useCallback, useMemo } from 'react'; +import { useCallback } from 'react'; // Cannot use ClinicalDataTypeEnum here for the strong type. The model in the type is not strongly typed export enum ClinicalDataTypeEnum { diff --git a/src/pages/studyView/addChartButton/addChartByType/AddChartByType.tsx b/src/pages/studyView/addChartButton/addChartByType/AddChartByType.tsx index d67344c075e..ea472b0d418 100644 --- a/src/pages/studyView/addChartButton/addChartByType/AddChartByType.tsx +++ b/src/pages/studyView/addChartButton/addChartByType/AddChartByType.tsx @@ -8,7 +8,6 @@ import LabeledCheckbox from '../../../../shared/components/labeledCheckbox/Label import { Column } from '../../../../shared/components/lazyMobXTable/LazyMobXTable'; import { getFrequencyStr } from '../../StudyViewUtils'; import LoadingIndicator from '../../../../shared/components/loadingIndicator/LoadingIndicator'; -import MobxPromise from 'mobxpromise'; import { ChartDataCountSet } from '../../StudyViewUtils'; import FixedHeaderTable from '../../table/FixedHeaderTable'; import autobind from 'autobind-decorator'; @@ -16,6 +15,7 @@ import classnames from 'classnames'; import { EllipsisTextTooltip, DefaultTooltip, + MobxPromise, } from 'cbioportal-frontend-commons'; import { Omit } from '../../../../shared/lib/TypeScriptUtils'; import ifNotDefined from '../../../../shared/lib/ifNotDefined'; diff --git a/src/pages/studyView/addChartButton/geneLevelSelection/GeneLevelSelection.tsx b/src/pages/studyView/addChartButton/geneLevelSelection/GeneLevelSelection.tsx index af8d953ca6d..ffe9a2556af 100644 --- a/src/pages/studyView/addChartButton/geneLevelSelection/GeneLevelSelection.tsx +++ b/src/pages/studyView/addChartButton/geneLevelSelection/GeneLevelSelection.tsx @@ -2,7 +2,6 @@ import * as React from 'react'; import _ from 'lodash'; import { GenomicChart } from 'pages/studyView/StudyViewPageStore'; import { observer } from 'mobx-react'; -import autobind from 'autobind-decorator'; import { action, computed, makeObservable, observable } from 'mobx'; import styles from './styles.module.scss'; import ReactSelect from 'react-select'; @@ -12,7 +11,7 @@ import OQLTextArea, { GeneBoxType, } from 'shared/components/GeneSelectionBox/OQLTextArea'; import classnames from 'classnames'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { MakeMobxView } from 'shared/components/MobxView'; import LoadingIndicator from 'shared/components/loadingIndicator/LoadingIndicator'; import ErrorMessage from 'shared/components/ErrorMessage'; diff --git a/src/pages/studyView/charts/ChartContainer.tsx b/src/pages/studyView/charts/ChartContainer.tsx index 04ab85e8fd7..eaad4c0e4ae 100644 --- a/src/pages/studyView/charts/ChartContainer.tsx +++ b/src/pages/studyView/charts/ChartContainer.tsx @@ -15,7 +15,6 @@ import { GenePanel, StudyViewFilter } from 'cbioportal-ts-api-client'; import PieChart from 'pages/studyView/charts/pieChart/PieChart'; import classnames from 'classnames'; import ClinicalTable from 'pages/studyView/table/ClinicalTable'; -import MobxPromise from 'mobxpromise'; import SurvivalChart, { LegendLocation, } from '../../resultsView/survival/SurvivalChart'; @@ -41,7 +40,11 @@ import { STUDY_VIEW_CONFIG, } from '../StudyViewConfig'; import LoadingIndicator from '../../../shared/components/loadingIndicator/LoadingIndicator'; -import { DataType, DownloadControlsButton } from 'cbioportal-frontend-commons'; +import { + DataType, + DownloadControlsButton, + MobxPromise, +} from 'cbioportal-frontend-commons'; import MobxPromiseCache from 'shared/lib/MobxPromiseCache'; import WindowStore from 'shared/components/window/WindowStore'; import { ISurvivalDescription } from 'pages/resultsView/survival/SurvivalDescriptionTable'; diff --git a/src/pages/studyView/studyPageHeader/studySummary/StudySummary.tsx b/src/pages/studyView/studyPageHeader/studySummary/StudySummary.tsx index a95d47205a6..e7be10284a7 100644 --- a/src/pages/studyView/studyPageHeader/studySummary/StudySummary.tsx +++ b/src/pages/studyView/studyPageHeader/studySummary/StudySummary.tsx @@ -9,11 +9,13 @@ import { StudySummaryRecord } from '../../virtualStudy/VirtualStudy'; import LoadingIndicator from '../../../../shared/components/loadingIndicator/LoadingIndicator'; import { getStudySummaryUrl } from '../../../../shared/api/urls'; import { DefaultTooltip, getNCBIlink } from 'cbioportal-frontend-commons'; -import MobxPromise from 'mobxpromise'; import { StudyDataDownloadLink } from '../../../../shared/components/StudyDataDownloadLink/StudyDataDownloadLink'; import { serializeEvent } from '../../../../shared/lib/tracking'; import { mixedReferenceGenomeWarning } from 'shared/lib/referenceGenomeUtils'; -import { DownloadControlOption } from 'cbioportal-frontend-commons'; +import { + DownloadControlOption, + MobxPromise, +} from 'cbioportal-frontend-commons'; import { getServerConfig } from 'config/config'; interface IStudySummaryProps { diff --git a/src/pages/studyView/table/ClinicalEventTypeCountTable.tsx b/src/pages/studyView/table/ClinicalEventTypeCountTable.tsx index d4dd87ba84e..05a3676f1c1 100644 --- a/src/pages/studyView/table/ClinicalEventTypeCountTable.tsx +++ b/src/pages/studyView/table/ClinicalEventTypeCountTable.tsx @@ -5,7 +5,6 @@ import FixedHeaderTable, { import { observer } from 'mobx-react'; import { action, computed, makeObservable, observable } from 'mobx'; import _ from 'lodash'; -import MobxPromise from 'mobxpromise'; import React, { CSSProperties } from 'react'; import styles from 'pages/studyView/table/tables.module.scss'; import { @@ -14,6 +13,7 @@ import { } from 'pages/studyView/table/treatments/treatmentsTableUtil'; import LabeledCheckbox from 'shared/components/labeledCheckbox/LabeledCheckbox'; import { + MobxPromise, stringListToIndexSet, stringListToSet, } from 'cbioportal-frontend-commons'; diff --git a/src/pages/studyView/table/MultiSelectionTable.tsx b/src/pages/studyView/table/MultiSelectionTable.tsx index 290d88f73b8..4cb9ad68a54 100644 --- a/src/pages/studyView/table/MultiSelectionTable.tsx +++ b/src/pages/studyView/table/MultiSelectionTable.tsx @@ -31,11 +31,11 @@ import { import { GeneCell } from 'pages/studyView/table/GeneCell'; import LabeledCheckbox from 'shared/components/labeledCheckbox/LabeledCheckbox'; import styles from 'pages/studyView/table/tables.module.scss'; -import MobxPromise from 'mobxpromise'; import { stringListToIndexSet, stringListToSet, EllipsisTextTooltip, + MobxPromise, } from 'cbioportal-frontend-commons'; import ifNotDefined from 'shared/lib/ifNotDefined'; import { TableHeaderCellFilterIcon } from 'pages/studyView/table/TableHeaderCellFilterIcon'; diff --git a/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx b/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx index 3e9a8bf8c87..16c72027cfe 100644 --- a/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx +++ b/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx @@ -27,6 +27,7 @@ import { import LabeledCheckbox from 'shared/components/labeledCheckbox/LabeledCheckbox'; import styles from 'pages/studyView/table/tables.module.scss'; import { + MobxPromise, stringListToIndexSet, stringListToSet, } from 'cbioportal-frontend-commons'; @@ -34,7 +35,6 @@ import ifNotDefined from 'shared/lib/ifNotDefined'; import { TableHeaderCellFilterIcon } from 'pages/studyView/table/TableHeaderCellFilterIcon'; import { StructVarCell } from 'pages/studyView/table/StructVarCell'; import { BaseMultiSelectionTableProps } from 'pages/studyView/table/MultiSelectionTable'; -import MobxPromise from 'mobxpromise'; import { StructVarGenePair } from 'pages/studyView/StructVarUtils'; import { STRUCTVARAnyGeneStr, diff --git a/src/pages/studyView/table/treatments/PatientTreatmentsTable.tsx b/src/pages/studyView/table/treatments/PatientTreatmentsTable.tsx index 57b465714ca..8a5a335c95a 100644 --- a/src/pages/studyView/table/treatments/PatientTreatmentsTable.tsx +++ b/src/pages/studyView/table/treatments/PatientTreatmentsTable.tsx @@ -3,7 +3,6 @@ import { observer } from 'mobx-react'; import _ from 'lodash'; import FixedHeaderTable, { IFixedHeaderTableProps } from '../FixedHeaderTable'; import { action, computed, observable, makeObservable } from 'mobx'; -import autobind from 'autobind-decorator'; import { Column, SortDirection, @@ -12,11 +11,7 @@ import { PatientTreatmentRow } from 'cbioportal-ts-api-client'; import { correctColumnWidth } from 'pages/studyView/StudyViewUtils'; import LabeledCheckbox from 'shared/components/labeledCheckbox/LabeledCheckbox'; import styles from 'pages/studyView/table/tables.module.scss'; -import MobxPromise from 'mobxpromise'; -import { - stringListToIndexSet, - stringListToSet, -} from 'cbioportal-frontend-commons'; +import { MobxPromise, stringListToIndexSet } from 'cbioportal-frontend-commons'; import ifNotDefined from 'shared/lib/ifNotDefined'; import { treatmentUniqueKey, diff --git a/src/pages/studyView/table/treatments/SampleTreatmentsTable.tsx b/src/pages/studyView/table/treatments/SampleTreatmentsTable.tsx index d7cbbefcdc5..43070757afe 100644 --- a/src/pages/studyView/table/treatments/SampleTreatmentsTable.tsx +++ b/src/pages/studyView/table/treatments/SampleTreatmentsTable.tsx @@ -3,7 +3,6 @@ import { observer } from 'mobx-react'; import _ from 'lodash'; import FixedHeaderTable, { IFixedHeaderTableProps } from '../FixedHeaderTable'; import { action, computed, observable, makeObservable } from 'mobx'; -import autobind from 'autobind-decorator'; import { Column, SortDirection, @@ -12,8 +11,7 @@ import { SampleTreatmentRow } from 'cbioportal-ts-api-client'; import { correctColumnWidth } from 'pages/studyView/StudyViewUtils'; import LabeledCheckbox from 'shared/components/labeledCheckbox/LabeledCheckbox'; import styles from 'pages/studyView/table/tables.module.scss'; -import MobxPromise from 'mobxpromise'; -import { stringListToIndexSet } from 'cbioportal-frontend-commons'; +import { MobxPromise, stringListToIndexSet } from 'cbioportal-frontend-commons'; import ifNotDefined from 'shared/lib/ifNotDefined'; import { treatmentUniqueKey, diff --git a/src/shared/alterationFiltering/AnnotationFilteringSettings.ts b/src/shared/alterationFiltering/AnnotationFilteringSettings.ts index 8965c7c4d02..f4727daa00a 100644 --- a/src/shared/alterationFiltering/AnnotationFilteringSettings.ts +++ b/src/shared/alterationFiltering/AnnotationFilteringSettings.ts @@ -1,6 +1,6 @@ import { action, observable, ObservableMap } from 'mobx'; import { getServerConfig } from 'config/config'; -import { MobxPromiseUnionType } from 'mobxpromise'; +import { MobxPromiseUnionType } from 'cbioportal-frontend-commons'; import _ from 'lodash'; export interface IAnnotationFilterSettings diff --git a/src/shared/cache/ClinicalDataCache.ts b/src/shared/cache/ClinicalDataCache.ts index 8ac4a8505a0..e8f4b2e591b 100644 --- a/src/shared/cache/ClinicalDataCache.ts +++ b/src/shared/cache/ClinicalDataCache.ts @@ -8,7 +8,7 @@ import { Patient, Sample, } from 'cbioportal-ts-api-client'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { ExtendedClinicalAttribute } from '../../pages/resultsView/ResultsViewPageStoreUtils'; import { CoverageInformation } from '../lib/GenePanelUtils'; import _ from 'lodash'; diff --git a/src/shared/cache/ResidueMappingCache.ts b/src/shared/cache/ResidueMappingCache.ts index 3249d227575..f4d7e63104e 100644 --- a/src/shared/cache/ResidueMappingCache.ts +++ b/src/shared/cache/ResidueMappingCache.ts @@ -5,8 +5,7 @@ import { } from 'genome-nexus-ts-api-client'; import g2sClient from 'shared/api/g2sClientInstance'; import { CacheData } from 'shared/lib/LazyMobXCache'; -import { remoteData } from 'cbioportal-frontend-commons'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise, remoteData } from 'cbioportal-frontend-commons'; export type ResidueMappingQuery = { uniprotId: string; diff --git a/src/shared/components/GeneSelectionBox/GeneSymbolValidator.tsx b/src/shared/components/GeneSelectionBox/GeneSymbolValidator.tsx index 9a31e43a403..c9dcdfbaa25 100644 --- a/src/shared/components/GeneSelectionBox/GeneSymbolValidator.tsx +++ b/src/shared/components/GeneSelectionBox/GeneSymbolValidator.tsx @@ -144,7 +144,7 @@ export default class GeneSymbolValidator extends React.Component< if (this.props.afterValidation) { this.props.afterValidation( genes.suggestions.length === 0, - this.genes.result, + genes, this.oql ); } diff --git a/src/shared/components/cnSegments/CNSegmentsDownloader.tsx b/src/shared/components/cnSegments/CNSegmentsDownloader.tsx index 065ae51e784..9ea3f083128 100644 --- a/src/shared/components/cnSegments/CNSegmentsDownloader.tsx +++ b/src/shared/components/cnSegments/CNSegmentsDownloader.tsx @@ -1,10 +1,9 @@ import * as React from 'react'; -import MobxPromise from 'mobxpromise/dist/src/MobxPromise'; import { makeObservable, observable } from 'mobx'; import { observer } from 'mobx-react'; import { Button } from 'react-bootstrap'; import classnames from 'classnames'; -import { DefaultTooltip } from 'cbioportal-frontend-commons'; +import { DefaultTooltip, MobxPromise } from 'cbioportal-frontend-commons'; import { CopyNumberSeg } from 'cbioportal-ts-api-client'; import { generateSegmentFileContent } from 'shared/lib/IGVUtils'; import { onMobxPromise } from 'cbioportal-frontend-commons'; diff --git a/src/shared/components/driverAnnotations/SettingsMenu.spec.tsx b/src/shared/components/driverAnnotations/SettingsMenu.spec.tsx index 6e1a294be5f..3219b13f5ba 100644 --- a/src/shared/components/driverAnnotations/SettingsMenu.spec.tsx +++ b/src/shared/components/driverAnnotations/SettingsMenu.spec.tsx @@ -7,7 +7,7 @@ import { IAnnotationFilterSettings, IDriverAnnotationReport, } from 'shared/alterationFiltering/AnnotationFilteringSettings'; -import { MobxPromiseUnionType } from 'mobxpromise'; +import { MobxPromiseUnionType } from 'cbioportal-frontend-commons'; import { observable } from 'mobx'; import SettingsMenu from 'shared/components/driverAnnotations/SettingsMenu'; diff --git a/src/shared/components/mutationMapper/MutationMapperStore.ts b/src/shared/components/mutationMapper/MutationMapperStore.ts index 673eab8d6e6..bb9a5a94ac0 100644 --- a/src/shared/components/mutationMapper/MutationMapperStore.ts +++ b/src/shared/components/mutationMapper/MutationMapperStore.ts @@ -1,6 +1,6 @@ import autobind from 'autobind-decorator'; import { computed, makeObservable } from 'mobx'; -import MobxPromise, { cached } from 'mobxpromise'; +import { MobxPromise, cached } from 'cbioportal-frontend-commons'; import memoize from 'memoize-weak-decorator'; import { diff --git a/src/shared/components/mutationTable/MutationTable.tsx b/src/shared/components/mutationTable/MutationTable.tsx index f33238350c3..0454d0466b6 100644 --- a/src/shared/components/mutationTable/MutationTable.tsx +++ b/src/shared/components/mutationTable/MutationTable.tsx @@ -1,12 +1,6 @@ import * as React from 'react'; import { observer } from 'mobx-react'; -import { - action, - observable, - computed, - makeObservable, - makeAutoObservable, -} from 'mobx'; +import { action, observable, computed, makeObservable } from 'mobx'; import _ from 'lodash'; import { default as LazyMobXTable, @@ -66,6 +60,10 @@ import { extractGenomicLocation, genomicLocationString, } from 'cbioportal-utils'; +import { + DownloadControlOption, + MobxPromise, +} from 'cbioportal-frontend-commons'; import { generateQueryVariantId } from 'oncokb-frontend-commons'; import { VariantAnnotation } from 'genome-nexus-ts-api-client'; import { CancerGene } from 'oncokb-ts-api-client'; @@ -82,6 +80,14 @@ import { getDefaultASCNMethodColumnDefinition } from 'shared/components/mutation import { getDefaultCancerCellFractionColumnDefinition } from 'shared/components/mutationTable/column/cancerCellFraction/CancerCellFractionColumnFormatter'; import { getDefaultClonalColumnDefinition } from 'shared/components/mutationTable/column/clonal/ClonalColumnFormatter'; import { getDefaultExpectedAltCopiesColumnDefinition } from 'shared/components/mutationTable/column/expectedAltCopies/ExpectedAltCopiesColumnFormatter'; +import { getServerConfig } from 'config/config'; +import { + calculateOncoKbContentPadding, + calculateOncoKbContentWidthOnNextFrame, + calculateOncoKbContentWidthWithInterval, + DEFAULT_ONCOKB_CONTENT_WIDTH, +} from 'shared/lib/AnnotationColumnUtils'; +import { NamespaceColumnConfig } from 'shared/components/namespaceColumns/NamespaceColumnConfig'; export interface IMutationTableProps { studyIdToStudy?: { [studyId: string]: CancerStudy }; @@ -158,16 +164,6 @@ export interface IMutationTableProps { deactivateColumnFilter?: (columnId: string) => void; customControls?: JSX.Element; } -import MobxPromise from 'mobxpromise'; -import { getServerConfig } from 'config/config'; -import { - calculateOncoKbContentPadding, - calculateOncoKbContentWidthOnNextFrame, - calculateOncoKbContentWidthWithInterval, - DEFAULT_ONCOKB_CONTENT_WIDTH, -} from 'shared/lib/AnnotationColumnUtils'; -import { DownloadControlOption } from 'cbioportal-frontend-commons'; -import { NamespaceColumnConfig } from 'shared/components/namespaceColumns/NamespaceColumnConfig'; export enum MutationTableColumnType { STUDY = 'Study of Origin', diff --git a/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.spec.tsx b/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.spec.tsx index 7172d10a6b7..7df6aba1192 100644 --- a/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.spec.tsx +++ b/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.spec.tsx @@ -5,7 +5,7 @@ import { initMutation } from 'test/MutationMockUtils'; import { initClinicalData } from 'test/ClinicalDataMockUtils'; import { CLINICAL_ATTRIBUTE_ID_ENUM } from 'shared/constants'; import SampleManager from 'pages/patientView/SampleManager'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { getDefaultASCNCopyNumberColumnDefinition } from './ASCNCopyNumberColumnFormatter'; /* Test design diff --git a/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.tsx b/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.tsx index 6270fa1026c..390fe59b6f0 100644 --- a/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.tsx +++ b/src/shared/components/mutationTable/column/ascnCopyNumber/ASCNCopyNumberColumnFormatter.tsx @@ -12,7 +12,7 @@ import { CLINICAL_ATTRIBUTE_ID_ENUM, MUTATION_DATA_FIELD_ENUM, } from 'shared/constants'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { errorIcon, loaderIcon } from 'oncokb-frontend-commons'; /** diff --git a/src/shared/components/oncoprint/OncoprintUtils.ts b/src/shared/components/oncoprint/OncoprintUtils.ts index 2a294750e1c..ad743352143 100644 --- a/src/shared/components/oncoprint/OncoprintUtils.ts +++ b/src/shared/components/oncoprint/OncoprintUtils.ts @@ -1,4 +1,4 @@ -import OncoprintJS, { +import { ICategoricalRuleSetParams, IGeneticAlterationRuleSetParams, IGradientRuleSetParams, @@ -25,7 +25,7 @@ import { } from './geneticrules'; import { AlterationTypeConstants } from 'shared/constants'; import { CoverageInformation } from '../../lib/GenePanelUtils'; -import { remoteData } from 'cbioportal-frontend-commons'; +import { MobxPromise, remoteData } from 'cbioportal-frontend-commons'; import { makeCategoricalTrackData, makeClinicalTrackData, @@ -33,11 +33,8 @@ import { makeHeatmapTrackData, } from './DataUtils'; import _, { isNumber } from 'lodash'; -import ResultsViewOncoprint, { - getClinicalTrackValues, -} from './ResultsViewOncoprint'; +import ResultsViewOncoprint from './ResultsViewOncoprint'; import { action, IObservableArray, ObservableMap, runInAction } from 'mobx'; -import { MobxPromise } from 'mobxpromise'; import GenesetCorrelatedGeneCache from 'shared/cache/GenesetCorrelatedGeneCache'; import { isMergedTrackFilter, diff --git a/src/shared/components/oncoprint/controls/OncoprintControls.tsx b/src/shared/components/oncoprint/controls/OncoprintControls.tsx index 75da0980246..887dfd78745 100644 --- a/src/shared/components/oncoprint/controls/OncoprintControls.tsx +++ b/src/shared/components/oncoprint/controls/OncoprintControls.tsx @@ -4,7 +4,6 @@ import { Button, ButtonGroup } from 'react-bootstrap'; import CustomDropdown from './CustomDropdown'; import ConfirmNgchmModal from './ConfirmNgchmModal'; import ReactSelect from 'react-select1'; -import { MobxPromise } from 'mobxpromise'; import { action, computed, observable, reaction, makeObservable } from 'mobx'; import _ from 'lodash'; import { SortMode } from '../ResultsViewOncoprint'; @@ -18,12 +17,12 @@ import { DefaultTooltip, DownloadControlOption, EditableSpan, + MobxPromise, } from 'cbioportal-frontend-commons'; import Slider from 'react-rangeslider'; import 'react-rangeslider/lib/index.css'; import './styles.scss'; import classNames from 'classnames'; -import { SpecialAttribute } from '../../../cache/ClinicalDataCache'; import { ResultsViewPageStore } from '../../../../pages/resultsView/ResultsViewPageStore'; import { OncoprintAnalysisCaseType, diff --git a/src/shared/components/progressIndicator/ProgressIndicator.tsx b/src/shared/components/progressIndicator/ProgressIndicator.tsx index 79934cf4467..138b1c34574 100644 --- a/src/shared/components/progressIndicator/ProgressIndicator.tsx +++ b/src/shared/components/progressIndicator/ProgressIndicator.tsx @@ -6,7 +6,7 @@ import { computed, makeObservable, observable } from 'mobx'; import _ from 'lodash'; import ErrorMessage from '../ErrorMessage'; import Spinner from 'react-spinkit'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { getRemoteDataGroupStatus } from 'cbioportal-utils'; import autobind from 'autobind-decorator'; diff --git a/src/shared/components/query/QueryContainer.tsx b/src/shared/components/query/QueryContainer.tsx index 159bd7bf210..a81492c8709 100644 --- a/src/shared/components/query/QueryContainer.tsx +++ b/src/shared/components/query/QueryContainer.tsx @@ -53,7 +53,8 @@ export default class QueryContainer extends React.Component< this.store.cancerTypes.isComplete && this.store.cancerStudies.isComplete && this.store.selectedPhysicalStudies.isComplete && - this.store.profiledSamplesCount.isComplete) + this.store.profiledSamplesCount.isComplete && + this.store.cancerStudyTags.isComplete) ); } diff --git a/src/shared/components/query/QueryStore.ts b/src/shared/components/query/QueryStore.ts index a014fbc7c46..fbf4d1322b1 100644 --- a/src/shared/components/query/QueryStore.ts +++ b/src/shared/components/query/QueryStore.ts @@ -23,19 +23,20 @@ import { } from 'cbioportal-ts-api-client'; import CancerStudyTreeData from './CancerStudyTreeData'; import { + cached, + debounceAsync, getBrowserWindow, remoteData, stringListToIndexSet, stringListToSet, } from 'cbioportal-frontend-commons'; -import { cached, debounceAsync } from 'mobxpromise'; import internalClient from '../../api/cbioportalInternalClientInstance'; import { SingleGeneQuery, SyntaxError } from '../../lib/oql/oql-parser'; import { parseOQLQuery } from '../../lib/oql/oqlfilter'; import memoize from 'memoize-weak-decorator'; import { ComponentGetsStoreContext } from '../../lib/ContextUtils'; import URL from 'url'; -import { buildCBioPortalPageUrl, redirectToStudyView } from '../../api/urls'; +import { redirectToStudyView } from '../../api/urls'; import StudyListLogic from './StudyListLogic'; import chunkMapReduce from 'shared/lib/chunkMapReduce'; import { categorizedSamplesCount, currentQueryParams } from './QueryStoreUtils'; @@ -56,7 +57,6 @@ import { getVolcanoPlotMinYValue, } from 'shared/components/query/GenesetsSelectorStore'; import SampleListsInStudyCache from 'shared/cache/SampleListsInStudyCache'; -import formSubmit from '../../lib/formSubmit'; import { getServerConfig, ServerConfigHelpers } from '../../../config/config'; import { AlterationTypeConstants } from 'shared/constants'; import { diff --git a/src/shared/components/query/StudyListLogic.ts b/src/shared/components/query/StudyListLogic.ts index 556e4804486..d6b4dfd7597 100644 --- a/src/shared/components/query/StudyListLogic.ts +++ b/src/shared/components/query/StudyListLogic.ts @@ -11,7 +11,7 @@ import { import { QueryStore } from './QueryStore'; import { computed, action, makeObservable } from 'mobx'; import { performSearchSingle } from '../../lib/query/textQueryUtils'; -import { cached } from 'mobxpromise'; +import { cached } from 'cbioportal-frontend-commons'; import { ServerConfigHelpers } from '../../../config/config'; import memoize from 'memoize-weak-decorator'; import { SearchResult } from 'shared/components/query/filteredSearch/SearchClause'; diff --git a/src/shared/components/sectionHeader/SectionHeader.tsx b/src/shared/components/sectionHeader/SectionHeader.tsx index 84fff785578..4c9dc144f93 100644 --- a/src/shared/components/sectionHeader/SectionHeader.tsx +++ b/src/shared/components/sectionHeader/SectionHeader.tsx @@ -1,11 +1,10 @@ import * as React from 'react'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { observer } from 'mobx-react'; import styles from './styles.module.scss'; import classNames from 'classnames'; import ErrorBox from '../errorBox/ErrorBox'; import ReactElement = React.ReactElement; -import { ThreeBounce } from 'better-react-spinkit'; import LoadingIndicator from '../loadingIndicator/LoadingIndicator'; interface ISectionHeaderProps diff --git a/src/shared/components/userMessager/UserMessage.tsx b/src/shared/components/userMessager/UserMessage.tsx index dd07b023b1c..d5253ddc8fb 100644 --- a/src/shared/components/userMessager/UserMessage.tsx +++ b/src/shared/components/userMessager/UserMessage.tsx @@ -1,14 +1,13 @@ import * as React from 'react'; import { observer } from 'mobx-react'; import { remoteData, isWebdriver } from 'cbioportal-frontend-commons'; -import { action, computed, observable, makeObservable } from 'mobx'; +import { action, observable, makeObservable } from 'mobx'; import autobind from 'autobind-decorator'; import _ from 'lodash'; import styles from './styles.module.scss'; import classNames from 'classnames'; -import { MobxPromise } from 'mobxpromise'; import { Portal } from 'react-portal'; -import { getBrowserWindow } from 'cbioportal-frontend-commons'; +import { getBrowserWindow, MobxPromise } from 'cbioportal-frontend-commons'; import ExtendedRouterStore from 'shared/lib/ExtendedRouterStore'; export interface IUserMessage { @@ -63,21 +62,16 @@ if ( // MSK specific messaging if ( - [ - 'cbioportal.mskcc.org', - ].includes(getBrowserWindow().location.hostname) + ['cbioportal.mskcc.org'].includes(getBrowserWindow().location.hostname) ) { - MESSAGE_DATA.push( - { - dateEnd: 100000000000000, - content: `The MSK-IMPACT cohort now includes additional NLP-derived data elements from the Cancer Data Science Initiative (Read more)`, - id: '2023_msk_chord_release', - } - ) + MESSAGE_DATA.push({ + dateEnd: 100000000000000, + content: `The MSK-IMPACT cohort now includes additional NLP-derived data elements from the Cancer Data Science Initiative (Read more)`, + id: '2023_msk_chord_release', + }); } } - interface IUserMessagerProps { dataUrl?: string; messages?: IUserMessage[]; diff --git a/src/shared/lib/CancerHotspotsUtils.ts b/src/shared/lib/CancerHotspotsUtils.ts index bb70ce4c2cc..3594778effd 100644 --- a/src/shared/lib/CancerHotspotsUtils.ts +++ b/src/shared/lib/CancerHotspotsUtils.ts @@ -1,4 +1,4 @@ -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { Mutation } from 'cbioportal-ts-api-client'; import { GenomeNexusAPIInternal, diff --git a/src/shared/lib/CivicUtils.spec.ts b/src/shared/lib/CivicUtils.spec.ts index 676fe3e5dc8..89ec9be1da3 100644 --- a/src/shared/lib/CivicUtils.spec.ts +++ b/src/shared/lib/CivicUtils.spec.ts @@ -1,5 +1,5 @@ import { assert } from 'chai'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { getCivicEntry } from 'cbioportal-utils'; import { Mutation } from 'cbioportal-ts-api-client'; diff --git a/src/shared/lib/CivicUtils.ts b/src/shared/lib/CivicUtils.ts index 335dcbe7dba..545aa8c5906 100644 --- a/src/shared/lib/CivicUtils.ts +++ b/src/shared/lib/CivicUtils.ts @@ -1,4 +1,4 @@ -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { CivicAlterationType, fetchCivicGenes as fetchDefaultCivicGenes, diff --git a/src/shared/lib/GenePanelUtils.ts b/src/shared/lib/GenePanelUtils.ts index 7e1d56d1d02..7f8c5ac6250 100644 --- a/src/shared/lib/GenePanelUtils.ts +++ b/src/shared/lib/GenePanelUtils.ts @@ -1,15 +1,11 @@ import _ from 'lodash'; -import { MobxPromise } from 'mobxpromise'; import client from 'shared/api/cbioportalClientInstance'; import { Gene, GenePanel, GenePanelData, - GenePanelDataMultipleStudyFilter, - MolecularProfile, Patient, Sample, - SampleMolecularIdentifier, } from 'cbioportal-ts-api-client'; import { REQUEST_ARG_ENUM } from 'shared/constants'; diff --git a/src/shared/lib/MobxPromiseCache.ts b/src/shared/lib/MobxPromiseCache.ts index e98395a7868..0723c5f3b90 100644 --- a/src/shared/lib/MobxPromiseCache.ts +++ b/src/shared/lib/MobxPromiseCache.ts @@ -1,4 +1,7 @@ -import { MobxPromise, MobxPromiseInputParams } from 'mobxpromise'; +import { + MobxPromise, + MobxPromiseInputParams, +} from 'cbioportal-frontend-commons'; import { logicalAnd } from './LogicUtils'; export function stringifyObjectUnique(obj: { [k: string]: any }) { diff --git a/src/shared/lib/MutationTableDownloadDataFetcher.ts b/src/shared/lib/MutationTableDownloadDataFetcher.ts index d872b28824c..84b3235560d 100644 --- a/src/shared/lib/MutationTableDownloadDataFetcher.ts +++ b/src/shared/lib/MutationTableDownloadDataFetcher.ts @@ -1,4 +1,4 @@ -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { ILazyMobXTableApplicationLazyDownloadDataFetcher } from 'shared/lib/ILazyMobXTableApplicationLazyDownloadDataFetcher'; import LazyMobXCache from 'shared/lib/LazyMobXCache'; import { diff --git a/src/shared/lib/StoreUtils.spec.ts b/src/shared/lib/StoreUtils.spec.ts index 124af83bae7..e4b274fb0de 100644 --- a/src/shared/lib/StoreUtils.spec.ts +++ b/src/shared/lib/StoreUtils.spec.ts @@ -21,7 +21,7 @@ import { import _ from 'lodash'; import { assert } from 'chai'; import sinon from 'sinon'; -import { MobxPromise } from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; import { CancerStudy, ClinicalData, diff --git a/src/shared/lib/StoreUtils.ts b/src/shared/lib/StoreUtils.ts index 0758c8ebefc..9fc062f80ed 100644 --- a/src/shared/lib/StoreUtils.ts +++ b/src/shared/lib/StoreUtils.ts @@ -37,7 +37,7 @@ import defaultClient from 'shared/api/cbioportalClientInstance'; import client from 'shared/api/cbioportalClientInstance'; import internalClient from 'shared/api/cbioportalInternalClientInstance'; import g2sClient from 'shared/api/g2sClientInstance'; -import { stringListToIndexSet } from 'cbioportal-frontend-commons'; +import { MobxPromise, stringListToIndexSet } from 'cbioportal-frontend-commons'; import { Alignment, Genome2StructureAPI, @@ -61,7 +61,6 @@ import { OtherBiomarkersQueryType, } from 'oncokb-frontend-commons'; import { getAlterationString } from 'shared/lib/CopyNumberUtils'; -import { MobxPromise } from 'mobxpromise'; import { keywordToCosmic } from 'shared/lib/AnnotationUtils'; import { indexPdbAlignments } from 'shared/lib/PdbUtils'; import { IGisticData } from 'shared/model/Gistic'; diff --git a/src/shared/lib/comparison/AnalysisStore.ts b/src/shared/lib/comparison/AnalysisStore.ts index 876cfcb2346..c197f634aa2 100644 --- a/src/shared/lib/comparison/AnalysisStore.ts +++ b/src/shared/lib/comparison/AnalysisStore.ts @@ -1,4 +1,9 @@ -import { remoteData } from 'cbioportal-frontend-commons'; +import { + cached, + MobxPromise, + MobxPromiseUnionTypeWithDefault, + remoteData, +} from 'cbioportal-frontend-commons'; import { CancerStudy, ClinicalData, @@ -9,11 +14,10 @@ import { MutationCountByPosition, Sample, } from 'cbioportal-ts-api-client'; -import { computed, makeObservable, observable } from 'mobx'; +import { computed, observable } from 'mobx'; import _ from 'lodash'; import internalClient from '../../api/cbioportalInternalClientInstance'; import { - evaluatePutativeDriverInfo, evaluatePutativeDriverInfoWithHotspots, fetchOncoKbCancerGenes, fetchOncoKbDataForOncoprint, @@ -25,10 +29,6 @@ import { makeIsHotspotForOncoprint, ONCOKB_DEFAULT, } from 'shared/lib/StoreUtils'; -import MobxPromise, { - cached, - MobxPromiseUnionTypeWithDefault, -} from 'mobxpromise'; import { DriverAnnotationSettings } from 'shared/alterationFiltering/AnnotationFilteringSettings'; import { getServerConfig } from 'config/config'; import { CancerGene, IndicatorQueryResp } from 'oncokb-ts-api-client'; diff --git a/src/shared/lib/comparison/ComparisonStore.ts b/src/shared/lib/comparison/ComparisonStore.ts index 95fdfe6f7ad..d375c0116c2 100644 --- a/src/shared/lib/comparison/ComparisonStore.ts +++ b/src/shared/lib/comparison/ComparisonStore.ts @@ -14,6 +14,8 @@ import { import { GroupComparisonTab } from '../../../pages/groupComparison/GroupComparisonTabs'; import { findFirstMostCommonElt, + MobxPromise, + onMobxPromise, remoteData, stringListToMap, } from 'cbioportal-frontend-commons'; @@ -80,11 +82,9 @@ import { fetchSurvivalDataExists, getSurvivalClinicalAttributesPrefix, } from 'shared/lib/StoreUtils'; -import MobxPromise from 'mobxpromise'; import { ResultsViewPageStore } from '../../../pages/resultsView/ResultsViewPageStore'; import { AlterationTypeConstants, DataTypeConstants } from 'shared/constants'; import { getSurvivalStatusBoolean } from 'pages/resultsView/survival/SurvivalUtil'; -import { onMobxPromise } from 'cbioportal-frontend-commons'; import { cnaEventTypeSelectInit, CopyNumberEnrichmentEventType, @@ -97,7 +97,6 @@ import { } from 'shared/lib/comparison/ComparisonStoreUtils'; import { buildDriverAnnotationSettings, - DriverAnnotationSettings, IAnnotationFilterSettings, IDriverAnnotationReport, initializeCustomDriverAnnotationSettings, diff --git a/src/shared/lib/customTabs/customTabHelpers.tsx b/src/shared/lib/customTabs/customTabHelpers.tsx index 6550d0d182a..85726ee09e4 100644 --- a/src/shared/lib/customTabs/customTabHelpers.tsx +++ b/src/shared/lib/customTabs/customTabHelpers.tsx @@ -5,13 +5,9 @@ import * as React from 'react'; import { ICustomTabConfiguration, ICustomTabWrapper, - ITabConfiguration, } from 'shared/model/ITabConfiguration'; -import MobxPromise from 'mobxpromise'; -import autobind from 'autobind-decorator'; import { showCustomTab } from 'shared/lib/customTabs'; import { getBrowserWindow, remoteData } from 'cbioportal-frontend-commons'; -import { getServerConfig } from 'config/config'; function customTabCallback(div: HTMLDivElement, tab: any, isUnmount = false) { showCustomTab(div, tab, getBrowserWindow().location.href, null, isUnmount); diff --git a/src/shared/model/ITabConfiguration.ts b/src/shared/model/ITabConfiguration.ts index ccf43f11fff..8f44c8f0768 100644 --- a/src/shared/model/ITabConfiguration.ts +++ b/src/shared/model/ITabConfiguration.ts @@ -1,5 +1,5 @@ import { ResultsViewTab } from '../../pages/resultsView/ResultsViewPageHelpers'; -import MobxPromise from 'mobxpromise'; +import { MobxPromise } from 'cbioportal-frontend-commons'; export interface ITabConfiguration { id: ResultsViewTab; getTab: () => JSX.Element; diff --git a/yarn.lock b/yarn.lock index 34ffa84a357..94b0d80290e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16643,18 +16643,6 @@ mobx@^6.0.0: resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.0.4.tgz#8fc3e3629a3346f8afddf5bd954411974744dad1" integrity sha512-wT2QJT9tW19VSHo9x7RPKU3z/I2Ps6wUS8Kb1OO+kzmg7UY3n4AkcaYG6jq95Lp1R9ohjC/NGYuT2PtuvBjhFg== -"mobxpromise@github:cbioportal/mobxpromise#303db72588860bff0a6862a4f07a4e8a3578c94f": - version "2.0.1" - resolved "https://codeload.github.com/cbioportal/mobxpromise/tar.gz/303db72588860bff0a6862a4f07a4e8a3578c94f" - dependencies: - mobx "^6.0.0" - -"mobxpromise@github:cbioportal/mobxpromise#c3429672eb39be54e54ce14a8636e8d843729db3": - version "2.0.1" - resolved "https://codeload.github.com/cbioportal/mobxpromise/tar.gz/c3429672eb39be54e54ce14a8636e8d843729db3" - dependencies: - mobx "^6.0.0" - modify-values@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"