/* * SonarQube * Copyright (C) 2009-2016 SonarSource SA * mailto:contact AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; import { render } from 'react-dom'; import { Router, Route, useRouterHistory } from 'react-router'; import { createHistory } from 'history'; import { Provider } from 'react-redux'; import App from '../components/App'; import ComponentContainer from '../components/ComponentContainer'; import NullComponent from '../components/NullComponent'; import aboutRoutes from '../../apps/about/routes'; import accountRoutes from '../../apps/account/routes'; import backgroundTasksRoutes from '../../apps/background-tasks/routes'; import codeRoutes from '../../apps/code/routes'; import codingRulesRoutes from '../../apps/coding-rules/routes'; import componentIssuesRoutes from '../../apps/component-issues/routes'; import componentMeasuresRoutes from '../../apps/component-measures/routes'; import customMeasuresRoutes from '../../apps/custom-measures/routes'; import groupsRoutes from '../../apps/groups/routes'; import issuesRoutes from '../../apps/issues/routes'; import metricsRoutes from '../../apps/metrics/routes'; import overviewRoutes from '../../apps/overview/routes'; import permissionTemplatesRoutes from '../../apps/permission-templates/routes'; import projectAdminRoutes from '../../apps/project-admin/routes'; import projectsRoutes from '../../apps/projects/routes'; import projectsAdminRoutes from '../../apps/projects-admin/routes'; import qualityGatesRoutes from '../../apps/quality-gates/routes'; import qualityProfilesRoutes from '../../apps/quality-profiles/routes'; import settingsRoutes from '../../apps/settings/routes'; import systemRoutes from '../../apps/system/routes'; import updateCenterRoutes from '../../apps/update-center/routes'; import usersRoutes from '../../apps/users/routes'; import webAPIRoutes from '../../apps/web-api/routes'; import { maintenanceRoutes, setupRoutes } from '../../apps/maintenance/routes'; import { globalPermissionsRoutes, projectPermissionsRoutes } from '../../apps/permissions/routes'; import configureStore from '../../components/store/configureStore'; import rootReducer from '../store/rootReducer'; import isCurrentPathKnown from './isCurrentPathKnown'; const startReactApp = () => { if (isCurrentPathKnown()) { window.sonarqube.appStarted.then(options => { const el = document.querySelector(options.el); const history = useRouterHistory(createHistory)({ basename: window.baseUrl + '/' }); const store = configureStore(rootReducer); render(( {aboutRoutes} {accountRoutes} {backgroundTasksRoutes} {codingRulesRoutes} {overviewRoutes} {groupsRoutes} {issuesRoutes} {maintenanceRoutes} {metricsRoutes} {permissionTemplatesRoutes} {projectsRoutes} {projectsAdminRoutes} {globalPermissionsRoutes} {settingsRoutes} {setupRoutes} {systemRoutes} {qualityGatesRoutes} {qualityProfilesRoutes} {updateCenterRoutes} {usersRoutes} {webAPIRoutes} {codeRoutes} {componentIssuesRoutes} {componentMeasuresRoutes} {customMeasuresRoutes} {backgroundTasksRoutes} {settingsRoutes} {projectAdminRoutes} {projectPermissionsRoutes} ), el); }); } }; export default startReactApp;