feat: [CDE-243]: Show SSH dropdown only while creating vs cod desktop (#2585)

* feat: [CDE-243]: Show SSH dropdown only while creating vs cod desktop
This commit is contained in:
Deepesh Kumar 2024-08-26 09:28:36 +00:00 committed by Harness
parent e888f8c481
commit bbe617ce6f
6 changed files with 24 additions and 12 deletions

View File

@ -1,3 +1,19 @@
/*
* Copyright 2024 Harness, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react' import React from 'react'
import * as Yup from 'yup' import * as Yup from 'yup'
import { import {
@ -137,7 +153,6 @@ export const CDESSHSelect = () => {
placeholder={`Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'`} placeholder={`Begins with 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519', 'sk-ecdsa-sha2-nistp256@openssh.com', or 'sk-ssh-ed25519@openssh.com'`}
name="sshKeyValue" name="sshKeyValue"
label="SSH Key" label="SSH Key"
isOptional
className={css.sshKeyValue} className={css.sshKeyValue}
/> />
<Layout.Horizontal spacing="large"> <Layout.Horizontal spacing="large">

View File

@ -22,9 +22,3 @@
padding: var(--spacing-large) !important; padding: var(--spacing-large) !important;
background-color: var(--grey-50) !important; background-color: var(--grey-50) !important;
} }
.repoIcon {
path {
fill: none !important;
}
}

View File

@ -18,4 +18,3 @@
// This is an auto-generated file // This is an auto-generated file
export declare const noReposContainer: string export declare const noReposContainer: string
export declare const repoAndBranch: string export declare const repoAndBranch: string
export declare const repoIcon: string

View File

@ -50,7 +50,7 @@ const RepositoryText = ({
return ( return (
<Layout.Horizontal spacing={'medium'} flex={{ justifyContent: 'flex-start', alignItems: 'center' }}> <Layout.Horizontal spacing={'medium'} flex={{ justifyContent: 'flex-start', alignItems: 'center' }}>
{isCDE ? ( {isCDE ? (
<Repository className={css.repoIcon} color="none" height={24} width={24} /> <Repository color="none" height={24} width={24} />
) : ( ) : (
<img src={gitnessRepoLogo} height={24} width={24} /> <img src={gitnessRepoLogo} height={24} width={24} />
)} )}
@ -271,6 +271,7 @@ export const GitnessRepoImportForm = ({ isCDE }: { isCDE?: boolean }) => {
)} )}
</Menu> </Menu>
} }
withoutCurrentColor
/> />
</Container> </Container>
<Container width={'35%'}> <Container width={'35%'}>

View File

@ -34,6 +34,7 @@ interface GitspaceSelectProps {
formInputClassName?: string formInputClassName?: string
loading?: boolean loading?: boolean
buttonClassName?: string buttonClassName?: string
withoutCurrentColor?: boolean
} }
export const GitspaceSelect = ({ export const GitspaceSelect = ({
@ -46,7 +47,8 @@ export const GitspaceSelect = ({
formikName, formikName,
tooltipProps, tooltipProps,
buttonClassName, buttonClassName,
formInputClassName formInputClassName,
withoutCurrentColor
}: GitspaceSelectProps) => { }: GitspaceSelectProps) => {
const { getString } = useStrings() const { getString } = useStrings()
const buttonRef = useRef<HTMLDivElement | null>(null) const buttonRef = useRef<HTMLDivElement | null>(null)
@ -102,6 +104,7 @@ export const GitspaceSelect = ({
{...iconProp} {...iconProp}
{...addTooltipProps} {...addTooltipProps}
disabled={disabled} disabled={disabled}
withoutCurrentColor={withoutCurrentColor}
/> />
</div> </div>
) )

View File

@ -35,7 +35,7 @@ import { SelectInfraProvider } from 'cde-gitness/components/SelectInfraProvider/
import { OpenapiCreateGitspaceRequest, useCreateGitspace } from 'services/cde' import { OpenapiCreateGitspaceRequest, useCreateGitspace } from 'services/cde'
import { useGetCDEAPIParams } from 'cde-gitness/hooks/useGetCDEAPIParams' import { useGetCDEAPIParams } from 'cde-gitness/hooks/useGetCDEAPIParams'
import { GitnessRepoImportForm } from 'cde-gitness/components/GitnessRepoImportForm/GitnessRepoImportForm' import { GitnessRepoImportForm } from 'cde-gitness/components/GitnessRepoImportForm/GitnessRepoImportForm'
import { EnumGitspaceCodeRepoType } from 'cde-gitness/constants' import { EnumGitspaceCodeRepoType, StandaloneIDEType } from 'cde-gitness/constants'
import { CDESSHSelect } from 'cde-gitness/components/CDESSHSelect/CDESSHSelect' import { CDESSHSelect } from 'cde-gitness/components/CDESSHSelect/CDESSHSelect'
import { useQueryParams } from 'hooks/useQueryParams' import { useQueryParams } from 'hooks/useQueryParams'
import { gitnessFormInitialValues } from './GitspaceCreate.constants' import { gitnessFormInitialValues } from './GitspaceCreate.constants'
@ -218,7 +218,7 @@ export const CDECreateGitspace = () => {
</Container> </Container>
<Container className={css.formOuterContainer}> <Container className={css.formOuterContainer}>
<CDEIDESelect onChange={formik.setFieldValue} selectedIde={formik.values.ide} /> <CDEIDESelect onChange={formik.setFieldValue} selectedIde={formik.values.ide} />
<CDESSHSelect /> {formik.values.ide === StandaloneIDEType.VSCODE && <CDESSHSelect />}
<SelectInfraProvider /> <SelectInfraProvider />
<Button width={'100%'} variation={ButtonVariation.PRIMARY} height={50} type="submit"> <Button width={'100%'} variation={ButtonVariation.PRIMARY} height={50} type="submit">
{getString('cde.createGitspace')} {getString('cde.createGitspace')}