-
Notifications
You must be signed in to change notification settings - Fork 694
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
Changes from all commits
622b59d
6417604
c2c07c0
eafda38
8505490
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ export function listChaosHub({ | |
id | ||
repoURL | ||
repoBranch | ||
remoteHub | ||
authType | ||
isAvailable | ||
totalFaults | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ interface AddHubFormData { | |
sshPublicKey?: string; | ||
sshPrivateKey?: string; | ||
token?: string; | ||
remoteHub: string; | ||
} | ||
interface StepData { | ||
value?: AddHubFormData; | ||
|
@@ -78,7 +79,8 @@ export const initialValues: AddHubFormData = { | |
repoBranch: '', | ||
repoURL: '', | ||
isPrivate: false, | ||
authType: AuthType.NONE | ||
authType: AuthType.NONE, | ||
remoteHub: '' | ||
}; | ||
|
||
const OverviewStep: React.FC<StepProps<StepData>> = props => { | ||
|
@@ -160,6 +162,7 @@ const GitConnectionStep: React.FC< | |
// name: values.name, | ||
isPrivate: values.isPrivate, | ||
repoURL: values.repoURL, | ||
remoteHub: values.remoteHub, | ||
authType: values.authType, | ||
token: values.token, | ||
sshPublicKey: values.sshPublicKey, | ||
|
@@ -174,6 +177,7 @@ const GitConnectionStep: React.FC< | |
description: formData.description, | ||
tags: formData.tags, | ||
repoURL: values.repoURL, | ||
remoteHub: values.remoteHub, | ||
authType: values.authType, | ||
isPrivate: values.isPrivate, | ||
token: values.token, | ||
|
@@ -188,7 +192,8 @@ const GitConnectionStep: React.FC< | |
}} | ||
validationSchema={Yup.object().shape({ | ||
repoBranch: Yup.string().trim().required('Hub Branch name is a required field'), | ||
repoURL: Yup.string().trim().required('Hub Repo name is a required field') | ||
repoURL: Yup.string().trim().required('Hub Repo name is a required field'), | ||
remoteHub: Yup.string().trim().required('Remote Hub name is a required field') | ||
})} | ||
> | ||
{formikProps => { | ||
|
@@ -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>} | ||
placeholder={getString('remoteHub')} | ||
items={[ | ||
{ label: 'GitHub', value: 'GitHub' }, | ||
{ label: 'Bitbucket', value: 'Bitbucket' }, | ||
{ label: 'Azure Repo', value: 'Azure Repo' }, | ||
{ label: 'GitLab', value: 'GitLab' }, | ||
{ label: 'Others', value: 'Others' } | ||
Comment on lines
+244
to
+248
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strings |
||
]} | ||
onChange={item => { | ||
formikProps.setFieldValue('remoteHub', item.value); | ||
}} | ||
/> | ||
|
||
{formikProps.values.isPrivate && ( | ||
<RadioButtonGroup | ||
name="type" | ||
|
@@ -350,7 +371,8 @@ export default function AddHubModalWizardView({ | |
repoBranch: '', | ||
repoURL: '', | ||
isPrivate: false, | ||
authType: AuthType.NONE | ||
authType: AuthType.NONE, | ||
remoteHub: '' | ||
}); | ||
|
||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,12 @@ import type { ListChaosHubRequest, ListChaosHubResponse, SyncChaosHubRequest, Sy | |
import CustomTagsPopover from '@components/CustomTagsPopover'; | ||
import { useDocumentTitle, useRouteWithBaseUrl } from '@hooks'; | ||
import NoFilteredData from '@components/NoFilteredData'; | ||
import GitHub from '@images/Github.svg'; | ||
import Azure from '@images/Azure.svg'; | ||
import Gitlab from '@images/Gitlab.svg'; | ||
import enterpriseHubLogo from '../../images/enterpriseHub.svg'; | ||
import privateHubLogo from '../../images/privateHub.svg'; | ||
import Bitbucket from '../../images/Bitbucket.svg'; | ||
Comment on lines
20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. import all from |
||
import { AddHubModalProvider } from './AddHubModal'; | ||
import css from './ChaosHubs.module.scss'; | ||
|
||
|
@@ -48,6 +52,25 @@ function ConnectionStatus({ isConnected }: { isConnected: boolean }): React.Reac | |
); | ||
} | ||
|
||
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(); | ||
}; | ||
|
||
Comment on lines
+55
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of switching the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can shift this to utils |
||
export const ChaosHubsView: React.FC<ChaosHubParams> = ({ | ||
chaosHubs, | ||
loading, | ||
|
@@ -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} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can pass |
||
)} | ||
<Text | ||
font={{ size: 'medium', weight: 'semi-bold' }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ interface EditHubFormData { | |
description?: string; | ||
tags: string[]; | ||
repoBranch: string; | ||
remoteHub: string; | ||
isPrivate: boolean; | ||
authType: AuthType; | ||
sshPublicKey?: string; | ||
|
@@ -150,6 +151,7 @@ const GitConnectionStep: React.FC< | |
setFormData({ | ||
...formData, | ||
repoBranch: values.repoBranch, | ||
remoteHub: values.remoteHub, | ||
isPrivate: values.isPrivate, | ||
repoURL: values.repoURL, | ||
authType: values.authType, | ||
|
@@ -164,6 +166,7 @@ const GitConnectionStep: React.FC< | |
id: formData.hubId, | ||
name: formData.name, | ||
repoBranch: values.repoBranch, | ||
remoteHub: values.remoteHub, | ||
description: formData.description, | ||
tags: formData.tags, | ||
repoURL: values.repoURL, | ||
|
@@ -229,6 +232,22 @@ const GitConnectionStep: React.FC< | |
placeholder={getString('enterHubRepositoryBranch')} | ||
/> | ||
|
||
<FormInput.DropDown | ||
name="remoteHub" | ||
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' } | ||
]} | ||
Comment on lines
+237
to
+245
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strings |
||
onChange={item => { | ||
formikProps.setFieldValue('remoteHub', item.value); | ||
}} | ||
/> | ||
|
||
{formikProps.values.isPrivate && ( | ||
<RadioButtonGroup | ||
name="type" | ||
|
@@ -343,6 +362,7 @@ export default function EditHubModalWizardView({ | |
description: hubDetails?.description, | ||
tags: hubDetails?.tags ?? [], | ||
repoBranch: hubDetails?.repoBranch ?? '', | ||
remoteHub: hubDetails?.remoteHub ?? '', | ||
isPrivate: hubDetails?.isPrivate ?? false, | ||
authType: hubDetails?.authType ?? AuthType.NONE, | ||
repoURL: hubDetails?.repoURL ?? '', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings