diff --git a/src/config/IAppConfig.ts b/src/config/IAppConfig.ts index eef24a9a134..b1395dab92e 100644 --- a/src/config/IAppConfig.ts +++ b/src/config/IAppConfig.ts @@ -167,4 +167,5 @@ export interface IServerConfig { comparison_categorical_na_values: string; oncoprint_clinical_tracks_config_json: string; enable_cross_study_expression: string; + studyview_max_samples_selected: number; } diff --git a/src/config/serverConfigDefaults.ts b/src/config/serverConfigDefaults.ts index 83839c77a20..16b259c1293 100644 --- a/src/config/serverConfigDefaults.ts +++ b/src/config/serverConfigDefaults.ts @@ -212,6 +212,8 @@ export const ServerConfigDefaults: Partial = { skin_patient_view_copy_number_table_columns_show_on_init: '', skin_patient_view_structural_variant_table_columns_show_on_init: '', + + studyview_max_samples_selected: 0, }; export default ServerConfigDefaults; diff --git a/src/shared/components/query/QueryContainer.tsx b/src/shared/components/query/QueryContainer.tsx index bebc134862d..0968da4fe04 100644 --- a/src/shared/components/query/QueryContainer.tsx +++ b/src/shared/components/query/QueryContainer.tsx @@ -24,6 +24,7 @@ import { StudySelectorStats } from 'shared/components/query/StudySelectorStats'; import $ from 'jquery'; import { serializeEvent } from 'shared/lib/tracking'; import { ModifyQueryParams } from 'pages/resultsView/ResultsViewPageStore'; +import { getServerConfig } from 'config/config'; interface QueryContainerProps { store: QueryStore; @@ -178,19 +179,27 @@ export default class QueryContainer extends React.Component< this._showQueryControls = !this._showQueryControls; } - @computed get studyLimitedReached() { - return this.store.selectableSelectedStudyIds.length > 50; + @computed get sampleLimitedReached() { + const isSampleLimitEnabled = + getServerConfig().studyview_max_samples_selected && + getServerConfig().studyview_max_samples_selected != 0; + return isSampleLimitEnabled + ? this.store.sampleCountForSelectedStudies > + getServerConfig().studyview_max_samples_selected + : false; } @computed get exploreCohortsButtonDisabled() { - return this.studyLimitedReached || !this.store.hasSelectedStudies; + return this.sampleLimitedReached || !this.store.hasSelectedStudies; } @computed get exploreCohortsButtonTooltipMessage() { if (this.store.selectableSelectedStudyIds.length === 0) { return 'Please select at least one study above'; - } else if (this.studyLimitedReached) { - return 'Too many studies selected for study summary (limit: 50)'; + } else if (this.sampleLimitedReached) { + return `Too many samples selected for study summary (limit: ${ + getServerConfig().studyview_max_samples_selected + })`; } else { return 'Open summary of selected studies'; }