Skip to content

Commit 129b0ed

Browse files
committed
[dashboard, server] Remove "sinlgeOrgMode"
1 parent 49e75cc commit 129b0ed

File tree

13 files changed

+427
-283
lines changed

13 files changed

+427
-283
lines changed

components/dashboard/src/Login.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,7 @@ const LoginContent = ({
311311
</LoginButton>
312312
))
313313
)}
314-
<SSOLoginForm
315-
onSuccess={authorizeSuccessful}
316-
singleOrgMode={!!authProviders.data && authProviders.data.length === 0}
317-
/>
314+
<SSOLoginForm onSuccess={authorizeSuccessful} />
318315
</div>
319316
{errorMessage && <ErrorMessage imgSrc={exclamation} message={errorMessage} />}
320317
</div>

components/dashboard/src/dedicated-setup/use-needs-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const useNeedsSetup = () => {
3232
};
3333
};
3434

35-
const useOnboardingState = () => {
35+
export const useOnboardingState = () => {
3636
const { data: installationConfig } = useInstallationConfiguration();
3737

3838
return useQuery(

components/dashboard/src/login/SSOLoginForm.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { useOnBlurError } from "../hooks/use-onblur-error";
1212
import { openOIDCStartWindow } from "../provider-utils";
1313
import { useFeatureFlag } from "../data/featureflag-query";
1414
import { useLocation } from "react-router";
15+
import { useOnboardingState } from "../dedicated-setup/use-needs-setup";
1516

1617
type Props = {
17-
singleOrgMode?: boolean;
1818
onSuccess: () => void;
1919
};
2020

@@ -27,8 +27,10 @@ function getOrgSlugFromPath(path: string) {
2727
return pathSegments[2];
2828
}
2929

30-
export const SSOLoginForm: FC<Props> = ({ singleOrgMode, onSuccess }) => {
30+
export const SSOLoginForm: FC<Props> = ({ onSuccess }) => {
3131
const location = useLocation();
32+
const { data: onboardingState } = useOnboardingState();
33+
const singleOrgMode = (onboardingState?.organizationCountTotal || 0) < 2;
3234

3335
const [orgSlug, setOrgSlug] = useState(
3436
getOrgSlugFromPath(location.pathname) || window.localStorage.getItem("sso-org-slug") || "",

components/gitpod-db/src/team-db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const TeamDB = Symbol("TeamDB");
1818
export interface TeamDB extends TransactionalDB<TeamDB> {
1919
findTeams(
2020
offset: number,
21-
limit: number,
21+
limit: number | undefined,
2222
orderBy: keyof Team,
2323
orderDir: "ASC" | "DESC",
2424
searchTerm?: string,

components/gitpod-db/src/typeorm/team-db-impl.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB {
5858

5959
public async findTeams(
6060
offset: number,
61-
limit: number,
61+
limit: number | undefined,
6262
orderBy: keyof Team,
6363
orderDir: "DESC" | "ASC",
6464
searchTerm?: string,
@@ -70,7 +70,11 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB {
7070
searchTerm: `%${searchTerm}%`,
7171
});
7272
}
73-
queryBuilder = queryBuilder.andWhere("markedDeleted = 0").skip(offset).take(limit).orderBy(orderBy, orderDir);
73+
queryBuilder = queryBuilder.andWhere("markedDeleted = 0").skip(offset);
74+
if (limit) {
75+
queryBuilder = queryBuilder.take(limit);
76+
}
77+
queryBuilder = queryBuilder.orderBy(orderBy, orderDir);
7478

7579
const [rows, total] = await queryBuilder.getManyAndCount();
7680
return { total, rows };

components/gitpod-protocol/src/gitpod-service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,10 @@ export namespace GitpodServer {
489489
* Whether this Gitpod instance is already configured with SSO.
490490
*/
491491
readonly isCompleted: boolean;
492-
493492
/**
494-
* Whether this Gitpod instance has at least one org.
493+
* Total number of organizations.
495494
*/
496-
readonly hasAnyOrg: boolean;
495+
readonly organizationCountTotal: number;
497496
}
498497
}
499498

components/public-api/gitpod/v1/installation.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ message GetOnboardingStateResponse {
4242
}
4343

4444
message OnboardingState {
45+
// Whether at least one organization has completed the onboarding
4546
bool completed = 1;
47+
48+
// The total number of organizations
49+
int32 organization_count_total = 2;
4650
}
4751

4852
message GetInstallationWorkspaceDefaultImageRequest {}

components/public-api/go/v1/installation.pb.go

Lines changed: 200 additions & 187 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)