Browse Source

extend the main js app (#1345)

tags/6.2-RC1
Stas Vilchik 7 years ago
parent
commit
33be8c3500
26 changed files with 162 additions and 185 deletions
  1. 0
    2
      server/sonar-web/config/webpack/webpack.config.base.js
  2. 6
    2
      server/sonar-web/src/main/js/app/index.js
  3. 7
    1
      server/sonar-web/src/main/js/app/store/rootReducer.js
  4. 0
    61
      server/sonar-web/src/main/js/apps/quality-gates/app.js
  5. 2
    2
      server/sonar-web/src/main/js/apps/quality-gates/components/Details.js
  6. 1
    1
      server/sonar-web/src/main/js/apps/quality-gates/components/List.js
  7. 1
    1
      server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js
  8. 24
    26
      server/sonar-web/src/main/js/apps/quality-gates/containers/DetailsContainer.js
  9. 9
    10
      server/sonar-web/src/main/js/apps/quality-gates/containers/QualityGatesAppContainer.js
  10. 33
    0
      server/sonar-web/src/main/js/apps/quality-gates/routes.js
  11. 14
    14
      server/sonar-web/src/main/js/apps/quality-gates/store/actions.js
  12. 0
    0
      server/sonar-web/src/main/js/apps/quality-gates/store/rootReducer.js
  13. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.js
  14. 1
    1
      server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.js
  15. 7
    10
      server/sonar-web/src/main/js/apps/quality-profiles/components/App.js
  16. 28
    0
      server/sonar-web/src/main/js/apps/quality-profiles/components/AppContainer.js
  17. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.js
  18. 1
    1
      server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.js
  19. 1
    1
      server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.js
  20. 3
    3
      server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js
  21. 1
    1
      server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js
  22. 1
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js
  23. 2
    2
      server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.js
  24. 13
    31
      server/sonar-web/src/main/js/apps/quality-profiles/routes.js
  25. 1
    4
      server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
  26. 1
    4
      server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb

+ 0
- 2
server/sonar-web/config/webpack/webpack.config.base.js View File

@@ -46,8 +46,6 @@ module.exports = {
'project-admin': './src/main/js/apps/project-admin/app.js',
'project-permissions': './src/main/js/apps/permissions/project/app.js',
'projects-admin': './src/main/js/apps/projects-admin/app.js',
'quality-gates': './src/main/js/apps/quality-gates/app.js',
'quality-profiles': './src/main/js/apps/quality-profiles/app.js',
'settings': './src/main/js/apps/settings/app.js',
'source-viewer': './src/main/js/apps/source-viewer/app.js',
'system': './src/main/js/apps/system/app.js',

+ 6
- 2
server/sonar-web/src/main/js/app/index.js View File

@@ -24,7 +24,9 @@ import { createHistory } from 'history';
import { Provider } from 'react-redux';
import App from './components/App';
import accountRoutes from '../apps/account/routes';
import projectsRouters from '../apps/projects/routes';
import projectsRoutes from '../apps/projects/routes';
import qualityGatesRoutes from '../apps/quality-gates/routes';
import qualityProfilesRoutes from '../apps/quality-profiles/routes';
import configureStore from '../components/store/configureStore';
import rootReducer from './store/rootReducer';
import './styles/index';
@@ -43,7 +45,9 @@ window.sonarqube.appStarted.then(options => {
<Router history={history}>
<Route path="/" component={App}>
{accountRoutes}
{projectsRouters}
{projectsRoutes}
{qualityGatesRoutes}
{qualityProfilesRoutes}
</Route>
</Router>
</Provider>

+ 7
- 1
server/sonar-web/src/main/js/app/store/rootReducer.js View File

@@ -27,6 +27,7 @@ import globalMessages, * as fromGlobalMessages from '../../components/store/glob

import issuesActivity, * as fromIssuesActivity from '../../apps/account/home/store/reducer';
import projectsApp, * as fromProjectsApp from '../../apps/projects/store/reducer';
import qualityGatesApp from '../../apps/quality-gates/store/rootReducer';

export default combineReducers({
components,
@@ -38,7 +39,8 @@ export default combineReducers({

// apps
issuesActivity,
projectsApp
projectsApp,
qualityGatesApp
});

export const getComponent = (state, key) => (
@@ -88,3 +90,7 @@ export const getProjectsAppFacetByProperty = (state, property) => (
export const getProjectsAppMaxFacetValue = state => (
fromProjectsApp.getMaxFacetValue(state.projectsApp)
);

export const getQualityGatesAppState = state => (
state.qualityGatesApp
);

+ 0
- 61
server/sonar-web/src/main/js/apps/quality-gates/app.js View File

@@ -1,61 +0,0 @@
/*
* 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, IndexRoute, Redirect, useRouterHistory } from 'react-router';
import { createHistory } from 'history';
import { combineReducers } from 'redux';
import { Provider } from 'react-redux';
import { syncHistoryWithStore, routerReducer } from 'react-router-redux';

import QualityGatesAppContainer from './containers/QualityGatesAppContainer';
import Intro from './components/Intro';
import DetailsContainer from './containers/DetailsContainer';
import rootReducer from './store/reducers';
import configureStore from '../../components/store/configureStore';

window.sonarqube.appStarted.then(options => {
const el = document.querySelector(options.el);

const history = useRouterHistory(createHistory)({
basename: window.baseUrl + '/quality_gates'
});

const finalReducer = combineReducers({
rootReducer,
routing: routerReducer
});

const store = configureStore(finalReducer);

const finalHistory = syncHistoryWithStore(history, store);

render((
<Provider store={store}>
<Router history={finalHistory}>
<Route path="/" component={QualityGatesAppContainer}>
<IndexRoute component={Intro}/>
<Route path="show/:id" component={DetailsContainer}/>
<Redirect from="/index" to="/"/>
</Route>
</Router>
</Provider>
), el);
});

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-gates/components/Details.js View File

@@ -65,7 +65,7 @@ export default class Details extends Component {
qualityGate,
onCopy: (newQualityGate) => {
onCopy(newQualityGate);
router.push(`/show/${newQualityGate.id}`);
router.push(`/quality_gates/show/${newQualityGate.id}`);
}
}).render();
}
@@ -90,7 +90,7 @@ export default class Details extends Component {
qualityGate,
onDelete: (qualityGate) => {
onDelete(qualityGate);
router.replace('/');
router.replace('/quality_gates');
}
}).render();
}

+ 1
- 1
server/sonar-web/src/main/js/apps/quality-gates/components/List.js View File

@@ -28,7 +28,7 @@ export default function List ({ qualityGates }) {
{qualityGates.map(qualityGate => (
<Link
key={qualityGate.id}
to={`/show/${qualityGate.id}`}
to={`/quality_gates/show/${qualityGate.id}`}
activeClassName="active"
className="list-group-item"
data-id={qualityGate.id}>

+ 1
- 1
server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js View File

@@ -51,7 +51,7 @@ export default class QualityGatesApp extends Component {
const { router } = this.context;

addQualityGate(qualityGate);
router.push(`/show/${qualityGate.id}`);
router.push(`/quality_gates/show/${qualityGate.id}`);
}

render () {

+ 24
- 26
server/sonar-web/src/main/js/apps/quality-gates/containers/DetailsContainer.js View File

@@ -18,37 +18,35 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { connect } from 'react-redux';

import {
deleteQualityGate,
showQualityGate,
renameQualityGate,
copyQualityGate,
setQualityGateAsDefault,
unsetQualityGateAsDefault,
addCondition,
deleteCondition,
saveCondition
deleteQualityGate,
showQualityGate,
renameQualityGate,
copyQualityGate,
setQualityGateAsDefault,
unsetQualityGateAsDefault,
addCondition,
deleteCondition,
saveCondition
} from '../store/actions';
import Details from '../components/Details';
import { getQualityGatesAppState } from '../../../app/store/rootReducer';

function mapStateToProps (state) {
return state.rootReducer;
}
const mapStateToProps = state => (
getQualityGatesAppState(state)
);

function mapDispatchToProps (dispatch) {
return {
onShow: qualityGate => dispatch(showQualityGate(qualityGate)),
onDelete: qualityGate => dispatch(deleteQualityGate(qualityGate)),
onRename: (qualityGate, newName) => dispatch(renameQualityGate(qualityGate, newName)),
onCopy: qualityGate => dispatch(copyQualityGate(qualityGate)),
onSetAsDefault: qualityGate => dispatch(setQualityGateAsDefault(qualityGate)),
onUnsetAsDefault: qualityGate => dispatch(unsetQualityGateAsDefault(qualityGate)),
onAddCondition: metric => dispatch(addCondition(metric)),
onSaveCondition: (oldCondition, newCondition) => dispatch(saveCondition(oldCondition, newCondition)),
onDeleteCondition: condition => dispatch(deleteCondition(condition))
};
}
const mapDispatchToProps = dispatch => ({
onShow: qualityGate => dispatch(showQualityGate(qualityGate)),
onDelete: qualityGate => dispatch(deleteQualityGate(qualityGate)),
onRename: (qualityGate, newName) => dispatch(renameQualityGate(qualityGate, newName)),
onCopy: qualityGate => dispatch(copyQualityGate(qualityGate)),
onSetAsDefault: qualityGate => dispatch(setQualityGateAsDefault(qualityGate)),
onUnsetAsDefault: qualityGate => dispatch(unsetQualityGateAsDefault(qualityGate)),
onAddCondition: metric => dispatch(addCondition(metric)),
onSaveCondition: (oldCondition, newCondition) => dispatch(saveCondition(oldCondition, newCondition)),
onDeleteCondition: condition => dispatch(deleteCondition(condition))
});

export default connect(
mapStateToProps,

+ 9
- 10
server/sonar-web/src/main/js/apps/quality-gates/containers/QualityGatesAppContainer.js View File

@@ -21,18 +21,17 @@ import { connect } from 'react-redux';

import { setState, addQualityGate, deleteQualityGate } from '../store/actions';
import QualityGateApp from '../components/QualityGatesApp';
import { getQualityGatesAppState } from '../../../app/store/rootReducer';

function mapStateToProps (state) {
return state.rootReducer;
}
const mapStateToProps = state => (
getQualityGatesAppState(state)
);

function mapDispatchToProps (dispatch) {
return {
updateStore: nextState => dispatch(setState(nextState)),
addQualityGate: qualityGate => dispatch(addQualityGate(qualityGate)),
deleteQualityGate: qualityGate => dispatch(deleteQualityGate(qualityGate))
};
}
const mapDispatchToProps = dispatch => ({
updateStore: nextState => dispatch(setState(nextState)),
addQualityGate: qualityGate => dispatch(addQualityGate(qualityGate)),
deleteQualityGate: qualityGate => dispatch(deleteQualityGate(qualityGate))
});

export default connect(
mapStateToProps,

+ 33
- 0
server/sonar-web/src/main/js/apps/quality-gates/routes.js View File

@@ -0,0 +1,33 @@
/*
* 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 { Route, IndexRoute, Redirect } from 'react-router';
import QualityGatesAppContainer from './containers/QualityGatesAppContainer';
import Intro from './components/Intro';
import DetailsContainer from './containers/DetailsContainer';

export default (
<Route path="quality_gates" component={QualityGatesAppContainer}>
<Redirect from="/quality_gates/index" to="/quality_gates/"/>

<IndexRoute component={Intro}/>
<Route path="show/:id" component={DetailsContainer}/>
</Route>
);

+ 14
- 14
server/sonar-web/src/main/js/apps/quality-gates/store/actions.js View File

@@ -17,7 +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.
*/
export const SET_STATE = 'SET_STATE';
export const SET_STATE = 'qualityGates/SET_STATE';
export function setState (nextState) {
return {
type: SET_STATE,
@@ -25,40 +25,40 @@ export function setState (nextState) {
};
}

export const ADD = 'ADD';
export const ADD = 'qualityGates/ADD';
export function addQualityGate (qualityGate) {
return {
type: 'ADD',
type: ADD,
qualityGate
};
}

export const DELETE = 'DELETE';
export const DELETE = 'qualityGates/DELETE';
export function deleteQualityGate (qualityGate) {
return {
type: 'DELETE',
type: DELETE,
qualityGate
};
}

export const SHOW = 'SHOW';
export const SHOW = 'qualityGates/SHOW';
export function showQualityGate (qualityGate) {
return {
type: 'SHOW',
type: SHOW,
qualityGate
};
}

export const RENAME = 'RENAME';
export const RENAME = 'qualityGates/RENAME';
export function renameQualityGate (qualityGate, newName) {
return {
type: 'RENAME',
type: RENAME,
qualityGate,
newName
};
}

export const COPY = 'COPY';
export const COPY = 'qualityGates/COPY';
export function copyQualityGate (qualityGate) {
return {
type: COPY,
@@ -74,7 +74,7 @@ export function setQualityGateAsDefault (qualityGate) {
};
}

export const UNSET_AS_DEFAULT = 'UNSET_AS_DEFAULT';
export const UNSET_AS_DEFAULT = 'qualityGates/UNSET_AS_DEFAULT';
export function unsetQualityGateAsDefault (qualityGate) {
return {
type: UNSET_AS_DEFAULT,
@@ -82,7 +82,7 @@ export function unsetQualityGateAsDefault (qualityGate) {
};
}

export const ADD_CONDITION = 'ADD_CONDITION';
export const ADD_CONDITION = 'qualityGates/ADD_CONDITION';
export function addCondition (metric) {
return {
type: ADD_CONDITION,
@@ -90,7 +90,7 @@ export function addCondition (metric) {
};
}

export const SAVE_CONDITION = 'SAVE_CONDITION';
export const SAVE_CONDITION = 'qualityGates/SAVE_CONDITION';
export function saveCondition (oldCondition, newCondition) {
return {
type: SAVE_CONDITION,
@@ -99,7 +99,7 @@ export function saveCondition (oldCondition, newCondition) {
};
}

export const DELETE_CONDITION = 'DELETE_CONDITION';
export const DELETE_CONDITION = 'qualityGates/DELETE_CONDITION';
export function deleteCondition (condition) {
return {
type: DELETE_CONDITION,

server/sonar-web/src/main/js/apps/quality-gates/store/reducers.js → server/sonar-web/src/main/js/apps/quality-gates/store/rootReducer.js View File


+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/changelog/ChangelogContainer.js View File

@@ -114,17 +114,17 @@ export default class ChangelogContainer extends React.Component {

handleFromDateChange (fromDate) {
const query = { ...this.props.location.query, since: fromDate };
this.context.router.push({ pathname: '/changelog', query });
this.context.router.push({ pathname: '/profiles/changelog', query });
}

handleToDateChange (toDate) {
const query = { ...this.props.location.query, to: toDate };
this.context.router.push({ pathname: '/changelog', query });
this.context.router.push({ pathname: '/profiles/changelog', query });
}

handleReset () {
const query = { key: this.props.profile.key };
this.context.router.push({ pathname: '/changelog', query });
this.context.router.push({ pathname: '/profiles/changelog', query });
}

render () {

+ 1
- 1
server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.js View File

@@ -81,7 +81,7 @@ export default class ComparisonContainer extends React.Component {

handleCompare (withKey) {
this.context.router.push({
pathname: '/compare',
pathname: '/profiles/compare',
query: {
key: this.props.profile.key,
withKey

+ 7
- 10
server/sonar-web/src/main/js/apps/quality-profiles/components/App.js View File

@@ -18,11 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
import { getLanguages } from '../../../api/languages';
import {
getQualityProfiles,
getExporters
} from '../../../api/quality-profiles';
import { getQualityProfiles, getExporters } from '../../../api/quality-profiles';
import { getCurrentUser } from '../../../api/users';
import '../styles.css';
import { sortProfiles } from '../utils';
@@ -49,15 +45,13 @@ export default class App extends React.Component {
this.setState({ loading: true });
Promise.all([
getCurrentUser(),
getLanguages(),
getExporters(),
getQualityProfiles()
]).then(responses => {
if (this.mounted) {
const [user, languages, exporters, profiles] = responses;
const [user, exporters, profiles] = responses;
const canAdmin = user.permissions.global.includes('profileadmin');
this.setState({
languages,
exporters,
canAdmin,
profiles: sortProfiles(profiles),
@@ -76,13 +70,16 @@ export default class App extends React.Component {
}

renderChild () {
if (this.state.loading) {
const areLanguagesLoading = Object.keys(this.props.languages).length === 0;
if (this.state.loading || areLanguagesLoading) {
return <i className="spinner"/>;
}

const finalLanguages = Object.values(this.props.languages);

return React.cloneElement(this.props.children, {
profiles: this.state.profiles,
languages: this.state.languages,
languages: finalLanguages,
exporters: this.state.exporters,
canAdmin: this.state.canAdmin,
updateProfiles: this.updateProfiles

+ 28
- 0
server/sonar-web/src/main/js/apps/quality-profiles/components/AppContainer.js View File

@@ -0,0 +1,28 @@
/*
* 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 { connect } from 'react-redux';
import App from './App';
import { getLanguages } from '../../../app/store/rootReducer';

export default connect(
state => ({
languages: getLanguages(state)
})
)(App);

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileActions.js View File

@@ -54,7 +54,7 @@ export default class ProfileActions extends React.Component {
}).on('done', profile => {
this.props.updateProfiles().then(() => {
this.context.router.push({
pathname: '/show',
pathname: '/profiles/show',
query: { key: profile.key }
});
});
@@ -72,7 +72,7 @@ export default class ProfileActions extends React.Component {
new DeleteProfileView({
profile: this.props.profile
}).on('done', () => {
this.context.router.replace('/');
this.context.router.replace('/profiles');
this.props.updateProfiles();
}).render();
}

+ 1
- 1
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileLink.js View File

@@ -30,7 +30,7 @@ export default class ProfileLink extends React.Component {
const query = { key: profileKey };
return (
<Link
to={{ pathname: '/show', query }}
to={{ pathname: '/profiles/show', query }}
activeClassName="link-no-underline"
{...other}>
{children}

+ 1
- 1
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.js View File

@@ -26,7 +26,7 @@ export default class ProfileNotFound extends React.Component {
return (
<div className="quality-profile-not-found">
<div className="note spacer-bottom">
<IndexLink to="/" className="text-muted">
<IndexLink to="/profiles/" className="text-muted">
{translate('quality_profiles.page')}
</IndexLink>
</div>

+ 3
- 3
server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.js View File

@@ -86,12 +86,12 @@ export default class ProfileHeader extends React.Component {
return (
<header className="page-header quality-profile-header">
<div className="note spacer-bottom">
<IndexLink to="/" className="text-muted">
<IndexLink to="/profiles/" className="text-muted">
{translate('quality_profiles.page')}
</IndexLink>
{' / '}
<Link
to={{ pathname: '/', query: { language: profile.language } }}
to={{ pathname: '/profiles/', query: { language: profile.language } }}
className="text-muted">
{profile.languageName}
</Link>
@@ -111,7 +111,7 @@ export default class ProfileHeader extends React.Component {
{this.renderUsageDate()}
<li>
<Link
to={{ pathname: '/changelog', query: { key: profile.key } }}
to={{ pathname: '/profiles/changelog', query: { key: profile.key } }}
className="button">
{translate('changelog')}
</Link>

+ 1
- 1
server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js View File

@@ -64,7 +64,7 @@ export default class PageHeader extends React.Component {
}).on('done', profile => {
this.props.updateProfiles().then(() => {
this.context.router.push({
pathname: '/show',
pathname: '/profiles/show',
query: { key: profile.key }
});
});

+ 1
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesList.js View File

@@ -18,7 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
import { PropTypes as RouterPropTypes } from 'react-router';
import groupBy from 'lodash/groupBy';
import pick from 'lodash/pick';
import sortBy from 'lodash/sortBy';
@@ -32,7 +31,7 @@ export default class ProfilesList extends React.Component {
static propTypes = {
profiles: ProfilesListType,
languages: LanguagesListType,
location: RouterPropTypes.location,
location: React.PropTypes.object,
canAdmin: React.PropTypes.bool.isRequired,
updateProfiles: React.PropTypes.func.isRequired
};

+ 2
- 2
server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListHeader.js View File

@@ -52,14 +52,14 @@ export default class ProfilesListHeader extends React.Component {
return (
<ul className="dropdown-menu">
<li>
<IndexLink to="/">
<IndexLink to="/profiles/">
{translate('quality_profiles.all_profiles')}
</IndexLink>
</li>
{this.props.languages.map(language => (
<li key={language.key}>
<IndexLink
to={{ pathname: '/', query: { language: language.key } }}
to={{ pathname: '/profiles/', query: { language: language.key } }}
className="js-language-filter-option"
data-language={language.key}>
{language.name}

server/sonar-web/src/main/js/apps/quality-profiles/app.js → server/sonar-web/src/main/js/apps/quality-profiles/routes.js View File

@@ -18,42 +18,24 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
import { render } from 'react-dom';
import {
Router,
Route,
IndexRoute,
Redirect,
useRouterHistory
} from 'react-router';
import { createHistory } from 'history';
import App from './components/App';
import { Route, IndexRoute, Redirect } from 'react-router';
import AppContainer from './components/AppContainer';
import ProfileContainer from './components/ProfileContainer';
import HomeContainer from './home/HomeContainer';
import ProfileDetails from './details/ProfileDetails';
import ChangelogContainer from './changelog/ChangelogContainer';
import ComparisonContainer from './compare/ComparisonContainer';

window.sonarqube.appStarted.then(options => {
const el = document.querySelector(options.el);
export default (
<Route path="profiles" component={AppContainer}>
<Redirect from="/profiles/index" to="/profiles/"/>

const history = useRouterHistory(createHistory)({
basename: window.baseUrl + '/profiles'
});
<IndexRoute component={HomeContainer}/>

render((
<Router history={history}>
<Route path="/" component={App}>
<Redirect from="/index" to="/"/>

<IndexRoute component={HomeContainer}/>

<Route component={ProfileContainer}>
<Route path="show" component={ProfileDetails}/>
<Route path="changelog" component={ChangelogContainer}/>
<Route path="compare" component={ComparisonContainer}/>
</Route>
</Route>
</Router>
), el);
});
<Route component={ProfileContainer}>
<Route path="show" component={ProfileDetails}/>
<Route path="changelog" component={ChangelogContainer}/>
<Route path="compare" component={ComparisonContainer}/>
</Route>
</Route>
);

+ 1
- 4
server/sonar-web/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb View File

@@ -1,6 +1,3 @@
<% content_for :extra_script do %>
<script>
window.sonarqube.urlRoot = window.baseUrl + '/profiles';
</script>
<script src="<%= ApplicationController.root_context -%>/js/bundles/quality-profiles.js?v=<%= sonar_version -%>"></script>
<script src="<%= ApplicationController.root_context -%>/js/bundles/app.js?v=<%= sonar_version -%>"></script>
<% end %>

+ 1
- 4
server/sonar-web/src/main/webapp/WEB-INF/app/views/quality_gates/index.html.erb View File

@@ -1,6 +1,3 @@
<% content_for :extra_script do %>
<script>
window.sonarqube.urlRoot = window.baseUrl + '/quality_gates';
</script>
<script src="<%= ApplicationController.root_context -%>/js/bundles/quality-gates.js?v=<%= sonar_version -%>"></script>
<script src="<%= ApplicationController.root_context -%>/js/bundles/app.js?v=<%= sonar_version -%>"></script>
<% end %>

Loading…
Cancel
Save