diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-10-16 10:01:37 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-10-23 08:01:13 -0700 |
commit | 48fbc92a514fe94ad1ac435ddc033bd2379a5a69 (patch) | |
tree | f29a16c36a30a737282b7fa2ded566940cb0fb1f /server/sonar-web/src/main/js/store | |
parent | cc7c40ced053d5ba7bcc453b28f9cfcdf022a180 (diff) | |
download | sonarqube-48fbc92a514fe94ad1ac435ddc033bd2379a5a69.tar.gz sonarqube-48fbc92a514fe94ad1ac435ddc033bd2379a5a69.zip |
SONAR-9936 Add Editions pack in the marketplace
Diffstat (limited to 'server/sonar-web/src/main/js/store')
-rw-r--r-- | server/sonar-web/src/main/js/store/appState/duck.ts | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/store/appState/duck.ts b/server/sonar-web/src/main/js/store/appState/duck.ts index ed005f2888f..d783242272f 100644 --- a/server/sonar-web/src/main/js/store/appState/duck.ts +++ b/server/sonar-web/src/main/js/store/appState/duck.ts @@ -17,10 +17,15 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +import { Extension } from '../../app/types'; +import { EditionStatus } from '../../api/marketplace'; + interface AppState { - adminPages?: any[]; + adminPages?: Extension[]; authenticationError: boolean; authorizationError: boolean; + editionStatus?: EditionStatus; organizationsEnabled: boolean; qualifiers?: string[]; } @@ -32,14 +37,23 @@ interface SetAppStateAction { interface SetAdminPagesAction { type: 'SET_ADMIN_PAGES'; - adminPages: any[]; + adminPages: Extension[]; +} + +interface SetEditionStatusAction { + type: 'SET_EDITION_STATUS'; + editionStatus: EditionStatus; } interface RequireAuthorizationAction { type: 'REQUIRE_AUTHORIZATION'; } -export type Action = SetAppStateAction | SetAdminPagesAction | RequireAuthorizationAction; +export type Action = + | SetAppStateAction + | SetAdminPagesAction + | SetEditionStatusAction + | RequireAuthorizationAction; export function setAppState(appState: AppState): SetAppStateAction { return { @@ -48,7 +62,7 @@ export function setAppState(appState: AppState): SetAppStateAction { }; } -export function setAdminPages(adminPages: any[]): SetAdminPagesAction { +export function setAdminPages(adminPages: Extension[]): SetAdminPagesAction { return { type: 'SET_ADMIN_PAGES', adminPages }; } @@ -56,6 +70,10 @@ export function requireAuthorization(): RequireAuthorizationAction { return { type: 'REQUIRE_AUTHORIZATION' }; } +export function setEditionStatus(editionStatus: EditionStatus): SetEditionStatusAction { + return { type: 'SET_EDITION_STATUS', editionStatus }; +} + const defaultValue: AppState = { authenticationError: false, authorizationError: false, @@ -71,6 +89,10 @@ export default function(state: AppState = defaultValue, action: Action): AppStat return { ...state, adminPages: action.adminPages }; } + if (action.type === 'SET_EDITION_STATUS') { + return { ...state, editionStatus: action.editionStatus }; + } + if (action.type === 'REQUIRE_AUTHORIZATION') { return { ...state, authorizationError: true }; } |