Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions apps/web/src/components/settings/SettingsPanels.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,50 @@ describe("SourceControlSettingsPanel discovery states", () => {
await expect.element(page.getByText("Nothing detected yet")).not.toBeInTheDocument();
});

it("shows unauthenticated API providers as available but not enabled", async () => {
setSourceControlDiscoveryStub(async () => ({
versionControlSystems: [],
sourceControlProviders: [
{
kind: "bitbucket",
label: "Bitbucket",
status: "available",
version: Option.none(),
installHint:
"Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.",
detail: Option.none(),
auth: {
status: "unauthenticated",
account: Option.none(),
host: Option.some("bitbucket.org"),
detail: Option.some(
"Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.",
),
},
},
],
}));

mounted = await render(
<AppAtomRegistryProvider>
<SourceControlSettingsPanel />
</AppAtomRegistryProvider>,
);

const bitbucketSwitch = page.getByRole("switch", { name: "Bitbucket availability" });

await expect.element(page.getByText("Not authenticated")).toBeInTheDocument();
await expect
.element(
page.getByText(
"Available. Set T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN, or T3CODE_BITBUCKET_ACCESS_TOKEN.",
),
)
.toBeInTheDocument();
await expect.element(bitbucketSwitch).toBeDisabled();
await expect.element(bitbucketSwitch).not.toBeChecked();
});

it("shows Git fetch interval settings inside the Git details dropdown", async () => {
setSourceControlDiscoveryStub(async () => ({
versionControlSystems: [
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/components/settings/SourceControlSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function itemSummary({
}

if (!item.executable) {
return <span>{item.installHint}</span>;
return <span>Available. {item.installHint}</span>;
}

if (auth.status === "unauthenticated") {
Expand Down Expand Up @@ -218,8 +218,9 @@ function DiscoveryItemRow({
readonly children?: ReactNode;
}) {
const version = optionLabel(item.version);
const enabled =
item.status === "available" && (isProviderDiscoveryItem(item) || item.implemented);
const enabled = isProviderDiscoveryItem(item)
? item.status === "available" && item.auth.status === "authenticated"
: item.status === "available" && item.implemented;
const auth = isProviderDiscoveryItem(item) ? item.auth : null;
const authStatus = auth ? authPresentation(auth) : null;
const authAccount = auth ? optionLabel(auth.account) : null;
Expand Down
Loading