aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-08-24 09:23:21 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-08-25 16:01:06 +0200
commit7d034a6d0d9991c251757eb9ab72bd37ac97b6ab (patch)
tree170ba041b744a95f4bc0377fa27dbb15a8567c6c /server/sonar-web/src/main/js
parentf56a05f14fe4b0685bce7a8750c929641ebf0b78 (diff)
downloadsonarqube-7d034a6d0d9991c251757eb9ab72bd37ac97b6ab.tar.gz
sonarqube-7d034a6d0d9991c251757eb9ab72bd37ac97b6ab.zip
SONAR-9747 Make components and global settings independant from each others in the ui
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/app/components/DefaultHelmetContainer.js4
-rw-r--r--server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js4
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.js6
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/AboutApp.js6
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/App.js19
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/AppContainer.js10
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/Definition.js3
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/actions.js8
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/rootReducer.js17
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/values/actions.js5
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/values/reducer.js35
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingContainer.js4
-rw-r--r--server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js4
-rw-r--r--server/sonar-web/src/main/js/components/ui/Avatar.js6
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.js4
-rw-r--r--server/sonar-web/src/main/js/store/rootReducer.js7
19 files changed, 94 insertions, 62 deletions
diff --git a/server/sonar-web/src/main/js/app/components/DefaultHelmetContainer.js b/server/sonar-web/src/main/js/app/components/DefaultHelmetContainer.js
index 6f339f1fb94..36d16d56568 100644
--- a/server/sonar-web/src/main/js/app/components/DefaultHelmetContainer.js
+++ b/server/sonar-web/src/main/js/app/components/DefaultHelmetContainer.js
@@ -20,7 +20,7 @@
import React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
-import { getSettingValue } from '../../store/rootReducer';
+import { getGlobalSettingValue } from '../../store/rootReducer';
function DefaultHelmetContainer({ children, sonarqubeDotCom }) {
return (
@@ -36,7 +36,7 @@ function DefaultHelmetContainer({ children, sonarqubeDotCom }) {
}
const mapStateToProps = state => ({
- sonarqubeDotCom: getSettingValue(state, 'sonar.lf.sonarqube.com.enabled')
+ sonarqubeDotCom: getGlobalSettingValue(state, 'sonar.lf.sonarqube.com.enabled')
});
export default connect(mapStateToProps)(DefaultHelmetContainer);
diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js
index 46c834a15d0..02d44ad5ba4 100644
--- a/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js
+++ b/server/sonar-web/src/main/js/app/components/GlobalFooterContainer.js
@@ -19,13 +19,13 @@
*/
// @flow
import { connect } from 'react-redux';
-import { getAppState, getSettingValue } from '../../store/rootReducer';
+import { getAppState, getGlobalSettingValue } from '../../store/rootReducer';
import GlobalFooter from './GlobalFooter';
const mapStateToProps = state => ({
sonarqubeVersion: getAppState(state).version,
productionDatabase: getAppState(state).productionDatabase,
- sonarqubeDotCom: getSettingValue(state, 'sonar.lf.sonarqube.com.enabled')
+ sonarqubeDotCom: getGlobalSettingValue(state, 'sonar.lf.sonarqube.com.enabled')
});
export default connect(mapStateToProps)(GlobalFooter);
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js
index 72b1df3f5c6..0650d20d714 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.js
@@ -29,7 +29,7 @@ import NavBar from '../../../../components/nav/NavBar';
import Tooltip from '../../../../components/controls/Tooltip';
import HelpIcon from '../../../../components/icons-components/HelpIcon';
import OnboardingModal from '../../../../apps/tutorials/onboarding/OnboardingModal';
-import { getCurrentUser, getAppState, getSettingValue } from '../../../../store/rootReducer';
+import { getCurrentUser, getAppState, getGlobalSettingValue } from '../../../../store/rootReducer';
import { translate } from '../../../../helpers/l10n';
import './GlobalNav.css';
@@ -140,7 +140,7 @@ class GlobalNav extends React.PureComponent {
}
const mapStateToProps = state => {
- const sonarCloudSetting = getSettingValue(state, 'sonar.lf.sonarqube.com.enabled');
+ const sonarCloudSetting = getGlobalSettingValue(state, 'sonar.lf.sonarqube.com.enabled');
return {
currentUser: getCurrentUser(state),
diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.js
index 55237996772..e3e3fb241d6 100644
--- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.js
+++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavBranding.js
@@ -21,7 +21,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
import { connect } from 'react-redux';
-import { getSettingValue, getCurrentUser } from '../../../../store/rootReducer';
+import { getGlobalSettingValue, getCurrentUser } from '../../../../store/rootReducer';
import { translate } from '../../../../helpers/l10n';
class GlobalNavBranding extends React.PureComponent {
@@ -52,8 +52,8 @@ class GlobalNavBranding extends React.PureComponent {
const mapStateToProps = state => ({
currentUser: getCurrentUser(state),
- customLogoUrl: (getSettingValue(state, 'sonar.lf.logoUrl') || {}).value,
- customLogoWidth: (getSettingValue(state, 'sonar.lf.logoWidthPx') || {}).value
+ customLogoUrl: (getGlobalSettingValue(state, 'sonar.lf.logoUrl') || {}).value,
+ customLogoWidth: (getGlobalSettingValue(state, 'sonar.lf.logoWidthPx') || {}).value
});
export default connect(mapStateToProps)(GlobalNavBranding);
diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js
index 7aec02cb77f..36ced3119e7 100644
--- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js
+++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js
@@ -33,7 +33,7 @@ import AboutStandards from './AboutStandards';
import AboutScanners from './AboutScanners';
import { searchProjects } from '../../../api/components';
import { getFacet } from '../../../api/issues';
-import { getAppState, getCurrentUser, getSettingValue } from '../../../store/rootReducer';
+import { getAppState, getCurrentUser, getGlobalSettingValue } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
import { fetchAboutPageSettings } from '../actions';
import AboutAppForSonarQubeDotComLazyLoader from './AboutAppForSonarQubeDotComLazyLoader';
@@ -202,8 +202,8 @@ class AboutApp extends React.PureComponent {
const mapStateToProps = state => ({
appState: getAppState(state),
currentUser: getCurrentUser(state),
- customText: getSettingValue(state, 'sonar.lf.aboutText'),
- sonarqubeDotCom: getSettingValue(state, 'sonar.lf.sonarqube.com.enabled')
+ customText: getGlobalSettingValue(state, 'sonar.lf.aboutText'),
+ sonarqubeDotCom: getGlobalSettingValue(state, 'sonar.lf.sonarqube.com.enabled')
});
const mapDispatchToProps = { fetchAboutPageSettings };
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js
index a22a14408d7..2f602ad826e 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js
+++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js
@@ -25,7 +25,7 @@ import { Link } from 'react-router';
import OrganizationsList from './OrganizationsList';
import { translate } from '../../../helpers/l10n';
import { fetchIfAnyoneCanCreateOrganizations, fetchMyOrganizations } from './actions';
-import { getAppState, getMyOrganizations, getSettingValue } from '../../../store/rootReducer';
+import { getAppState, getMyOrganizations, getGlobalSettingValue } from '../../../store/rootReducer';
/*:: import type { Organization } from '../../../store/organizations/duck'; */
class UserOrganizations extends React.PureComponent {
@@ -101,7 +101,7 @@ class UserOrganizations extends React.PureComponent {
}
const mapStateToProps = state => ({
- anyoneCanCreate: getSettingValue(state, 'sonar.organizations.anyoneCanCreate'),
+ anyoneCanCreate: getGlobalSettingValue(state, 'sonar.organizations.anyoneCanCreate'),
canAdmin: getAppState(state).canAdmin,
organizations: getMyOrganizations(state)
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/App.js b/server/sonar-web/src/main/js/apps/settings/components/App.js
index ab5cf8414ff..704d742b4a2 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/App.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/App.js
@@ -20,19 +20,16 @@
// @flow
import React from 'react';
import Helmet from 'react-helmet';
-import { connect } from 'react-redux';
import PageHeader from './PageHeader';
import CategoryDefinitionsList from './CategoryDefinitionsList';
import AllCategoriesList from './AllCategoriesList';
import WildcardsHelp from './WildcardsHelp';
-import { fetchSettings } from '../store/actions';
-import { getSettingsAppDefaultCategory } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
import '../styles.css';
/*::
type Props = {
- component: { key: string },
+ component?: { key: string },
defaultCategory: ?string,
fetchSettings(componentKey: ?string): Promise<*>,
location: { query: {} }
@@ -45,7 +42,7 @@ type State = {
};
*/
-class App extends React.PureComponent {
+export default class App extends React.PureComponent {
/*:: props: Props; */
state /*: State */ = { loaded: false };
@@ -55,12 +52,10 @@ class App extends React.PureComponent {
html.classList.add('dashboard-page');
}
const componentKey = this.props.component ? this.props.component.key : null;
- this.props.fetchSettings(componentKey).then(() => {
- this.setState({ loaded: true });
- });
+ this.props.fetchSettings(componentKey).then(() => this.setState({ loaded: true }));
}
- componentDidUpdate(prevProps) {
+ componentDidUpdate(prevProps /*: Props*/) {
if (prevProps.component !== this.props.component) {
const componentKey = this.props.component ? this.props.component.key : null;
this.props.fetchSettings(componentKey);
@@ -105,9 +100,3 @@ class App extends React.PureComponent {
);
}
}
-
-const mapStateToProps = state => ({
- defaultCategory: getSettingsAppDefaultCategory(state)
-});
-
-export default connect(mapStateToProps, { fetchSettings })(App);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js b/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js
index 00a3751b00a..8e80ca6cb6f 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js
@@ -19,12 +19,16 @@
*/
import { connect } from 'react-redux';
import App from './App';
-import { getComponent } from '../../../store/rootReducer';
+import { fetchSettings } from '../store/actions';
+import { getComponent, getSettingsAppDefaultCategory } from '../../../store/rootReducer';
const mapStateToProps = (state, ownProps) => ({
component: ownProps.location.query.id
? getComponent(state, ownProps.location.query.id)
- : undefined
+ : undefined,
+ defaultCategory: getSettingsAppDefaultCategory(state)
});
-export default connect(mapStateToProps)(App);
+const mapdispatchToProps = { fetchSettings };
+
+export default connect(mapStateToProps, mapdispatchToProps)(App);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js
index 81a992dc894..bc5217855fb 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js
@@ -28,7 +28,11 @@ function CategoryDefinitionsList(props) {
}
const mapStateToProps = (state, ownProps) => ({
- settings: getSettingsAppSettingsForCategory(state, ownProps.category)
+ settings: getSettingsAppSettingsForCategory(
+ state,
+ ownProps.category,
+ ownProps.component ? ownProps.component.key : null
+ )
});
export default connect(mapStateToProps)(CategoryDefinitionsList);
diff --git a/server/sonar-web/src/main/js/apps/settings/components/Definition.js b/server/sonar-web/src/main/js/apps/settings/components/Definition.js
index cc30120bb5b..d064997d362 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/Definition.js
+++ b/server/sonar-web/src/main/js/apps/settings/components/Definition.js
@@ -101,7 +101,8 @@ class Definition extends React.PureComponent {
}
handleCancel() {
- this.props.cancelChange(this.props.setting.definition.key);
+ const componentKey = this.props.component ? this.props.component.key : null;
+ this.props.cancelChange(this.props.setting.definition.key, componentKey);
this.props.passValidation(this.props.setting.definition.key);
}
diff --git a/server/sonar-web/src/main/js/apps/settings/store/actions.js b/server/sonar-web/src/main/js/apps/settings/store/actions.js
index fab49983ff7..cbdd7eb63ba 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/actions.js
+++ b/server/sonar-web/src/main/js/apps/settings/store/actions.js
@@ -43,7 +43,7 @@ export const fetchSettings = componentKey => dispatch => {
return getValues(keys, componentKey);
})
.then(settings => {
- dispatch(receiveValues(settings));
+ dispatch(receiveValues(settings, componentKey));
dispatch(closeAllGlobalMessages());
})
.catch(e => parseError(e).then(message => dispatch(addGlobalErrorMessage(message))));
@@ -65,7 +65,7 @@ export const saveValue = (key, componentKey) => (dispatch, getState) => {
return setSettingValue(definition, value, componentKey)
.then(() => getValues(key, componentKey))
.then(values => {
- dispatch(receiveValues(values));
+ dispatch(receiveValues(values, componentKey));
dispatch(cancelChange(key));
dispatch(passValidation(key));
dispatch(stopLoading(key));
@@ -84,9 +84,9 @@ export const resetValue = (key, componentKey) => dispatch => {
.then(() => getValues(key, componentKey))
.then(values => {
if (values.length > 0) {
- dispatch(receiveValues(values));
+ dispatch(receiveValues(values, componentKey));
} else {
- dispatch(receiveValues([{ key }]));
+ dispatch(receiveValues([{ key }], componentKey));
}
dispatch(passValidation(key));
dispatch(stopLoading(key));
diff --git a/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js b/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js
index d483892a9aa..0f22d81cf13 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js
+++ b/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js
@@ -24,8 +24,9 @@ import values, * as fromValues from './values/reducer';
import settingsPage, * as fromSettingsPage from './settingsPage/reducer';
import licenses, * as fromLicenses from './licenses/reducer';
import globalMessages, * as fromGlobalMessages from '../../../store/globalMessages/duck';
-/*:: import type { State as GlobalMessagesState } from '../../../store/globalMessages/duck'; */
import encryptionPage from './encryptionPage/reducer';
+/*:: import type { State as GlobalMessagesState } from '../../../store/globalMessages/duck'; */
+/*:: import type { State as ValuesState } from './values/reducer'; */
/*::
type State = {
@@ -34,7 +35,7 @@ type State = {
globalMessages: GlobalMessagesState,
licenses: {},
settingsPage: {},
- values: {}
+ values: ValuesState
};
*/
@@ -58,12 +59,16 @@ export const getAllCategories = (state /*: State */) =>
export const getDefaultCategory = (state /*: State */) =>
fromDefinitions.getDefaultCategory(state.definitions);
-export const getValue = (state /*: State */, key /*: string */) =>
- fromValues.getValue(state.values, key);
+export const getValue = (state /*: State */, key /*: string */, componentKey /*: ?string */) =>
+ fromValues.getValue(state.values, key, componentKey);
-export const getSettingsForCategory = (state /*: State */, category /*: string */) =>
+export const getSettingsForCategory = (
+ state /*: State */,
+ category /*: string */,
+ componentKey /*: ?string */
+) =>
fromDefinitions.getDefinitionsForCategory(state.definitions, category).map(definition => ({
- ...getValue(state, definition.key),
+ ...getValue(state, definition.key, componentKey),
definition
}));
diff --git a/server/sonar-web/src/main/js/apps/settings/store/values/actions.js b/server/sonar-web/src/main/js/apps/settings/store/values/actions.js
index e9087a0b6d5..8ccc1d5ec1e 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/values/actions.js
+++ b/server/sonar-web/src/main/js/apps/settings/store/values/actions.js
@@ -27,7 +27,8 @@ export const RECEIVE_VALUES /*: string */ = 'RECEIVE_VALUES';
* @param {Array} settings
* @returns {Object}
*/
-export const receiveValues = (settings /*: SettingValue[] */) => ({
+export const receiveValues = (settings /*: SettingValue[] */, componentKey /*: ?string */) => ({
type: RECEIVE_VALUES,
- settings
+ settings,
+ componentKey
});
diff --git a/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js b/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js
index d8e42984fd7..e08ace6f2bb 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js
+++ b/server/sonar-web/src/main/js/apps/settings/store/values/reducer.js
@@ -18,14 +18,35 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// @flow
+import { combineReducers } from 'redux';
import { keyBy } from 'lodash';
import { RECEIVE_VALUES } from './actions';
/*::
-type State = { [key: string]: {} };
+type SettingsState = { [key: string]: {} };
+type ComponentsState = { [key: string]: SettingsState };
+export type State = { components: ComponentsState, global: SettingsState };
*/
-const reducer = (state /*: State */ = {}, action /*: Object */) => {
+const componentsSettings = (state /*: ComponentsState */ = {}, action /*: Object */) => {
+ if (!action.componentKey) {
+ return state;
+ }
+
+ const key = action.componentKey;
+ if (action.type === RECEIVE_VALUES) {
+ const settingsByKey = keyBy(action.settings, 'key');
+ return { ...state, [key]: { ...(state[key] || {}), ...settingsByKey } };
+ }
+
+ return state;
+};
+
+const globalSettings = (state /*: SettingsState */ = {}, action /*: Object */) => {
+ if (action.componentKey) {
+ return state;
+ }
+
if (action.type === RECEIVE_VALUES) {
const settingsByKey = keyBy(action.settings, 'key');
return { ...state, ...settingsByKey };
@@ -42,6 +63,12 @@ const reducer = (state /*: State */ = {}, action /*: Object */) => {
return state;
};
-export default reducer;
+export default combineReducers({ components: componentsSettings, global: globalSettings });
-export const getValue = (state /*: State */, key /*: string */) => state[key];
+export const getValue = (state /*: State */, key /*: string */, componentKey /*: ?string */) => {
+ let settings = state.global;
+ if (componentKey) {
+ settings = state.components[componentKey];
+ }
+ return settings && settings[key];
+};
diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingContainer.js b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingContainer.js
index a7eecc2e9e4..246062de818 100644
--- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingContainer.js
+++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingContainer.js
@@ -23,11 +23,11 @@ import Onboarding from './Onboarding';
import {
getCurrentUser,
areThereCustomOrganizations,
- getSettingValue
+ getGlobalSettingValue
} from '../../../store/rootReducer';
const mapStateToProps = state => {
- const sonarCloudSetting = getSettingValue(state, 'sonar.lf.sonarqube.com.enabled');
+ const sonarCloudSetting = getGlobalSettingValue(state, 'sonar.lf.sonarqube.com.enabled');
return {
currentUser: getCurrentUser(state),
diff --git a/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js b/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js
index cd5a9f8f105..454396e0a87 100644
--- a/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js
+++ b/server/sonar-web/src/main/js/apps/update-center/components/UpdateCenterAppContainer.js
@@ -21,7 +21,7 @@ import React from 'react';
import Helmet from 'react-helmet';
import { connect } from 'react-redux';
import init from '../init';
-import { getSettingValue } from '../../../store/rootReducer';
+import { getGlobalSettingValue } from '../../../store/rootReducer';
import { translate } from '../../../helpers/l10n';
class UpdateCenterAppContainer extends React.PureComponent {
@@ -48,7 +48,7 @@ class UpdateCenterAppContainer extends React.PureComponent {
}
const mapStateToProps = state => ({
- updateCenterActive: (getSettingValue(state, 'sonar.updatecenter.activate') || {}).value
+ updateCenterActive: (getGlobalSettingValue(state, 'sonar.updatecenter.activate') || {}).value
});
export default connect(mapStateToProps)(UpdateCenterAppContainer);
diff --git a/server/sonar-web/src/main/js/components/ui/Avatar.js b/server/sonar-web/src/main/js/components/ui/Avatar.js
index a2a53f474aa..448fb782f4b 100644
--- a/server/sonar-web/src/main/js/components/ui/Avatar.js
+++ b/server/sonar-web/src/main/js/components/ui/Avatar.js
@@ -22,7 +22,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import md5 from 'blueimp-md5';
import classNames from 'classnames';
-import { getSettingValue } from '../../store/rootReducer';
+import { getGlobalSettingValue } from '../../store/rootReducer';
function stringToColor(str) {
let hash = 0;
@@ -114,8 +114,8 @@ class Avatar extends React.PureComponent {
}
const mapStateToProps = state => ({
- enableGravatar: (getSettingValue(state, 'sonar.lf.enableGravatar') || {}).value === 'true',
- gravatarServerUrl: (getSettingValue(state, 'sonar.lf.gravatarServerUrl') || {}).value
+ enableGravatar: (getGlobalSettingValue(state, 'sonar.lf.enableGravatar') || {}).value === 'true',
+ gravatarServerUrl: (getGlobalSettingValue(state, 'sonar.lf.gravatarServerUrl') || {}).value
});
export default connect(mapStateToProps)(Avatar);
diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js
index b61bdd143e6..1dcccdb9529 100644
--- a/server/sonar-web/src/main/js/helpers/measures.js
+++ b/server/sonar-web/src/main/js/helpers/measures.js
@@ -351,10 +351,10 @@ function shortDurationVariationFormatter(value) {
function getRatingGrid() {
// workaround cyclic dependencies
const getStore = require('../app/utils/getStore').default;
- const { getSettingValue } = require('../store/rootReducer');
+ const { getGlobalSettingValue } = require('../store/rootReducer');
const store = getStore();
- const settingValue = getSettingValue(store.getState(), 'sonar.technicalDebt.ratingGrid');
+ const settingValue = getGlobalSettingValue(store.getState(), 'sonar.technicalDebt.ratingGrid');
return settingValue ? settingValue.value : '';
}
diff --git a/server/sonar-web/src/main/js/store/rootReducer.js b/server/sonar-web/src/main/js/store/rootReducer.js
index f4d32f82868..9cdd198e860 100644
--- a/server/sonar-web/src/main/js/store/rootReducer.js
+++ b/server/sonar-web/src/main/js/store/rootReducer.js
@@ -153,7 +153,8 @@ export const getPermissionsAppSelectedPermission = state =>
export const getPermissionsAppError = state => fromPermissionsApp.getError(state.permissionsApp);
-export const getSettingValue = (state, key) => fromSettingsApp.getValue(state.settingsApp, key);
+export const getGlobalSettingValue = (state, key) =>
+ fromSettingsApp.getValue(state.settingsApp, key);
export const getSettingsAppDefinition = (state, key) =>
fromSettingsApp.getDefinition(state.settingsApp, key);
@@ -164,8 +165,8 @@ export const getSettingsAppAllCategories = state =>
export const getSettingsAppDefaultCategory = state =>
fromSettingsApp.getDefaultCategory(state.settingsApp);
-export const getSettingsAppSettingsForCategory = (state, category) =>
- fromSettingsApp.getSettingsForCategory(state.settingsApp, category);
+export const getSettingsAppSettingsForCategory = (state, category, componentKey) =>
+ fromSettingsApp.getSettingsForCategory(state.settingsApp, category, componentKey);
export const getSettingsAppChangedValue = (state, key) =>
fromSettingsApp.getChangedValue(state.settingsApp, key);