Skip to content

Commit

Permalink
Move comment for hide download controls to separate function
Browse files Browse the repository at this point in the history
PR feedback Adam
  • Loading branch information
pvannierop committed May 27, 2021
1 parent b744a2f commit 42617db
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 37 deletions.
3 changes: 2 additions & 1 deletion src/pages/groupComparison/ClinicalDataEnrichmentsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { makeObservable, observable } from 'mobx';
import { toggleColumnVisibility } from 'cbioportal-frontend-commons';
import { IColumnVisibilityDef } from 'shared/components/columnVisibilityControls/ColumnVisibilityControls';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export interface IClinicalDataEnrichmentsTableProps {
dataStore: ClinicalDataEnrichmentStore;
Expand Down Expand Up @@ -203,7 +204,7 @@ export default class ClinicalDataEnrichmentsTable extends React.Component<
paginationProps={{ itemsPerPageOptions: [20] }}
initialItemsPerPage={20}
copyDownloadProps={{
showCopy: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopy: shouldShowDownloadAndCopyControls(),
}}
/>
);
Expand Down
5 changes: 2 additions & 3 deletions src/pages/patientView/patientHeader/PatientHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from 'cbioportal-frontend-commons';
import SampleManager from '../SampleManager';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export type IPatientHeaderProps = {
patient: any;
Expand Down Expand Up @@ -69,9 +70,7 @@ export default class PatientHeader extends React.Component<
<h5>{patient.id}</h5>
<ClinicalInformationPatientTable
showFilter={false}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
showTitleBar={false}
data={patient.clinicalData}
/>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/patientView/patientHeader/SampleInline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ClinicalDataBySampleId } from 'cbioportal-ts-api-client';
import ClinicalInformationPatientTable from '../clinicalInformation/ClinicalInformationPatientTable';
import './styles.scss';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

interface ISampleInlineProps {
sample: ClinicalDataBySampleId;
Expand Down Expand Up @@ -53,9 +54,7 @@ export default class SampleInline extends React.Component<
{!this.props.hideClinicalTable && (
<ClinicalInformationPatientTable
showFilter={false}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
showTitleBar={false}
data={sample.clinicalData}
onSelectGenePanel={this.props.onSelectGenePanel}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/patientView/trialMatch/TrialMatchTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { getAgeRangeDisplay } from './TrialMatchTableUtils';
import TrialMatchFeedback from './TrialMatchFeedback';
import AppConfig from 'appConfig';
import { Button } from 'react-bootstrap';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export type ITrialMatchProps = {
sampleManager: SampleManager | null;
Expand Down Expand Up @@ -656,9 +657,7 @@ export default class TrialMatchTable extends React.Component<ITrialMatchProps> {
<TrialMatchTableComponent
data={this.props.detailedTrialMatches}
columns={this._columns}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
/>
<div className={styles.powered}>
Powered by{' '}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/resultsView/ResultsViewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import OQLTextArea, {
import browser from 'bowser';
import { QueryStore } from '../../shared/components/query/QueryStore';
import UserMessager from 'shared/components/userMessager/UserMessage';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export function initStore(
appStore: AppStore,
Expand Down Expand Up @@ -600,9 +601,7 @@ export default class ResultsViewPage extends React.Component<
<QueryAndDownloadTabs
forkedMode={false}
showQuickSearchTab={false}
showDownloadTab={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showDownloadTab={shouldShowDownloadAndCopyControls()}
showAlerts={true}
getQueryStore={() =>
createQueryStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { cytobandFilter } from 'pages/resultsView/ResultsViewTableUtils';
import { toConditionalPrecision } from 'shared/lib/NumberUtils';
import { formatSignificanceValueWithStyle } from 'shared/lib/FormatUtils';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export interface ICoExpressionTableGenesProps {
referenceGeneticEntity: Gene | Geneset;
Expand Down Expand Up @@ -180,7 +181,7 @@ export default class CoExpressionTableGenes extends React.Component<
paginationProps={this.paginationProps}
initialItemsPerPage={25}
copyDownloadProps={{
showCopy: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopy: shouldShowDownloadAndCopyControls(),
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { bind } from 'bind-decorator';
import { toConditionalPrecision } from 'shared/lib/NumberUtils';
import { formatSignificanceValueWithStyle } from 'shared/lib/FormatUtils';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export interface ICoExpressionTableGenesetsProps {
referenceGeneticEntity: Gene | Geneset;
Expand Down Expand Up @@ -163,7 +164,7 @@ export default class CoExpressionTableGenesets extends React.Component<
paginationProps={this.paginationProps}
initialItemsPerPage={25}
copyDownloadProps={{
showCopy: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopy: shouldShowDownloadAndCopyControls(),
}}
/>
</div>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/resultsView/querySummary/QuerySummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import ResultsPageSettings from '../settings/ResultsPageSettings';
import { createQueryStore } from 'shared/lib/createQueryStore';
import _ from 'lodash';
import { mixedReferenceGenomeWarning } from 'shared/lib/referenceGenomeUtils';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

interface QuerySummaryProps {
routingStore: ExtendedRouterStore;
Expand Down Expand Up @@ -261,9 +262,7 @@ export default class QuerySummary extends React.Component<
onSubmit={this.onSubmit}
forkedMode={false}
showQuickSearchTab={false}
showDownloadTab={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showDownloadTab={shouldShowDownloadAndCopyControls()}
showAlerts={true}
modifyQueryParams={this.props.store.modifyQueryParams}
getQueryStore={() =>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/resultsView/survival/SurvivalDescriptionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import LazyMobXTable from 'shared/components/lazyMobXTable/LazyMobXTable';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export interface ISurvivalDescription {
studyName: string;
Expand Down Expand Up @@ -49,9 +50,7 @@ export default class SurvivalDescriptionTable extends React.Component<
initialItemsPerPage={10}
showColumnVisibility={false}
showFilter={false}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
/>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/resultsView/survival/SurvivalPrefixTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { observable, computed, makeObservable, action } from 'mobx';
import AppConfig from 'appConfig';
import Slider from 'react-rangeslider';
import styles from 'pages/resultsView/survival/styles.module.scss';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export interface ISurvivalPrefixTableProps {
survivalPrefixes: SurvivalPrefixSummary[];
Expand Down Expand Up @@ -361,7 +362,7 @@ export default class SurvivalPrefixTable extends React.Component<
paginationProps={{ itemsPerPageOptions: [15] }}
initialItemsPerPage={15}
copyDownloadProps={{
showCopy: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopy: shouldShowDownloadAndCopyControls(),
}}
filterBoxWidth={120}
/>
Expand Down
5 changes: 2 additions & 3 deletions src/pages/staticPages/datasetView/DatasetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getBrowserWindow, getNCBIlink } from 'cbioportal-frontend-commons';
import { StudyLink } from '../../../shared/components/StudyLink/StudyLink';
import { StudyDataDownloadLink } from '../../../shared/components/StudyDataDownloadLink/StudyDataDownloadLink';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

interface IDataTableRow {
name: string;
Expand Down Expand Up @@ -229,9 +230,7 @@ export default class DataSetsPageTable extends React.Component<
showColumnVisibility={true}
showFilter={true}
showFilterClearButton={true}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
initialItemsPerPage={this.props.datasets.length}
/>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/studyView/tabs/ClinicalDataTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import ProgressIndicator, {
import autobind from 'autobind-decorator';
import { WindowWidthBox } from '../../../shared/components/WindowWidthBox/WindowWidthBox';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

export interface IClinicalDataTabTable {
store: StudyViewPageStore;
Expand Down Expand Up @@ -217,7 +218,7 @@ export class ClinicalDataTab extends React.Component<
}
columns={this.columns.result}
copyDownloadProps={{
showCopy: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopy: shouldShowDownloadAndCopyControls(),
downloadFilename: this.props.store
.clinicalDataDownloadFilename,
}}
Expand Down
5 changes: 2 additions & 3 deletions src/shared/components/cosmic/CosmicMutationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
default as LazyMobXTable,
} from '../lazyMobXTable/LazyMobXTable';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

// TODO interface ICosmicTableProps extends IMSKTableProps<CosmicMutation>
// To avoid duplication, it would be nice here to have an extendable interface for LazyMobXTableProps
Expand Down Expand Up @@ -93,9 +94,7 @@ export default class CosmicMutationTable extends React.Component<
initialSortColumn={initialSortColumn}
initialSortDirection={initialSortDirection}
initialItemsPerPage={initialItemsPerPage}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
showColumnVisibility={false}
showFilter={false}
showPagination={showPagination}
Expand Down
5 changes: 2 additions & 3 deletions src/shared/components/proteinChainPanel/PdbChainTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import OrganismColumnFormatter from './column/OrganismColumnFormatter';
import LazyLoadedTableCell from 'shared/lib/LazyLoadedTableCell';
import { generatePdbInfoSummary } from '../../lib/PdbUtils';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

class PdbChainTableComponent extends LazyMobXTable<IPdbChain> {}

Expand Down Expand Up @@ -201,9 +202,7 @@ export default class PdbChainTable extends React.Component<
return (
<PdbChainTableComponent
showColumnVisibility={false}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
itemsLabel="PDB chain"
itemsLabelPlural="PDB chains"
paginationProps={{
Expand Down
5 changes: 2 additions & 3 deletions src/shared/components/query/GenesetsVolcanoSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import { QueryStoreComponent } from './QueryStore';
import { CBIOPORTAL_VICTORY_THEME } from 'cbioportal-frontend-commons';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

class GenesetsVolcanoTable extends LazyMobXTable<Geneset> {}

Expand Down Expand Up @@ -346,9 +347,7 @@ export default class GenesetsVolcanoSelector extends QueryStoreComponent<
initialItemsPerPage={100}
showColumnVisibility={false}
showFilter={true}
showCopyDownload={
false // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
}
showCopyDownload={shouldShowDownloadAndCopyControls()}
/>
)}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/query/GisticGeneSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IColumnDefMap } from '../enhancedReactTable/IEnhancedReactTableProps';
import { toPrecision } from '../../lib/FormatUtils';
import { getGeneSymbols, sortByCytoband } from '../../lib/GisticUtils';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

const DEFAULT_NUM_GENES_SHOWN = 5;

Expand Down Expand Up @@ -170,7 +171,7 @@ export default class GisticGeneSelector extends React.Component<
columns={this.columns}
rawData={this.props.data}
headerControlsProps={{
showCopyAndDownload: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopyAndDownload: shouldShowDownloadAndCopyControls(),
showHideShowColumnButton: false,
showPagination: true,
}}
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/query/MutSigGeneSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { IColumnDefMap } from '../enhancedReactTable/IEnhancedReactTableProps';
import { Td } from 'reactable';
import { toPrecision } from '../../lib/FormatUtils';
import AppConfig from 'appConfig';
import { shouldShowDownloadAndCopyControls } from 'shared/lib/DownloadControlsUtils';

class MutSigTable extends EnhancedReactTable<MutSig> {}

Expand Down Expand Up @@ -156,7 +157,7 @@ export default class MutSigGeneSelector extends React.Component<
columns={this.columns}
rawData={this.props.data}
headerControlsProps={{
showCopyAndDownload: false, // note: under control of AppConfig.serverConfig.skin_hide_download_controls property
showCopyAndDownload: shouldShowDownloadAndCopyControls(),
showHideShowColumnButton: false,
showPagination: true,
}}
Expand Down
6 changes: 6 additions & 0 deletions src/shared/lib/DownloadControlsUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function shouldShowDownloadAndCopyControls() {
// for now, we are always hiding copy controls, but in the future we will use the
// app config to determine whether we show them:
// return !AppConfig.serverConfig.skin_hide_download_controls
return false;
}

0 comments on commit 42617db

Please sign in to comment.