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
pull/3545/head
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 * as Yup from 'yup'
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'`}
name="sshKeyValue"
label="SSH Key"
isOptional
className={css.sshKeyValue}
/>
<Layout.Horizontal spacing="large">

View File

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

View File

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

View File

@ -50,7 +50,7 @@ const RepositoryText = ({
return (
<Layout.Horizontal spacing={'medium'} flex={{ justifyContent: 'flex-start', alignItems: 'center' }}>
{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} />
)}
@ -271,6 +271,7 @@ export const GitnessRepoImportForm = ({ isCDE }: { isCDE?: boolean }) => {
)}
</Menu>
}
withoutCurrentColor
/>
</Container>
<Container width={'35%'}>

View File

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

View File

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