Skip to content

Commit

Permalink
Merge pull request #447 from KPMP/KPMP-4417_add_feature_switch
Browse files Browse the repository at this point in the history
KPMP-4417: Added feature switch
  • Loading branch information
rlreamy authored Dec 8, 2023
2 parents a8ae568 + 6705c45 commit 2cf6a87
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ class App extends Component {
<Route exact path='/explorer/dataViz' component={RNASeqVizContainer} store={store} />
<Route exact path='/explorer/regionalviz' component={RegionalVizContainer} store={store} />
<Route exact path='/explorer/diffex' component={DiffexByClusterContainer} store={store} />
<Route exact path='/explorer/regionalpro' component={RegionalProteomicsContainer} store={store}/>
{
process.env.REACT_APP_PROTEOMICS !== "off" &&
<Route exact path='/explorer/regionalpro' component={RegionalProteomicsContainer} store={store}/>
}
<Route exact path='/oops' component={Oops} />
<PrivateUmapRoute exact path='/explorer/dataViz/umap' component={UMAPContainer} store={store} />
<Route path='*' component={NotFoundPage} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/SamplesByDataTypeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SamplesByDataTypeTable extends Component {
async componentDidMount(){

let spatialSummary = await fetchSummaryData("spatialViewerSummary");
spatialSummary = spatialSummary.sort(this.compare)
spatialSummary = spatialSummary.slice().sort(this.compare)
spatialSummary = spatialSummary.filter(availableDataVisibilityFilter)

let explorerSummary = await fetchDataTypeSummaryInformation();
Expand Down
19 changes: 19 additions & 0 deletions src/helpers/ApolloClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ export const fetchDataTypeSummaryInformation = async (fetchPolicy = 'no-cache')
fetchPolicy: fetchPolicy
});
if (response.data && response.data.getDataTypeSummaryInformation) {
if (process.env.REACT_APP_PROTEOMICS === "off") {
return response.data.getDataTypeSummaryInformation.filter((data) => {
return data?.dataTypeShort !== "rp"
})
}
return response.data.getDataTypeSummaryInformation;
} else {
console.log('response.error',response.error)
Expand Down Expand Up @@ -472,6 +477,11 @@ export const fetchSummaryData = async (dataType) => {
});

if (response.data && response.data.getSummaryData) {
if (process.env.REACT_APP_PROTEOMICS === "off") {
return response.data.getSummaryData.filter((data) => {
return data?.dataTypeShort !== "rp"
})
}
return response.data.getSummaryData;
} else {
store.dispatch(sendMessageToBackend("Could not retrieve summary: " + response.error));
Expand Down Expand Up @@ -520,6 +530,15 @@ export const fetchAtlasSummaryRows = async () => {
fetchPolicy: 'cache-first'
});
if (response.data && response.data.getAtlasSummaryRows) {
if (process.env.REACT_APP_PROTEOMICS === "off") {
let summaryRows = response.data.getAtlasSummaryRows.summaryRows.filter((data) => {
return data?.omicsType !== "Regional Proteomics"
})
return {
"totalFiles": response.data.getAtlasSummaryRows.totalFiles,
"summaryRows": summaryRows
}
}
return response.data.getAtlasSummaryRows;
}else {
store.dispatch(sendMessageToBackend("Could not retrieve file counts: " + response.error));
Expand Down
6 changes: 6 additions & 0 deletions src/helpers/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export const getAllDataTypeOptions = () => {
isDisabled: false
}
];
if (process.env.REACT_APP_PROTEOMICS === "off") {
return options.filter((el) => { return el.value !== "rp" });
}
return options;
};

Expand Down Expand Up @@ -141,6 +144,9 @@ export const getDataTypeOptions = async (geneSymbol, cluster) => {
isDisabled: !dataTypes.includes("rp")
}
];
if (process.env.REACT_APP_PROTEOMICS === "off") {
return options.filter((el) => { return el.value !== "rp" });
}
return options;
});
return options;
Expand Down

0 comments on commit 2cf6a87

Please sign in to comment.