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

Added the remoteHub field (for Git repository name) in the ChaosHub Frontend #4843

Conversation

JanhaviAlekar
Copy link
Contributor

Proposed changes

Screenshot from 2024-08-22 15-48-16
Screenshot from 2024-08-22 15-48-50

Summarize your changes here to communicate with the maintainers and make sure to put the link of that issue

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

Special notes for your reviewer:

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none"><path fill="#2684FF" fill-rule="evenodd" d="M1.403 2.15A.43.43 0 011.73 2l12.54.002a.43.43 0 01.424.496l-1.81 11.135a.43.43 0 01-.425.36H3.693a.585.585 0 01-.568-.478l-1.82-11.02a.425.425 0 01.098-.345zm5.203 7.814H9.41l.677-3.93H5.859l.747 3.93z" clip-rule="evenodd"/><path fill="url(#bitbucket-color-16__paint0_linear_707_135)" d="M14.122 6.033H10.1l-.67 3.931H6.604L3.317 13.86c.105.09.238.139.376.14h8.766a.43.43 0 00.425-.36l1.238-7.607z"/><defs><linearGradient id="bitbucket-color-16__paint0_linear_707_135" x1="11.544" x2="6.918" y1="4.676" y2="11.282" gradientUnits="userSpaceOnUse"><stop offset=".18" stop-color="#0052CC"/><stop offset="1" stop-color="#2684FF"/></linearGradient></defs></svg>
Copy link
Member

Choose a reason for hiding this comment

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

we can update height and width 32px for all svgs or just remove them if not required.

Comment on lines +244 to +248
{ label: 'GitHub', value: 'GitHub' },
{ label: 'Bitbucket', value: 'Bitbucket' },
{ label: 'Azure Repo', value: 'Azure Repo' },
{ label: 'GitLab', value: 'GitLab' },
{ label: 'Others', value: 'Others' }
Copy link
Member

Choose a reason for hiding this comment

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

strings

Comment on lines +55 to +73
const RemoteHubImage = ({ remoteHubName }: { remoteHubName: string }): React.ReactElement => {
const hubSvg = () => {
switch (remoteHubName) {
case 'GitHub':
return <img src={GitHub} height={27.38} width={29} alt="GitHub" />;
case 'Azure Repo':
return <img src={Azure} height={27.38} width={29} alt="Azure-Repo" />;
case 'Bitbucket':
return <img src={Bitbucket} height={27.38} width={29} alt="Bitbucket" />;
case 'GitLab':
return <img src={Gitlab} height={27.38} width={29} alt="Gitlab" />;
default:
return <img src={privateHubLogo} height={27.38} width={29} alt="Private Hub" />;
}
};

return hubSvg();
};

Copy link
Member

Choose a reason for hiding this comment

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

instead of switching the img tag we can switch the src directly

Copy link
Member

Choose a reason for hiding this comment

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

we can shift this to utils

@@ -231,6 +236,22 @@ const GitConnectionStep: React.FC<
placeholder={getString('enterHubRepositoryBranch')}
/>

<FormInput.DropDown
name="remoteHub"
label={<Text font={{ variation: FontVariation.FORM_LABEL }}>Remote Hub</Text>}
Copy link
Member

Choose a reason for hiding this comment

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

strings

Comment on lines 20 to +22
import enterpriseHubLogo from '../../images/enterpriseHub.svg';
import privateHubLogo from '../../images/privateHub.svg';
import Bitbucket from '../../images/Bitbucket.svg';
Copy link
Member

Choose a reason for hiding this comment

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

import all from @images

@@ -132,7 +155,7 @@ export const ChaosHubsView: React.FC<ChaosHubParams> = ({
{chaosHub.isDefault ? (
<img src={enterpriseHubLogo} height={26.85} width={29} alt="Enterprise Hub" />
) : (
<img src={privateHubLogo} height={27.38} width={29} alt="Private Hub" />
<RemoteHubImage remoteHubName={chaosHub.remoteHub} />
Copy link
Member

Choose a reason for hiding this comment

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

we can pass isDefault too as a prop and get the correct icon

Comment on lines +237 to +245
label={<Text font={{ variation: FontVariation.FORM_LABEL }}>Remote Hub</Text>}
placeholder={'Select Remote hub'}
items={[
{ label: 'GitHub', value: 'GitHub' },
{ label: 'Bitbucket', value: 'Bitbucket' },
{ label: 'Azure Repo', value: 'Azure Repo' },
{ label: 'GitLab', value: 'GitLab' },
{ label: 'Others', value: 'Others' }
]}
Copy link
Member

Choose a reason for hiding this comment

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

strings

@SahilKr24 SahilKr24 force-pushed the chaoshub-remoteHub-option-frontend branch from 910d934 to eafda38 Compare September 6, 2024 06:46
@Saranya-jena Saranya-jena merged commit ed7b5a8 into litmuschaos:master Sep 13, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants