diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/settings/store/rootReducer.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/settings/store/rootReducer.js | 45 |
1 files changed, 33 insertions, 12 deletions
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 0c3b7dfe214..90658fcb3db 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 @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// @flow import { combineReducers } from 'redux'; import definitions, * as fromDefinitions from './definitions/reducer'; import values, * as fromValues from './values/reducer'; @@ -25,6 +26,15 @@ import licenses, * as fromLicenses from './licenses/reducer'; import globalMessages, * as fromGlobalMessages from '../../../components/store/globalMessages'; import encryptionPage from './encryptionPage/reducer'; +type State = { + definitions: {}, + encryptionPage: {}, + globalMessages: {}, + licenses: {}, + settingsPage: {}, + values: {} +}; + const rootReducer = combineReducers({ definitions, values, @@ -36,30 +46,41 @@ const rootReducer = combineReducers({ export default rootReducer; -export const getDefinition = (state, key) => fromDefinitions.getDefinition(state.definitions, key); +export const getDefinition = (state: State, key: string) => + fromDefinitions.getDefinition(state.definitions, key); -export const getAllCategories = state => fromDefinitions.getAllCategories(state.definitions); +export const getAllCategories = (state: State) => + fromDefinitions.getAllCategories(state.definitions); -export const getDefaultCategory = state => fromDefinitions.getDefaultCategory(state.definitions); +export const getDefaultCategory = (state: State) => + fromDefinitions.getDefaultCategory(state.definitions); -export const getValue = (state, key) => fromValues.getValue(state.values, key); +export const getValue = (state: State, key: string) => + fromValues.getValue(state.values, key); -export const getSettingsForCategory = (state, category) => +export const getSettingsForCategory = (state: State, category: string) => fromDefinitions.getDefinitionsForCategory(state.definitions, category).map(definition => ({ ...getValue(state, definition.key), definition })); -export const getChangedValue = (state, key) => fromSettingsPage.getChangedValue(state.settingsPage, key); +export const getChangedValue = (state: State, key: string) => + fromSettingsPage.getChangedValue(state.settingsPage, key); -export const isLoading = (state, key) => fromSettingsPage.isLoading(state.settingsPage, key); +export const isLoading = (state: State, key: string) => + fromSettingsPage.isLoading(state.settingsPage, key); -export const getLicenseByKey = (state, key) => fromLicenses.getLicenseByKey(state.licenses, key); +export const getLicenseByKey = (state: State, key: string) => + fromLicenses.getLicenseByKey(state.licenses, key); -export const getAllLicenseKeys = state => fromLicenses.getAllLicenseKeys(state.licenses); +export const getAllLicenseKeys = (state: State) => + fromLicenses.getAllLicenseKeys(state.licenses); -export const getValidationMessage = (state, key) => fromSettingsPage.getValidationMessage(state.settingsPage, key); +export const getValidationMessage = (state: State, key: string) => + fromSettingsPage.getValidationMessage(state.settingsPage, key); -export const getEncryptionState = state => state.encryptionPage; +export const getEncryptionState = (state: State) => + state.encryptionPage; -export const getGlobalMessages = state => fromGlobalMessages.getGlobalMessages(state.globalMessages); +export const getGlobalMessages = (state: State) => + fromGlobalMessages.getGlobalMessages(state.globalMessages); |