diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx')
-rw-r--r-- | server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx b/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx index 7ba8b943083..379c082bfe8 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx @@ -20,38 +20,47 @@ import * as React from 'react'; import { connect } from 'react-redux'; import AdminContext from '../../app/components/AdminContext'; -import { getAppState, getGlobalSettingValue, Store } from '../../store/rootReducer'; +import withAppStateContext from '../../app/components/app-state/withAppStateContext'; +import { getGlobalSettingValue, Store } from '../../store/rootReducer'; import { EditionKey } from '../../types/editions'; -import { RawQuery } from '../../types/types'; +import { AppState, RawQuery } from '../../types/types'; import App from './App'; interface OwnProps { location: { pathname: string; query: RawQuery }; + appState: AppState; } interface StateToProps { - currentEdition?: EditionKey; - standaloneMode?: boolean; updateCenterActive: boolean; } const mapStateToProps = (state: Store) => { const updateCenterActive = getGlobalSettingValue(state, 'sonar.updatecenter.activate'); return { - currentEdition: getAppState(state).edition as EditionKey, // TODO: Fix once AppState is no longer ambiant. - standaloneMode: getAppState(state).standalone, updateCenterActive: Boolean(updateCenterActive && updateCenterActive.value === 'true') }; }; function WithAdminContext(props: StateToProps & OwnProps) { + const propsToPass = { + location: props.location, + updateCenterActive: props.updateCenterActive, + currentEdition: props.appState.edition as EditionKey, + standaloneMode: props.appState.standalone + }; + return ( <AdminContext.Consumer> {({ fetchPendingPlugins, pendingPlugins }) => ( - <App fetchPendingPlugins={fetchPendingPlugins} pendingPlugins={pendingPlugins} {...props} /> + <App + fetchPendingPlugins={fetchPendingPlugins} + pendingPlugins={pendingPlugins} + {...propsToPass} + /> )} </AdminContext.Consumer> ); } -export default connect(mapStateToProps)(WithAdminContext); +export default connect(mapStateToProps)(withAppStateContext(WithAdminContext)); |