Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axon 72 new onboarding auth UI #116

Merged
merged 14 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 10 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
13 changes: 13 additions & 0 deletions images/arrow-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions images/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/vscode-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 75 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@
"@material-ui/styles": "^4.10.0",
"@segment/analytics-node": "^2.1.3",
"@types/mustache": "^4.0.1",
"@vscode/webview-ui-toolkit": "^1.4.0",
"awesome-debounce-promise": "^2.1.0",
"axios": "^1.7.4",
"axios-curlirize": "^1.3.4",
Expand Down
20 changes: 6 additions & 14 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,12 @@ export class Container {
analyticsApi: VSCAnalyticsApi,
bitbucketHelper: CheckoutHelper,
) {
FeatureFlagClient.checkGate(Features.EnableNewUriHandler)
.then((enabled) => {
if (enabled) {
console.log('Using new URI handler');
context.subscriptions.push(AtlascodeUriHandler.create(analyticsApi, bitbucketHelper));
} else {
context.subscriptions.push(new LegacyAtlascodeUriHandler(analyticsApi, bitbucketHelper));
}
})
.catch((err) => {
// Not likely that we'd land here - but if anything goes wrong, default to legacy handler
console.error(`Error checking feature flag ${Features.EnableNewUriHandler}: ${err}`);
context.subscriptions.push(new LegacyAtlascodeUriHandler(analyticsApi, bitbucketHelper));
});
if (FeatureFlagClient.checkGate(Features.EnableNewUriHandler)) {
console.log('Using new URI handler');
context.subscriptions.push(AtlascodeUriHandler.create(analyticsApi, bitbucketHelper));
} else {
context.subscriptions.push(new LegacyAtlascodeUriHandler(analyticsApi, bitbucketHelper));
}
}

static initializeBitbucket(bbCtx: BitbucketContext) {
Expand Down
1 change: 1 addition & 0 deletions src/react/atlascode/common/types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Product = 'Jira' | 'Bitbucket';
94 changes: 94 additions & 0 deletions src/react/atlascode/icons/BitbucketOnboardingLogo.tsx

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions src/react/atlascode/icons/JiraOnboardingLogo.tsx

Large diffs are not rendered by default.

151 changes: 151 additions & 0 deletions src/react/atlascode/onboarding/JiraBitbucketOnboarding.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import React, { useCallback } from 'react';
import { Container, Typography, Box, Card, CardActionArea, CardContent } from '@material-ui/core';
import { Product } from '../common/types';
import { VSCodeRadio, VSCodeButton } from '@vscode/webview-ui-toolkit/react';
import { BitbucketOnboardingLogo } from '../icons/BitbucketOnboardingLogo';
import { JiraOnboardingLogo } from '../icons/JiraOnboardingLogo';

type Props = {
product: Product;
handleOptionChange: (value: string) => void;
executeSetup: () => void;
handleNext: () => void;
handleBack?: () => void;
signInText: string;
valueSet: {
cloud: string;
server: string;
none: string;
};
};
const OnboardingRadio = ({
checked,
handleValueChange,
value,
title,
description,
}: {
checked: string;
handleValueChange: (v: string) => void;
value: string;
title: string;
description?: string;
}) => {
return (
<Card variant="outlined" style={{ width: '100%' }}>
<CardActionArea
onClick={() => {
handleValueChange(value);
}}
>
<CardContent style={formControlStyles}>
<VSCodeRadio checked={checked === value} />
<Box flexDirection={'column'}>
<Typography style={{ fontWeight: 'bold' }}>{title}</Typography>
{description && <Typography>{description}</Typography>}
</Box>
</CardContent>
</CardActionArea>
</Card>
);
};

export const JiraBitbucketOnboarding: React.FC<Props> = ({
product,
handleOptionChange,
executeSetup,
handleNext,
handleBack,
signInText,
valueSet,
}) => {
const [checked, setChecked] = React.useState(valueSet.cloud);

const handleValueChange = useCallback(
(value: string) => {
setChecked(value);
handleOptionChange(value);
},
[handleOptionChange],
);

return (
<Container style={{ justifyContent: 'center' }} maxWidth="xs">
<Box style={wrapperStyles} flexDirection="column">
{product === 'Jira' ? <JiraOnboardingLogo /> : <BitbucketOnboardingLogo />}
<Typography variant="h2">What version of {product} do you use?</Typography>
<Box flexDirection="column" style={radioGroupStyles}>
<OnboardingRadio
checked={checked}
handleValueChange={handleValueChange}
value={valueSet.cloud}
title="Cloud"
description="For most of our users. The URL for accessing your site will typically be in the format mysite.atlassian.net"
/>
<OnboardingRadio
checked={checked}
handleValueChange={handleValueChange}
value={valueSet.server}
title="Server"
description="For users with a custom site. The URL is usually a custom domain or IP address set up by your organization"
/>
<OnboardingRadio
checked={checked}
handleValueChange={handleValueChange}
value={valueSet.none}
title={product === 'Jira' ? "I don't have Jira" : "I don't have Bitbucket"}
/>
</Box>
<Box
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'flex-start',
alignSelf: 'stretch',
}}
>
<VSCodeButton
disabled={!handleBack}
onClick={() => {
handleBack && handleBack();
}}
appearance="secondary"
>
Back
</VSCodeButton>
<VSCodeButton
onClick={() => {
executeSetup();
handleNext();
}}
>
{signInText}
</VSCodeButton>
</Box>
</Box>
</Container>
);
};

const wrapperStyles = {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
gap: '24px',
};

const formControlStyles = {
display: 'flex',
padding: '12px',
alignItems: 'flex-start',
gap: '8px',
alignSelf: 'stretch',
borderRadius: '4px',
};

const radioGroupStyles = {
display: 'flex',
gap: '8px',
alignItems: 'flex-start',
alignSelf: 'stretch',
};
Loading
Loading