diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-11-29 17:03:24 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-12-07 14:36:18 +0100 |
commit | f1976a3f56f03c67ccbf6dca7ee5060b6a21a1da (patch) | |
tree | f8741034e51ae45b37201e90a305ebb3802da7c7 /server/sonar-web/src/main/js/apps/component | |
parent | b117943f3efa541d6c8cd8e62ad157c4f8194211 (diff) | |
download | sonarqube-f1976a3f56f03c67ccbf6dca7ee5060b6a21a1da.tar.gz sonarqube-f1976a3f56f03c67ccbf6dca7ee5060b6a21a1da.zip |
SONAR-8451 Run js app outside of ruby container
Diffstat (limited to 'server/sonar-web/src/main/js/apps/component')
-rw-r--r-- | server/sonar-web/src/main/js/apps/component/components/App.js | 45 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/component/routes.js | 28 |
2 files changed, 73 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/component/components/App.js b/server/sonar-web/src/main/js/apps/component/components/App.js new file mode 100644 index 00000000000..fe7d0d59d80 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/component/components/App.js @@ -0,0 +1,45 @@ +/* + * 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. + */ +// @flow +import React from 'react'; +import SourceViewer from '../../../components/source-viewer/SourceViewer'; +import { getComponentNavigation } from '../../../api/nav'; + +export default class App extends React.Component { + state = {}; + + componentDidMount () { + getComponentNavigation(this.props.location.query.id).then(component => ( + this.setState({ component }) + )); + } + + render () { + if (!this.state.component) { + return null; + } + + return ( + <div className="page"> + <SourceViewer component={{ id: this.state.component.uuid }}/> + </div> + ); + } +} diff --git a/server/sonar-web/src/main/js/apps/component/routes.js b/server/sonar-web/src/main/js/apps/component/routes.js new file mode 100644 index 00000000000..cee8c941699 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/component/routes.js @@ -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. + */ +// @flow +import React from 'react'; +import { IndexRoute, Redirect } from 'react-router'; +import App from './components/App'; + +export default [ + <Redirect key="1" from="/component/index" to="/component"/>, + <IndexRoute key="2" component={App}/> +]; |