Skip to content

Commit

Permalink
🔧 Add Configurable Param for max number of samples in study view page
Browse files Browse the repository at this point in the history
  • Loading branch information
haynescd committed Apr 20, 2023
1 parent bb350fa commit ab373b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/config/IAppConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/config/serverConfigDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ export const ServerConfigDefaults: Partial<IServerConfig> = {
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;
16 changes: 11 additions & 5 deletions src/shared/components/query/QueryContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -178,19 +179,24 @@ export default class QueryContainer extends React.Component<
this._showQueryControls = !this._showQueryControls;
}

@computed get studyLimitedReached() {
return this.store.selectableSelectedStudyIds.length > 50;
@computed get sampleLimitedReached() {
return getServerConfig().studyview_max_samples_selected
? 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';
}
Expand Down

0 comments on commit ab373b8

Please sign in to comment.