Skip to content

Commit 3cac0ab

Browse files
committed
fix for gitops label
1 parent 92acc56 commit 3cac0ab

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

src/components/gitOps/GitOpsConfiguration.tsx

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,17 @@ class GitOpsConfiguration extends Component<GitOpsProps, GitOpsState> {
487487
)
488488
}
489489

490+
const renderInputLabel = (label: string, link: string, linkText: string) => {
491+
return (
492+
<div className="flex">
493+
<span className="dc__required-field">{label}</span>&nbsp;
494+
<a target="_blank" href={link} className="cursor fs-13 onlink ml-4">
495+
{linkText}
496+
</a>
497+
</div>
498+
)
499+
}
500+
490501
return (
491502
<section className="global-configuration__component flex-1">
492503
<h2 className="form__title" data-testid="gitops-heading">
@@ -627,13 +638,16 @@ class GitOpsConfiguration extends Component<GitOpsProps, GitOpsState> {
627638
{this.state.providerTab === GitProvider.BITBUCKET_CLOUD && (
628639
<CustomInput
629640
name="workspaceID"
641+
label={() =>
642+
renderInputLabel(
643+
'Bitbucket Workspace ID',
644+
GitLink.BITBUCKET_WORKSPACE,
645+
'(How to create workspace in bitbucket?)',
646+
)
647+
}
630648
value={this.state.form.bitBucketWorkspaceId}
631649
onChange={(event) => this.handleChange(event, 'bitBucketWorkspaceId')}
632-
showLink={true}
633-
link={GitLink.BITBUCKET_WORKSPACE}
634-
linkText={'(How to create workspace in bitbucket?)'}
635650
error={this.state.isError.bitBucketWorkspaceId}
636-
label="Bitbucket Workspace ID"
637651
tabIndex={1}
638652
labelClassName="gitops__id form__label--fs-13 fw-5 fs-13 mb-4"
639653
dataTestid="gitops-bitbucket-workspace-id-textbox"
@@ -644,13 +658,16 @@ class GitOpsConfiguration extends Component<GitOpsProps, GitOpsState> {
644658
<div className="mt-16">
645659
<CustomInput
646660
name="groupID"
661+
label={() =>
662+
renderInputLabel(
663+
LinkAndLabelSpec[this.state.providerTab]['label'],
664+
LinkAndLabelSpec[this.state.providerTab]['link'],
665+
LinkAndLabelSpec[this.state.providerTab]['linkText'],
666+
)
667+
}
647668
value={this.state.form[key]}
648669
tabIndex={2}
649670
error={this.state.isError[key]}
650-
showLink={true}
651-
link={LinkAndLabelSpec[this.state.providerTab]['link']}
652-
linkText={LinkAndLabelSpec[this.state.providerTab]['linkText']}
653-
label={LinkAndLabelSpec[this.state.providerTab]['label']}
654671
onChange={(event) => {
655672
this.handleChange(event, key)
656673
}}
@@ -713,20 +730,21 @@ class GitOpsConfiguration extends Component<GitOpsProps, GitOpsState> {
713730
</div>
714731
<div>
715732
<CustomInput
733+
name="Enter token"
734+
label={() =>
735+
renderInputLabel(
736+
this.state.providerTab === GitProvider.AZURE_DEVOPS
737+
? 'Azure DevOps Access Token '
738+
: 'Personal Access Token ',
739+
DOCUMENTATION.GLOBAL_CONFIG_GIT_ACCESS_LINK,
740+
'(Check permissions required for PAT)',
741+
)
742+
}
716743
value={this.state.form.token}
717744
onChange={(event) => this.handleChange(event, 'token')}
718-
name="Enter token"
719745
tabIndex={4}
720746
error={this.state.isError.token}
721747
onFocus={handleOnFocus}
722-
label={
723-
this.state.providerTab === GitProvider.AZURE_DEVOPS
724-
? 'Azure DevOps Access Token '
725-
: 'Personal Access Token '
726-
}
727-
showLink={true}
728-
link={DOCUMENTATION.GLOBAL_CONFIG_GIT_ACCESS_LINK}
729-
linkText={'(Check permissions required for PAT)'}
730748
labelClassName="gitops__id form__label--fs-13 mb-8 fw-5 fs-13"
731749
dataTestid={
732750
this.state.providerTab === GitProvider.AZURE_DEVOPS

0 commit comments

Comments
 (0)