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

GitHub proxy part 4.5: git server in UI #49644

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

greedy52
Copy link
Contributor

@greedy52 greedy52 commented Dec 2, 2024

Related:

e:

(note, this PR is optional for the initial MVP release but very nice to have)

Storybook screenshots:
Screenshot 2024-12-02 at 11 06 09 AM
Screenshot 2024-12-02 at 11 06 30 AM

@greedy52 greedy52 added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v17 labels Dec 2, 2024
@greedy52 greedy52 self-assigned this Dec 2, 2024
@greedy52 greedy52 mentioned this pull request Dec 2, 2024
14 tasks
@greedy52 greedy52 force-pushed the STeve/48762_git_server_cache_unified_resource branch from d1e8553 to 982bf3d Compare December 5, 2024 03:55
Base automatically changed from STeve/48762_git_server_cache_unified_resource to master December 5, 2024 17:58
@greedy52 greedy52 force-pushed the STeve/48762_git_server_cache_unified_resource_ui branch 6 times, most recently from d3e099b to fb9aeb1 Compare December 8, 2024 03:36
@greedy52 greedy52 force-pushed the STeve/48762_git_server_cache_unified_resource_ui branch from fb9aeb1 to acaca65 Compare December 8, 2024 03:37
@greedy52 greedy52 requested a review from avatus December 9, 2024 14:35
@greedy52 greedy52 marked this pull request as ready for review December 9, 2024 14:35
@github-actions github-actions bot requested a review from gzdunek December 9, 2024 14:36
@avatus
Copy link
Contributor

avatus commented Dec 9, 2024

I didn't get a chance to check this out today but i will look at it the first thing in the morning tomorrow

hostname: string;
labels: ResourceLabel[];
subKind: 'github';
github?: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is resource.github nil?

import { AuthType } from 'teleport/services/user';
import { generateTshLoginCommand } from 'teleport/lib/util';

export default function ConnectDialog({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use named exports

Suggested change
export default function ConnectDialog({
export function ConnectDialog({

onClose,
authType,
accessRequestId,
}: Props) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to keep Props in a separate type, we can inline them here.

Comment on lines +40 to +41
let repoURL = `https://github.com/orgs/${organization}/repositories`;
let title = `Use 'git' for GitHub Organization '${organization}'`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let repoURL = `https://github.com/orgs/${organization}/repositories`;
let title = `Use 'git' for GitHub Organization '${organization}'`;
const repoURL = `https://github.com/orgs/${organization}/repositories`;
const title = `Use 'git' for GitHub Organization '${organization}'`;

@@ -327,6 +331,42 @@ const KubeConnect = ({ kube }: { kube: Kube }) => {
);
};

function GitServerConnect({ gitserver }: { gitserver: GitServer }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: gitServer?

<Text bold as="span">
Step 2
</Text>
{' - Connect'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should say 'Connect', we don't connect to anything.
Maybe 'Clone or configure a repository'?

Comment on lines +77 to +81
{'To clone a new repository, find the SSH url of the repository on '}
<Link href={repoURL} target="_blank">
github.com
</Link>
{' then'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be 'To clone a new repository, find the SSH url of the repository on github.com, and then'?

<DialogHeader mb={4}>
<DialogTitle>{title}</DialogTitle>
</DialogHeader>
<DialogContent minHeight="240px" flex="0 0 auto">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing is a little off in the dialog, labels are closer to the previous field than to the next one.
Here is an improved version (I also got rid of some curly braces as they are not needed):

      <DialogContent gap={4}>
        <Box>
          <Text bold as="span">
            Step 1
          </Text>
          {' - Login to Teleport'}
          <TextSelectCopy
            mt="1"
            mb="2"
            text={generateTshLoginCommand({
              authType,
              clusterId,
              username,
              accessRequestId,
            })}
          />
        </Box>
        <Box>
          <Text bold as="span">
            Step 2
          </Text>
          {' - Connect'}
          <br />
          {'To clone a new repository, find the SSH url of the repository on '}
          <Link href={repoURL} target="_blank">
            github.com
          </Link>
          {' then'}
          <TextSelectCopy
            mt="1"
            mb="2"
            text="tsh git clone <git-clone-ssh-url>"
          />
          To configure an existing Git repository, go to the repository then
          <TextSelectCopy mt="1" mb="2" text="tsh git config update" />
        </Box>
        <Box>
          Once the repository is cloned or configured, use 'git' as normal.
        </Box>
      </DialogContent>

Comment on lines +338 to +340
const organization = gitserver.github
? gitserver.github.organization
: undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const organization = gitserver.github
? gitserver.github.organization
: undefined;
const organization = gitserver.github?.organization;


import { UserGroup } from '../userGroups';
import { UserGroup } from 'teleport/services/userGroups';
import { GitServer } from 'teleport/services/gitservers';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any strong opinion, but gitservers seems inconsistent with other exports. I'd rename it to gitServers.

Comment on lines +109 to +117
if server.GetKind() == types.KindGitServer &&
server.GetSubKind() == types.SubKindGitHub {
if github := server.GetGitHub(); github != nil {
uiServer.GitHub = &GitHubServerMetadata{
Integration: github.Integration,
Organization: github.Organization,
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like this should be in its own method, something like MakeGitServer. If its inside here, it gives the impression that this is a "server type" instead of its own thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/md ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants