Skip to content

Commit

Permalink
[dashboard] show error message on new project for Bitbucket-only users
Browse files Browse the repository at this point in the history
Fixes #6345
  • Loading branch information
JanKoehnlein committed Nov 10, 2021
1 parent 64f4da8 commit c124902
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions components/dashboard/src/projects/NewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export default function NewProject() {
setProvider("gitlab.com");
} else if (user.identities.find(i => i.authProviderId === "Public-GitHub")) {
setProvider("github.com");
} else if (user.identities.find(i => i.authProviderId == "Public-Bitbucket")) {
setProvider("bitbucket.org");
}
}
}, [user]);
Expand Down Expand Up @@ -85,7 +87,7 @@ export default function NewProject() {
}, [selectedAccount]);

useEffect(() => {
if (!provider) {
if (!provider || isBitbucket()) {
return;
}
(async () => {
Expand All @@ -100,9 +102,10 @@ export default function NewProject() {
}, [provider]);

const isGitHub = () => provider === "github.com";
const isBitbucket = () => provider == "bitbucket.org";

const updateReposInAccounts = async (installationId?: string) => {
if (!provider) {
if (!provider || isBitbucket()) {
return [];
}
try {
Expand Down Expand Up @@ -159,7 +162,7 @@ export default function NewProject() {
}

const createProject = async (teamOrUser: Team | User, selectedRepo: string) => {
if (!provider) {
if (!provider || isBitbucket()) {
return;
}
const repo = reposInAccounts.find(r => r.account === selectedAccount && r.path === selectedRepo);
Expand Down Expand Up @@ -388,17 +391,25 @@ export default function NewProject() {
</>)
};

return (<div className="flex flex-col w-96 mt-24 mx-auto items-center">
<h1>New Project</h1>
<p className="text-gray-500 text-center text-base">Select a Git repository on <strong>{provider}</strong>. (<a className="gp-link cursor-pointer" onClick={() => setShowGitProviders(true)}>change</a>)</p>
if (isBitbucket()) {
return (<div className="flex flex-col w-96 mt-24 mx-auto items-center">
<h1>We are still working working on Bitbucket support for Projects</h1>
<p className="text-gray-500 text-center text-base">Continue to <a href="/workspaces" className="gp-link">workspaces</a>, or login with <a href={gitpodHostUrl.asApiLogout().toString()} className="gp-link">GitHub</a> or <a href={gitpodHostUrl.asApiLogout().toString()} className="gp-link">GitLab</a> to use Projects</p>
</div>);

{!selectedRepo && renderSelectRepository()}
} else {
return (<div className="flex flex-col w-96 mt-24 mx-auto items-center">
<h1>New Project</h1>
<p className="text-gray-500 text-center text-base">Select a Git repository on <strong>{provider}</strong>. (<a className="gp-link cursor-pointer" onClick={() => setShowGitProviders(true)}>change</a>)</p>

{selectedRepo && !selectedTeamOrUser && renderSelectTeam()}
{!selectedRepo && renderSelectRepository()}

{selectedRepo && selectedTeamOrUser && (<div></div>)}
{selectedRepo && !selectedTeamOrUser && renderSelectTeam()}

</div>);
{selectedRepo && selectedTeamOrUser && (<div></div>)}

</div>);
}

}

Expand Down

0 comments on commit c124902

Please sign in to comment.