Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Add Configurable Param for max number of samples in study vi… #4587

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
20 changes: 15 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,28 @@ 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 &&
this.store.selectableSelectedStudies.length > 1;
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';
}
Expand Down