diff options
Diffstat (limited to 'server/sonar-web/src/main')
14 files changed, 12 insertions, 435 deletions
diff --git a/server/sonar-web/src/main/js/app/index.js b/server/sonar-web/src/main/js/app/index.js index 107dc2ae53c..84268cf4861 100644 --- a/server/sonar-web/src/main/js/app/index.js +++ b/server/sonar-web/src/main/js/app/index.js @@ -44,7 +44,7 @@ window.sonarqube.appStarted.then(options => { <Provider store={store}> <Router history={history}> <Route path="/" component={App}> - {accountRoutes} + <Route path="account">{accountRoutes}</Route> {projectsRoutes} {qualityGatesRoutes} {qualityProfilesRoutes} diff --git a/server/sonar-web/src/main/js/app/store/rootReducer.js b/server/sonar-web/src/main/js/app/store/rootReducer.js index a317c982af6..3c2ac6abb2b 100644 --- a/server/sonar-web/src/main/js/app/store/rootReducer.js +++ b/server/sonar-web/src/main/js/app/store/rootReducer.js @@ -25,7 +25,6 @@ import languages, * as fromLanguages from './languages/reducer'; import measures, * as fromMeasures from './measures/reducer'; import globalMessages, * as fromGlobalMessages from '../../components/store/globalMessages'; -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'; @@ -38,7 +37,6 @@ export default combineReducers({ users, // apps - issuesActivity, projectsApp, qualityGatesApp }); @@ -63,10 +61,6 @@ export const getFavorites = state => ( fromFavorites.getFavorites(state.favorites) ); -export const getIssuesActivity = state => ( - fromIssuesActivity.getIssuesActivity(state.issuesActivity) -); - export const getComponentMeasure = (state, componentKey, metricKey) => ( fromMeasures.getComponentMeasure(state.measures, componentKey, metricKey) ); diff --git a/server/sonar-web/src/main/js/apps/account/account.css b/server/sonar-web/src/main/js/apps/account/account.css index 130a53eabf3..10410996517 100644 --- a/server/sonar-web/src/main/js/apps/account/account.css +++ b/server/sonar-web/src/main/js/apps/account/account.css @@ -30,20 +30,6 @@ float: left; } -.account-user > a { - display: block; - float: left; - margin: -10px -15px -10px -10px; - padding: 10px 15px 10px 10px; - border-bottom: none; - border-radius: 3px; -} - -.account-user > a:hover, -.account-user > a:active { - background-color: rgba(0, 0, 0, 0.075); -} - .account-user h1 { line-height: 60px; } diff --git a/server/sonar-web/src/main/js/apps/account/components/Nav.js b/server/sonar-web/src/main/js/apps/account/components/Nav.js index d7e4b1215de..f1c94137e74 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Nav.js +++ b/server/sonar-web/src/main/js/apps/account/components/Nav.js @@ -18,16 +18,16 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import { Link } from 'react-router'; +import { Link, IndexLink } from 'react-router'; import { translate } from '../../../helpers/l10n'; const Nav = () => ( <nav className="account-nav clearfix"> <ul className="nav navbar-nav nav-tabs"> <li> - <Link to="/account/profile/" activeClassName="active"> + <IndexLink to="/account/" activeClassName="active"> {translate('my_account.profile')} - </Link> + </IndexLink> </li> <li> <Link to="/account/security/" activeClassName="active"> diff --git a/server/sonar-web/src/main/js/apps/account/components/UserCard.js b/server/sonar-web/src/main/js/apps/account/components/UserCard.js index c9fc9674173..da25ea529d7 100644 --- a/server/sonar-web/src/main/js/apps/account/components/UserCard.js +++ b/server/sonar-web/src/main/js/apps/account/components/UserCard.js @@ -18,7 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import { IndexLink } from 'react-router'; import Avatar from '../../../components/ui/Avatar'; export default class UserCard extends React.Component { @@ -31,12 +30,10 @@ export default class UserCard extends React.Component { return ( <div className="account-user"> - <IndexLink to="/account/"> - <div id="avatar" className="pull-left account-user-avatar"> - <Avatar email={user.email} size={60}/> - </div> - <h1 id="name" className="pull-left">{user.name}</h1> - </IndexLink> + <div id="avatar" className="pull-left account-user-avatar"> + <Avatar email={user.email} size={60}/> + </div> + <h1 id="name" className="pull-left">{user.name}</h1> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/account/home/components/FavoriteProjects.js b/server/sonar-web/src/main/js/apps/account/home/components/FavoriteProjects.js deleted file mode 100644 index c8cf522e686..00000000000 --- a/server/sonar-web/src/main/js/apps/account/home/components/FavoriteProjects.js +++ /dev/null @@ -1,145 +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 { connect } from 'react-redux'; -import sortBy from 'lodash/sortBy'; -import Favorite from '../../../../components/controls/Favorite'; -import Level from '../../../../components/ui/Level'; -import { TooltipsContainer } from '../../../../components/mixins/tooltips-mixin'; -import { getFavorites, getComponentMeasure } from '../../../../app/store/rootReducer'; -import { getComponentUrl, getProjectsUrl } from '../../../../helpers/urls'; -import { fetchFavoriteProjects } from '../store/actions'; -import { translate } from '../../../../helpers/l10n'; - -class FavoriteProjects extends React.Component { - static propTypes = { - favorites: React.PropTypes.array, - fetchFavoriteProjects: React.PropTypes.func.isRequired - }; - - componentDidMount () { - this.props.fetchFavoriteProjects(); - } - - renderList () { - const { favorites } = this.props; - - if (!favorites) { - return null; - } - - if (favorites.length === 0) { - return ( - <div id="no-favorite-projects" className="boxed-group boxed-group-inner markdown text-center"> - <p className="note">{translate('my_activity.no_favorite_projects')}</p> - <p>{translate('my_activity.no_favorite_projects.engagement')}</p> - </div> - ); - } - - const sorted = sortBy(favorites, project => project.name.toLowerCase()); - - return ( - <ul id="favorite-projects"> - {sorted.map(project => ( - <li key={project.key}> - <div className="pull-left" style={{ padding: '15px 15px 15px 10px' }}> - <Favorite favorite={true} component={project.key}/> - </div> - - <a href={getComponentUrl(project.key)}> - {project.qualityGate != null && ( - <span className="pull-right"> - <Level level={project.qualityGate}/> - </span> - )} - <strong>{project.name}</strong> - </a> - </li> - ))} - </ul> - ); - } - - renderQualityGateTitle () { - const { favorites } = this.props; - - const shouldBeRendered = favorites != null && favorites.some(f => f.qualityGate != null); - - if (!shouldBeRendered) { - return null; - } - - return ( - <TooltipsContainer> - <div className="pull-right note"> - {translate('overview.quality_gate')} - <i className="little-spacer-left icon-help" - title={translate('quality_gates.intro.1')} - data-toggle="tooltip"/> - </div> - </TooltipsContainer> - ); - } - - render () { - const { favorites } = this.props; - - return ( - <div className="my-activity-projects"> - <div className="my-activity-projects-header"> - {this.renderQualityGateTitle()} - <h2>{translate('my_activity.my_favorite_projects')}</h2> - </div> - - {favorites == null && ( - <div className="text-center"> - <i className="spinner"/> - </div> - )} - - {this.renderList()} - - <div className="more"> - <a className="button" href={getProjectsUrl()}> - {translate('my_activity.explore_projects')} - </a> - </div> - </div> - ); - } -} - -const mapStateToProps = state => { - const fromState = getFavorites(state); - const favorites = fromState == null ? null : fromState - .filter(component => component.qualifier === 'TRK') - .map(component => ({ - ...component, - qualityGate: getComponentMeasure(state, component.key, 'alert_status') - })); - - return { favorites }; -}; - -export default connect( - mapStateToProps, - { fetchFavoriteProjects } -)(FavoriteProjects); diff --git a/server/sonar-web/src/main/js/apps/account/home/components/IssuesActivity.js b/server/sonar-web/src/main/js/apps/account/home/components/IssuesActivity.js deleted file mode 100644 index 26200df619f..00000000000 --- a/server/sonar-web/src/main/js/apps/account/home/components/IssuesActivity.js +++ /dev/null @@ -1,84 +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 { connect } from 'react-redux'; -import { fetchIssuesActivity } from '../store/actions'; -import { getIssuesActivity } from '../../../../app/store/rootReducer'; -import { getIssuesUrl } from '../../../../helpers/urls'; -import { translate } from '../../../../helpers/l10n'; - -class IssuesActivity extends React.Component { - componentDidMount () { - this.props.fetchIssuesActivity(); - } - - getColorClass (number) { - if (number == null) { - return ''; - } - return number > 0 ? 'text-danger' : 'text-success'; - } - - renderRecentIssues () { - const number = this.props.issuesActivity && this.props.issuesActivity.recent; - const url = getIssuesUrl({ resolved: 'false', assignees: '__me__', createdInLast: '1w' }); - - return ( - <a className="my-activity-recent-issues" href={url}> - <div id="recent-issues" className={'my-activity-issues-number ' + this.getColorClass(number)}> - {number != null ? number : ' ' } - </div> - <div className="my-activity-issues-note"> - {translate('my_activity.my_issues')}<br/>{translate('my_activity.last_week')} - </div> - </a> - ); - } - - renderAllIssues () { - const number = this.props.issuesActivity && this.props.issuesActivity.all; - const url = getIssuesUrl({ resolved: 'false', assignees: '__me__' }); - - return ( - <a className="my-activity-all-issues" href={url}> - <div id="all-issues" className={'my-activity-issues-number ' + this.getColorClass(number)}> - {number != null ? number : ' ' } - </div> - <div className="my-activity-issues-note"> - {translate('my_activity.my_issues')}<br/>{translate('my_activity.all_time')} - </div> - </a> - ); - } - - render () { - return ( - <div className="my-activity-issues"> - {this.renderRecentIssues()} - {this.renderAllIssues()} - </div> - ); - } -} - -export default connect( - state => ({ issuesActivity: getIssuesActivity(state) }), - { fetchIssuesActivity } -)(IssuesActivity); diff --git a/server/sonar-web/src/main/js/apps/account/home/components/MyActivity.js b/server/sonar-web/src/main/js/apps/account/home/components/MyActivity.js deleted file mode 100644 index 43d13d066b2..00000000000 --- a/server/sonar-web/src/main/js/apps/account/home/components/MyActivity.js +++ /dev/null @@ -1,53 +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 IssuesActivity from './IssuesActivity'; -import FavoriteProjects from './FavoriteProjects'; - -export default class MyActivity extends React.Component { - static propTypes = { - currentUser: React.PropTypes.object - }; - - render () { - const { currentUser } = this.props; - - return ( - <div id="my-activity-page"> - - {currentUser == null ? ( - - <div className="account-body text-center"> - <i className="spinner"/> - </div> - - ) : ( - - <div className="account-body"> - <IssuesActivity/> - <FavoriteProjects/> - </div> - - )} - - </div> - ); - } -} diff --git a/server/sonar-web/src/main/js/apps/account/home/components/MyActivityContainer.js b/server/sonar-web/src/main/js/apps/account/home/components/MyActivityContainer.js deleted file mode 100644 index 2e1b98636ff..00000000000 --- a/server/sonar-web/src/main/js/apps/account/home/components/MyActivityContainer.js +++ /dev/null @@ -1,28 +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 { connect } from 'react-redux'; -import MyActivity from './MyActivity'; -import { getCurrentUser } from '../../../../app/store/rootReducer'; - -const mapStateToProps = state => ({ - currentUser: getCurrentUser(state) -}); - -export default connect(mapStateToProps)(MyActivity); diff --git a/server/sonar-web/src/main/js/apps/account/home/store/actions.js b/server/sonar-web/src/main/js/apps/account/home/store/actions.js deleted file mode 100644 index 3bb645a926d..00000000000 --- a/server/sonar-web/src/main/js/apps/account/home/store/actions.js +++ /dev/null @@ -1,56 +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 { getIssuesCount } from '../../../../api/issues'; -import { getFavorites } from '../../../../api/favorites'; -import { receiveFavorites } from '../../../../app/store/favorites/actions'; -import { getMeasures } from '../../../../api/measures'; -import { receiveComponentMeasure } from '../../../../app/store/measures/actions'; - -export const RECEIVE_ISSUES_ACTIVITY = 'myActivity/RECEIVE_ISSUES_ACTIVITY'; - -const receiveIssuesActivity = (recent, all) => ({ - type: RECEIVE_ISSUES_ACTIVITY, - recent, - all -}); - -export const fetchIssuesActivity = () => dispatch => { - const query = { resolved: 'false', assignees: '__me__' }; - Promise.all([ - getIssuesCount(query), - getIssuesCount({ ...query, createdInLast: '1w' }) - ]).then(responses => dispatch(receiveIssuesActivity(responses[1].issues, responses[0].issues))); -}; - -export const fetchFavoriteProjects = () => dispatch => { - getFavorites().then(favorites => { - dispatch(receiveFavorites(favorites)); - - const projects = favorites.filter(component => component.qualifier === 'TRK'); - Promise.all(projects.map(project => getMeasures(project.key, ['alert_status']))) - .then(responses => { - responses.forEach((measures, index) => { - measures.forEach(measure => { - dispatch(receiveComponentMeasure(projects[index].key, measure.metric, measure.value)); - }); - }); - }); - }); -}; diff --git a/server/sonar-web/src/main/js/apps/account/home/store/reducer.js b/server/sonar-web/src/main/js/apps/account/home/store/reducer.js deleted file mode 100644 index 3cf1b341303..00000000000 --- a/server/sonar-web/src/main/js/apps/account/home/store/reducer.js +++ /dev/null @@ -1,32 +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 { RECEIVE_ISSUES_ACTIVITY } from './actions'; - -const reducer = (state = null, action = {}) => { - if (action.type === RECEIVE_ISSUES_ACTIVITY) { - return { all: action.all, recent: action.recent }; - } - - return state; -}; - -export default reducer; - -export const getIssuesActivity = state => state; diff --git a/server/sonar-web/src/main/js/apps/account/routes.js b/server/sonar-web/src/main/js/apps/account/routes.js index e16ea776ae4..212a2f82108 100644 --- a/server/sonar-web/src/main/js/apps/account/routes.js +++ b/server/sonar-web/src/main/js/apps/account/routes.js @@ -19,7 +19,6 @@ */ import React from 'react'; import { Route, IndexRoute } from 'react-router'; -import MyActivityContainer from './home/components/MyActivityContainer'; import Account from './components/Account'; import ProjectsContainer from './projects/ProjectsContainer'; import NotificationsContainer from './notifications/NotificationsContainer'; @@ -27,9 +26,8 @@ import Security from './components/Security'; import Profile from './profile/Profile'; export default ( - <Route path="account" component={Account}> - <IndexRoute component={MyActivityContainer}/> - <Route path="profile" component={Profile}/> + <Route component={Account}> + <IndexRoute component={Profile}/> <Route path="security" component={Security}/> <Route path="notifications" component={NotificationsContainer}/> <Route path="projects" component={ProjectsContainer}/> diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js index d012ae232bb..2c33fea9724 100644 --- a/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js +++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-branding.js @@ -34,7 +34,7 @@ export default React.createClass({ }, render() { - const homeController = window.SS.user ? '/account' : '/'; + const homeController = window.SS.user ? '/projects/favorite' : '/projects'; const homeUrl = window.baseUrl + homeController; const homeLinkClassName = 'navbar-brand' + (this.props.logoUrl ? ' navbar-brand-custom' : ''); return ( diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index 4fb0a3fc1e6..867b7cc9792 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -54,7 +54,7 @@ class DashboardController < ApplicationController end else if logged_in? - return redirect_to :controller => 'account' + return redirect_to :controller => 'projects', :action => 'favorite' else return redirect_to :controller => 'projects' end |