Skip to content

Commit

Permalink
SONAR-11036 Install integration with GitHub or BitBucket Cloud
Browse files Browse the repository at this point in the history
* SONAR-11040 Update tutorial choices modal
* SONAR-11041 Migrate manual installation tab
* SONAR-11041 Rename button to start new project tutorial
* SONAR-11041 Rework sonarcloud tabbed page styling
* SONAR-11042 Add alm app install buttons in create project page
* Make start script compatible with ALM integration
  • Loading branch information
gregaubert authored and SonarTech committed Aug 10, 2018
1 parent 3a39b4f commit b08814f
Show file tree
Hide file tree
Showing 52 changed files with 1,897 additions and 413 deletions.
4 changes: 3 additions & 1 deletion server/sonar-web/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ function runDevServer(compiler, host, port, protocol) {
proxy: {
'/api': { target: proxy, changeOrigin: true },
'/static': { target: proxy, changeOrigin: true },
'/integration': { target: proxy, changeOrigin: true }
'/integration': { target: proxy, changeOrigin: true },
'/sessions/init': { target: proxy, changeOrigin: true },
'/oauth2': { target: proxy, changeOrigin: true }
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { SearchProjectsResponseComponent } from '../../api/components';
import { getJSON } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';

export const PAGE_SIZE = 50;

export const QUALIFIERS_ORDER = ['TRK', 'VW', 'APP'];

export type Project = SearchProjectsResponseComponent;
export function getRepositories(): Promise<{
installation: {
installationUrl: string;
enabled: boolean;
};
}> {
return getJSON('/api/alm_integration/list_repositories').catch(throwGlobalError);
}
29 changes: 15 additions & 14 deletions server/sonar-web/src/main/js/api/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getJSON, postJSON, post, RequestData } from '../helpers/request';
import throwGlobalError from '../app/utils/throwGlobalError';
import { getJSON, postJSON, post, RequestData } from '../helpers/request';
import { Paging, Visibility, BranchParameters, MyProject } from '../app/types';

export interface BaseSearchProjectsParameters {
Expand All @@ -31,29 +31,30 @@ export interface BaseSearchProjectsParameters {
visibility?: Visibility;
}

export interface SearchProjectsParameters extends BaseSearchProjectsParameters {
p?: number;
ps?: number;
export interface ProjectBase {
key: string;
name: string;
qualifier: string;
visibility: Visibility;
}

export interface SearchProjectsResponseComponent {
export interface Project extends ProjectBase {
id: string;
key: string;
lastAnalysisDate?: string;
name: string;
organization: string;
qualifier: string;
visibility: Visibility;
}

export interface SearchProjectsResponse {
components: SearchProjectsResponseComponent[];
paging: Paging;
export interface SearchProjectsParameters extends BaseSearchProjectsParameters {
p?: number;
ps?: number;
}

export function getComponents(
parameters: SearchProjectsParameters
): Promise<SearchProjectsResponse> {
): Promise<{
components: Project[];
paging: Paging;
}> {
return getJSON('/api/projects/search', parameters);
}

Expand All @@ -75,7 +76,7 @@ export function createProject(data: {
name: string;
project: string;
organization?: string;
}): Promise<any> {
}): Promise<{ project: ProjectBase }> {
return postJSON('/api/projects/create', data).catch(throwGlobalError);
}

Expand Down
16 changes: 10 additions & 6 deletions server/sonar-web/src/main/js/app/components/StartupModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ export class StartupModal extends React.PureComponent<Props, State> {
this.tryAutoOpenLicense().catch(this.tryAutoOpenOnboarding);
}

closeOnboarding = () => {
closeOnboarding = (doSkipOnboarding = true) => {
this.setState(state => {
if (state.modal !== ModalKey.license) {
skipOnboarding();
this.props.skipOnboardingAction();
if (doSkipOnboarding) {
skipOnboarding();
this.props.skipOnboardingAction();
}
return { automatic: false, modal: undefined };
}
return undefined;
Expand Down Expand Up @@ -164,7 +166,10 @@ export class StartupModal extends React.PureComponent<Props, State> {

tryAutoOpenOnboarding = () => {
const { currentUser, location } = this.props;
if (currentUser.showOnboardingTutorial && !location.pathname.startsWith('documentation')) {
if (
currentUser.showOnboardingTutorial &&
!['about', 'documentation', 'onboarding'].some(path => location.pathname.startsWith(path))
) {
this.setState({ automatic: true });
if (isSonarCloud()) {
this.openOnboarding();
Expand All @@ -182,9 +187,8 @@ export class StartupModal extends React.PureComponent<Props, State> {
{modal === ModalKey.license && <LicensePromptModal onClose={this.closeLicense} />}
{modal === ModalKey.onboarding && (
<Onboarding
onFinish={this.closeOnboarding}
onClose={this.closeOnboarding}
onOpenOrganizationOnboarding={this.openOrganizationOnboarding}
onOpenProjectOnboarding={this.openProjectOnboarding}
onOpenTeamOnboarding={this.openTeamOnboarding}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default class GlobalNavPlus extends React.PureComponent<Props, State> {
<ul className="menu">
<li>
<a className="js-new-project" href="#" onClick={this.handleNewProjectClick}>
{translate('my_account.analyze_new_project')}
{translate('provisioning.create_new_project')}
</a>
</li>
<li className="divider" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`render 1`] = `
href="#"
onClick={[Function]}
>
my_account.analyze_new_project
provisioning.create_new_project
</a>
</li>
<li
Expand Down
13 changes: 10 additions & 3 deletions server/sonar-web/src/main/js/app/styles/components/alerts.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@
color: #3c763d;
}

.alert-muted {
color: var(--disableGrayText);
border-color: var(--disableGrayBorder);
background-color: var(--disableGrayBg);
}

.alert-big {
font-size: var(--mediumFontSize);
padding: 10px 16px;
}

.page-header .alert {
clear: left;
float: left;
.alert-small {
font-size: var(--verySmallFontSize);
margin-bottom: 0;
padding: 2px 4px;
}

.page-notifs .alert {
Expand Down
18 changes: 18 additions & 0 deletions server/sonar-web/src/main/js/app/styles/components/modals.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@
padding: 10px;
}

.modal-simple-head {
padding: calc(2 * var(--pagePadding)) calc(3 * var(--pagePadding));
}

.modal-simple-head h1 {
font-size: var(--hugeFontSize);
font-weight: bold;
line-height: 30px;
}

.modal-simple-body {
padding: 0 calc(3 * var(--pagePadding));
}

.modal-simple-footer {
padding: calc(2 * var(--pagePadding)) calc(3 * var(--pagePadding));
}

.modal-field,
.modal-large-field,
.modal-validation-field {
Expand Down
12 changes: 12 additions & 0 deletions server/sonar-web/src/main/js/app/styles/init/forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ label[for] {
cursor: pointer;
}

.form-field {
clear: both;
display: block;
padding-top: var(--gridSize);
padding-bottom: calc(2 * var(--gridSize));
}

.form-field label {
display: block;
padding-bottom: var(--gridSize);
}

.radio-toggle {
display: inline-block;
vertical-align: middle;
Expand Down
67 changes: 67 additions & 0 deletions server/sonar-web/src/main/js/app/styles/sonarcloud.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* SonarQube
* Copyright (C) 2009-2018 SonarSource SA
* mailto:info 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.
*/

/* EXTENDS components/pages.css */
.sonarcloud.page-limited {
padding-top: 50px;
padding-bottom: 50px;
}

.sonarcloud .page-header {
margin-bottom: 40px;
}

.sonarcloud .page-title {
font-size: var(--hugeFontSize);
font-weight: bold;
}

.sonarcloud .flex-tabs {
display: flex;
clear: left;
margin-bottom: calc(3 * var(--gridSize));
box-shadow: 0 1px 0 var(--barBorderColor);
}

.sonarcloud .flex-tabs > li > a {
display: block;
height: 100%;
width: 100%;
box-sizing: border-box;
color: var(--secondFontColor);
font-weight: 600;
cursor: pointer;
padding-bottom: var(--gridSize);
border-bottom: 2px solid transparent;
transition: color 0.2s ease;
}

.sonarcloud .flex-tabs > li ~ li {
margin-left: calc(4 * var(--gridSize));
}

.sonarcloud .flex-tabs > li > a:hover {
color: var(--baseFontColor);
}

.sonarcloud .flex-tabs > li > a.selected {
color: var(--blue);
border-bottom-color: var(--blue);
}
1 change: 1 addition & 0 deletions server/sonar-web/src/main/js/app/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module.exports = {
smallFontSize: '12px',
mediumFontSize: '14px',
bigFontSize: '16px',
hugeFontSize: '24px',

controlHeight: `${3 * grid}px`,
smallControlHeight: `${2.5 * grid}px`,
Expand Down
2 changes: 2 additions & 0 deletions server/sonar-web/src/main/js/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ export interface LinearIssueLocation {
export interface LoggedInUser extends CurrentUser {
avatar?: string;
email?: string;
externalIdentity?: string;
externalProvider?: string;
homepage?: HomePage;
isLoggedIn: true;
login: string;
Expand Down
8 changes: 2 additions & 6 deletions server/sonar-web/src/main/js/app/utils/startReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import IssuesPageSelector from '../../apps/issues/IssuesPageSelector';
import marketplaceRoutes from '../../apps/marketplace/routes';
import customMetricsRoutes from '../../apps/custom-metrics/routes';
import overviewRoutes from '../../apps/overview/routes';
import onboardingRoutes from '../../apps/tutorials/routes';
import organizationsRoutes from '../../apps/organizations/routes';
import permissionTemplatesRoutes from '../../apps/permission-templates/routes';
import portfolioRoutes from '../../apps/portfolio/routes';
Expand Down Expand Up @@ -169,12 +170,7 @@ const startReactApp = (lang, currentUser, appState) => {
component={lazyLoad(() => import('../components/extensions/GlobalPageExtension'))}
/>
<Route path="issues" component={IssuesPageSelector} />
<Route
path="onboarding"
component={lazyLoad(() =>
import('../../apps/tutorials/projectOnboarding/ProjectOnboardingPage')
)}
/>
<Route path="onboarding" childRoutes={onboardingRoutes} />
<Route path="organizations" childRoutes={organizationsRoutes} />
<Route path="projects" childRoutes={projectsRoutes} />
<Route path="quality_gates" childRoutes={qualityGatesRoutes} />
Expand Down
2 changes: 1 addition & 1 deletion server/sonar-web/src/main/js/apps/about/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const routes = [
() => (isSonarCloud() ? import('./sonarcloud/Home') : import('./components/AboutApp'))
)
},
childRoutes: isSonarCloud
childRoutes: isSonarCloud()
? [
{
path: 'contact',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class UserExternalIdentity extends React.PureComponent {

componentDidUpdate(prevProps) {
if (prevProps.user !== this.props.user) {
this.this.fetchIdentityProviders();
this.fetchIdentityProviders();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export class NoFavoriteProjects extends React.PureComponent<StateProps> {
<p>{translate('projects.no_favorite_projects.how_to_add_projects')}</p>
<div className="huge-spacer-top">
<a className="button" href="#" onClick={this.onAnalyzeProjectClick}>
{translate('my_account.analyze_new_project')}
{isSonarCloud()
? translate('provisioning.create_new_project')
: translate('my_account.analyze_new_project')}
</a>
<Dropdown
className="display-inline-block big-spacer-left"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ exports[`renders for SonarCloud 1`] = `
href="#"
onClick={[Function]}
>
my_account.analyze_new_project
provisioning.create_new_project
</a>
<Dropdown
className="display-inline-block big-spacer-left"
Expand Down
Loading

0 comments on commit b08814f

Please sign in to comment.