aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/store/appState
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-08-28 11:41:51 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 11:34:54 +0200
commit030370cf6255d1185ecb3deeaab7de1fe76e058b (patch)
treeba159de014202d25c86e58e7f656919fcfddcbe9 /server/sonar-web/src/main/js/store/appState
parent98d1c53522f3f69e16dfb9bbdb63e0174402ec57 (diff)
downloadsonarqube-030370cf6255d1185ecb3deeaab7de1fe76e058b.tar.gz
sonarqube-030370cf6255d1185ecb3deeaab7de1fe76e058b.zip
add branches help popups (#2420)
Diffstat (limited to 'server/sonar-web/src/main/js/store/appState')
-rw-r--r--server/sonar-web/src/main/js/store/appState/duck.ts (renamed from server/sonar-web/src/main/js/store/appState/duck.js)68
1 files changed, 29 insertions, 39 deletions
diff --git a/server/sonar-web/src/main/js/store/appState/duck.js b/server/sonar-web/src/main/js/store/appState/duck.ts
index 2358bb011fc..ed005f2888f 100644
--- a/server/sonar-web/src/main/js/store/appState/duck.js
+++ b/server/sonar-web/src/main/js/store/appState/duck.ts
@@ -17,62 +17,52 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-// @flow
-/*::
-type AppState = {
- adminPages?: Array<*>,
- authenticationError: boolean,
- authorizationError: boolean,
- organizationsEnabled: boolean,
- qualifiers: ?Array<string>
-};
-*/
+interface AppState {
+ adminPages?: any[];
+ authenticationError: boolean;
+ authorizationError: boolean;
+ organizationsEnabled: boolean;
+ qualifiers?: string[];
+}
-/*::
-type SetAppStateAction = {
- type: 'SET_APP_STATE',
- appState: AppState
-};
-*/
+interface SetAppStateAction {
+ type: 'SET_APP_STATE';
+ appState: AppState;
+}
-/*::
-type SetAdminPagesAction = {
- type: 'SET_ADMIN_PAGES',
- adminPages: Array<*>
-};
-*/
+interface SetAdminPagesAction {
+ type: 'SET_ADMIN_PAGES';
+ adminPages: any[];
+}
-/*::
-export type Action = SetAppStateAction | SetAdminPagesAction; */
+interface RequireAuthorizationAction {
+ type: 'REQUIRE_AUTHORIZATION';
+}
+
+export type Action = SetAppStateAction | SetAdminPagesAction | RequireAuthorizationAction;
-export function setAppState(appState /*: AppState */) /*: SetAppStateAction */ {
+export function setAppState(appState: AppState): SetAppStateAction {
return {
type: 'SET_APP_STATE',
appState
};
}
-export function setAdminPages(adminPages /*: Array<*> */) /*: SetAdminPagesAction */ {
- return {
- type: 'SET_ADMIN_PAGES',
- adminPages
- };
+export function setAdminPages(adminPages: any[]): SetAdminPagesAction {
+ return { type: 'SET_ADMIN_PAGES', adminPages };
}
-export function requireAuthorization() {
- return {
- type: 'REQUIRE_AUTHORIZATION'
- };
+export function requireAuthorization(): RequireAuthorizationAction {
+ return { type: 'REQUIRE_AUTHORIZATION' };
}
-const defaultValue = {
+const defaultValue: AppState = {
authenticationError: false,
authorizationError: false,
- organizationsEnabled: false,
- qualifiers: null
+ organizationsEnabled: false
};
-export default function(state /*: AppState */ = defaultValue, action /*: Action */) {
+export default function(state: AppState = defaultValue, action: Action): AppState {
if (action.type === 'SET_APP_STATE') {
return { ...state, ...action.appState };
}
@@ -88,6 +78,6 @@ export default function(state /*: AppState */ = defaultValue, action /*: Action
return state;
}
-export function getRootQualifiers(state /*: AppState */) {
+export function getRootQualifiers(state: AppState): string[] | undefined {
return state.qualifiers;
}