diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2018-10-15 11:55:35 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-11-16 20:21:03 +0100 |
commit | f61d654f7d74036f50f2a1ca6b380a437ec911a2 (patch) | |
tree | 9a89718368daa1b60d5547ef606fbd00ebca59fc /server/sonar-web/src/main/js/apps/organizations | |
parent | f8694e7d8b50651cba439fb5847ffde2d3bd013c (diff) | |
download | sonarqube-f61d654f7d74036f50f2a1ca6b380a437ec911a2.tar.gz sonarqube-f61d654f7d74036f50f2a1ca6b380a437ec911a2.zip |
SONAR-11321 Create organization from GitHub organization or BitBucket team
* Create api/alm_integration/show_organization and handle only GitHub installation
* Add import from ALM tab in Create Org page
* Do not show error while validating detail input
* Add step to create organization from ALM
* Display a warning if the installation id was not found
* Add Alm link to remote organization in org context
* Create GET api/alm_integration/show_app_info
Diffstat (limited to 'server/sonar-web/src/main/js/apps/organizations')
4 files changed, 69 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx index e1b30839a39..1689dc06896 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx @@ -22,7 +22,8 @@ import { connect } from 'react-redux'; import { RouterState } from 'react-router'; import { getCurrentUser, getOrganizationByKey, Store } from '../../../store/rootReducer'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; -import { Organization, CurrentUser, isLoggedIn } from '../../../app/types'; +import { Organization, CurrentUser } from '../../../app/types'; +import { isLoggedIn } from '../../../helpers/users'; interface StateToProps { currentUser: CurrentUser; diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx index bc0bca0a822..d376085573a 100644 --- a/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/navigation/OrganizationNavigationHeader.tsx @@ -24,6 +24,8 @@ import OrganizationAvatar from '../../../components/common/OrganizationAvatar'; import Dropdown from '../../../components/controls/Dropdown'; import DropdownIcon from '../../../components/icons-components/DropdownIcon'; import OrganizationListItem from '../../../components/ui/OrganizationListItem'; +import { sanitizeAlmId } from '../../../helpers/almIntegrations'; +import { getBaseUrl } from '../../../helpers/urls'; interface Props { organization: Organization; @@ -56,6 +58,21 @@ export default function OrganizationNavigationHeader({ organization, organizatio ) : ( <span className="spacer-left">{organization.name}</span> )} + {organization.almRepoUrl && ( + <a + className="link-no-underline" + href={organization.almRepoUrl} + rel="noopener noreferrer" + target="_blank"> + <img + alt={sanitizeAlmId(organization.almId)} + className="text-text-top spacer-left" + height={16} + src={`${getBaseUrl()}/images/sonarcloud/${sanitizeAlmId(organization.almId)}.svg`} + width={16} + /> + </a> + )} {organization.description != null && ( <div className="navbar-context-description"> <p className="text-limited text-top" title={organization.description}> diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx index 57d43dc4682..021b80766e4 100644 --- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/OrganizationNavigationHeader-test.tsx @@ -26,7 +26,20 @@ it('renders', () => { expect( shallow( <OrganizationNavigationHeader + organization={{ key: 'foo', name: 'Foo', projectVisibility: Visibility.Public }} + organizations={[]} + /> + ) + ).toMatchSnapshot(); +}); + +it('renders with alm integration', () => { + expect( + shallow( + <OrganizationNavigationHeader organization={{ + almId: 'github', + almRepoUrl: 'https://github.com/foo', key: 'foo', name: 'Foo', projectVisibility: Visibility.Public diff --git a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/__snapshots__/OrganizationNavigationHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/__snapshots__/OrganizationNavigationHeader-test.tsx.snap index 82dd13c2a2a..cf3e383e573 100644 --- a/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/__snapshots__/OrganizationNavigationHeader-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/organizations/navigation/__tests__/__snapshots__/OrganizationNavigationHeader-test.tsx.snap @@ -62,3 +62,40 @@ exports[`renders dropdown 1`] = ` </a> </Dropdown> `; + +exports[`renders with alm integration 1`] = ` +<header + className="navbar-context-header" +> + <OrganizationAvatar + organization={ + Object { + "almId": "github", + "almRepoUrl": "https://github.com/foo", + "key": "foo", + "name": "Foo", + "projectVisibility": "public", + } + } + /> + <span + className="spacer-left" + > + Foo + </span> + <a + className="link-no-underline" + href="https://github.com/foo" + rel="noopener noreferrer" + target="_blank" + > + <img + alt="github" + className="text-text-top spacer-left" + height={16} + src="/images/sonarcloud/github.svg" + width={16} + /> + </a> +</header> +`; |