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

feat: replace select v4 #2061

Merged
merged 53 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
456b0f1
chore: build cd
shivani170 Sep 18, 2024
cdb3351
Merge branch 'feat/replace-select-picker-v3' into feat/replace-select-v4
shivani170 Sep 18, 2024
21b4b92
chore: Environment list select added
shivani170 Sep 18, 2024
7b3cc56
chore: Build pack self docker form select added
shivani170 Sep 18, 2024
11c793b
fix: buildpack create docker file all select replacement
shivani170 Sep 18, 2024
c089ed3
chore: environment nav option type in app group configuration
shivani170 Sep 23, 2024
b81c261
chore: environment nav option type in jobs configuration
shivani170 Sep 23, 2024
6bfc4f9
chore: Linked CI Modal environment select
shivani170 Sep 23, 2024
842e3b4
Merge branch 'develop' into feat/replace-select-v4
shivani170 Sep 23, 2024
955891e
fix: environment list type added in ci & cd pipeline
shivani170 Sep 23, 2024
cb54114
chore: Expiration select issue fix in api token
shivani170 Sep 23, 2024
976fc0e
chore: environment nav configuration in job fix
shivani170 Sep 23, 2024
bbeb1a2
fix: option type updated
shivani170 Sep 23, 2024
9157497
chore: helm manifest push registry select replaced from cd build
shivani170 Sep 24, 2024
bde84b7
Merge branch 'develop' into feat/replace-select-v4
shivani170 Sep 26, 2024
18875e6
Merge branch 'feat/replace-select-v4' into feat/replace-select-v5
shivani170 Sep 26, 2024
61e4f61
chore: code refactoring
shivani170 Sep 30, 2024
a5aa8db
chore: added fix for type of createClusterEnvGroup
shivani170 Sep 30, 2024
0054d83
Merge branch 'develop' into feat/replace-select-v4
shivani170 Sep 30, 2024
4439df2
chore: buildPack select fixes
shivani170 Sep 30, 2024
0d49484
chore: buildPack docker select css modification
shivani170 Sep 30, 2024
030c71c
chore: app details dropdown added
shivani170 Sep 30, 2024
8cd301a
chore: base config map default value fix
shivani170 Sep 30, 2024
fd47299
chore: css fixes of buildpack select
shivani170 Sep 30, 2024
d91d3a4
chore: creatable select replaced in app metrices & task
shivani170 Oct 1, 2024
1ed48fa
Merge branch 'feat/replace-select-v5' into feat/replace-select-v4
shivani170 Oct 1, 2024
d00f443
chore: REMOVED UNUSED CODE
shivani170 Oct 1, 2024
28379a3
chore: version bump
shivani170 Oct 1, 2024
1b5efee
chore: code feedback
shivani170 Oct 1, 2024
5423c20
chore: updated environment list
shivani170 Oct 1, 2024
8b22422
chore: terminal css fixes
shivani170 Oct 1, 2024
3e40ae4
chore: css of Min Size reduces to 56px from 100px > assignment operat…
shivani170 Oct 1, 2024
1aefbec
Merge branch 'develop' into feat/replace-select-v4
shivani170 Oct 3, 2024
0b7ff7d
chore: version bump
shivani170 Oct 3, 2024
225adb9
chore: creatable changes reverted
shivani170 Oct 1, 2024
bcb609e
Merge branch 'develop' into feat/replace-select-v4
shivani170 Oct 3, 2024
b20c80d
chore: environment data issue fix in app group
shivani170 Oct 3, 2024
c6b77cc
chore: version update
shivani170 Oct 3, 2024
6d5ecfa
Merge branch 'develop' into feat/replace-select-v4
shivani170 Oct 3, 2024
d196c95
fix: Isse in build context
shivani170 Oct 4, 2024
d54bdff
chore: console removed
shivani170 Oct 4, 2024
6d8e23a
chore: updated value type in environment list of build cd
shivani170 Oct 4, 2024
93ca40a
chore: updated value type in environment list of build cd
shivani170 Oct 4, 2024
7507bd6
chore: parsing value added
shivani170 Oct 7, 2024
6a7f553
chore: version update
shivani170 Oct 7, 2024
f8dbf80
chore: version update
shivani170 Oct 7, 2024
328cfd6
chore: package update
shivani170 Oct 7, 2024
24d2a58
chore: fixed creatable select for container image
shivani170 Oct 7, 2024
e0b5cfa
chore: fix for git material id
shivani170 Oct 7, 2024
0019643
Merge branch 'develop' into feat/replace-select-v4
shivani170 Oct 7, 2024
c6212c5
chore: delete
shivani170 Oct 7, 2024
e371442
chore: removed console
shivani170 Oct 7, 2024
15a4354
chore version update
shivani170 Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "4.0.1",
"@devtron-labs/devtron-fe-common-lib": "4.0.1-beta-3",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { useEffect, useState } from 'react'
import { useRouteMatch, useLocation, NavLink, useHistory } from 'react-router-dom'
import Tippy from '@tippyjs/react'
import ReactSelect from 'react-select'

import { CollapsibleList, CollapsibleListConfig, EnvResourceType } from '@devtron-labs/devtron-fe-common-lib'
import {
CollapsibleList,
CollapsibleListConfig,
EnvResourceType,
SelectPicker,
SelectPickerOptionType,
SelectPickerVariantType,
} from '@devtron-labs/devtron-fe-common-lib'

import { ReactComponent as ICBack } from '@Icons/ic-caret-left-small.svg'
import { ReactComponent as ICAdd } from '@Icons/ic-add.svg'
Expand All @@ -16,7 +22,6 @@ import { ResourceConfigState } from '@Pages/Applications/DevtronApps/service.typ
import { BASE_CONFIGURATIONS } from '../AppConfig.constants'
import { EnvConfigRouteParams, EnvConfigurationsNavProps, EnvConfigObjectKey } from '../AppConfig.types'
import { getEnvConfiguration, getNavigationPath, resourceTypeBasedOnPath } from './Navigation.helper'
import { EnvSelectDropdownIndicator, envSelectStyles, EnvSelectOption } from './EnvSelect.utils'

const CompareWithButton = importComponentFromFELibrary('CompareWithButton', null, 'function')

Expand Down Expand Up @@ -59,15 +64,26 @@ export const EnvConfigurationsNav = ({
// CONSTANTS
const { isLoading, config } = envConfig
/** Current Environment Data. */
const environmentData =
environments.find((environment) => environment.id === +params[paramToCheck]) ||
(showBaseConfigurations
? {
name: BASE_CONFIGURATIONS.name,
id: BASE_CONFIGURATIONS.id,
isProtected: isBaseConfigProtected,
}
: null)
const _environmentData =
environments && environments.find((environment) => environment.id === +params[paramToCheck])
const selectedNavEnvironmentOptions = {
..._environmentData,
label: _environmentData?.name || BASE_CONFIGURATIONS.name,
value: _environmentData?.id || BASE_CONFIGURATIONS.id,
isProtected: _environmentData?.isProtected,
}

const selectedEnvironmentWithBaseConfiguration = showBaseConfigurations
? {
label: BASE_CONFIGURATIONS.name,
value: BASE_CONFIGURATIONS.id,
endIcon: isBaseConfigProtected && <ProtectedIcon className="icon-dim-20 fcv-5 dc__no-shrink" />,
isProtected: isBaseConfigProtected,
}
: null

const environmentData = selectedNavEnvironmentOptions || selectedEnvironmentWithBaseConfiguration

const resourceType = resourceTypeBasedOnPath(pathname)
const isCreate = pathname.includes('/create')

Expand All @@ -81,7 +97,7 @@ export const EnvConfigurationsNav = ({
..._updatedEnvConfig[envConfigKey],
{
title: 'Unnamed',
href: getNavigationPath(path, params, environmentData.id, resourceType, 'create', paramToCheck),
href: getNavigationPath(path, params, environmentData.value, resourceType, 'create', paramToCheck),
configState: ResourceConfigState.Unnamed,
subtitle: '',
},
Expand Down Expand Up @@ -156,7 +172,7 @@ export const EnvConfigurationsNav = ({
return
}
setExpandedIds({ ...expandedIds, [_resourceType]: true })
history.push(getNavigationPath(path, params, environmentData.id, _resourceType, 'create', paramToCheck))
history.push(getNavigationPath(path, params, environmentData.value, _resourceType, 'create', paramToCheck))
}

/** Collapsible List Config. */
Expand Down Expand Up @@ -214,26 +230,33 @@ export const EnvConfigurationsNav = ({
]

// REACT SELECT PROPS
const envOptions = [
const getSelectOptions = () =>
[...environments].map((env) => ({
label: env.name,
value: env.id,
endIcon: env.isProtected ? <ProtectedIcon className="icon-dim-20 fcv-5 dc__no-shrink" /> : null,
}))

const envOptions: SelectPickerOptionType[] = [
...(showBaseConfigurations
? [
{
name: BASE_CONFIGURATIONS.name,
id: BASE_CONFIGURATIONS.id,
isProtected: isBaseConfigProtected,
label: BASE_CONFIGURATIONS.name,
value: BASE_CONFIGURATIONS.id,
endIcon: isBaseConfigProtected && <ProtectedIcon className="icon-dim-20 fcv-5 dc__no-shrink" />,
},
]
: []),
...environments,
...getSelectOptions(),
]

const onEnvSelect = ({ id }: typeof environmentData) => {
if (environmentData.id === id) {
const onEnvSelect = (_selectedEnv) => {
if (environmentData.value === _selectedEnv.value) {
return
}

const name = pathname.split(`${resourceType}/`)[1]
history.push(getNavigationPath(path, params, id, resourceType, name, paramToCheck))
history.push(getNavigationPath(path, params, _selectedEnv.value, resourceType, name, paramToCheck))
}

const renderEnvSelector = () => (
Expand All @@ -243,28 +266,23 @@ export const EnvConfigurationsNav = ({
<ICBack className="icon-dim-16" />
</div>
</NavLink>
<ReactSelect<typeof environmentData>
<SelectPicker
inputId="env-config-selector"
classNamePrefix="env-config-selector"
isClearable={false}
value={environmentData}
options={envOptions}
getOptionLabel={(option) => `${option.name}`}
getOptionValue={(option) => `${option.id}`}
styles={envSelectStyles}
components={{
IndicatorSeparator: null,
Option: EnvSelectOption,
DropdownIndicator: EnvSelectDropdownIndicator,
}}
getOptionLabel={(option) => `${option.label}`}
getOptionValue={(option) => `${option.value}`}
onChange={onEnvSelect}
placeholder="Select Environment"
variant={SelectPickerVariantType.BORDER_LESS}
/>
{environmentData?.isProtected && <ProtectedIcon className="icon-dim-20 fcv-5 dc__no-shrink" />}
</div>
)

const renderCompareWithBtn = () => {
const { name: compareTo } = environmentData
const { label: compareTo } = environmentData

// Determine base path based on pathname
const isOverrideConfig = pathname.includes(URLS.APP_ENV_OVERRIDE_CONFIG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import React, { useState, useEffect, Fragment } from 'react'
import { useState, useEffect, Fragment } from 'react'
import { useParams, useLocation, useRouteMatch, NavLink, Link } from 'react-router-dom'
import {
EnvResourceType,
Expand All @@ -27,22 +27,19 @@ import {
getEnvironmentListMinPublic,
ToastVariantType,
ToastManager,
SelectPicker,
} from '@devtron-labs/devtron-fe-common-lib'
import ReactSelect, { ValueContainerProps, components } from 'react-select'
import { URLS, DOCUMENTATION } from '../../../../../../config'
import { usePrevious, createClusterEnvGroup } from '../../../../../../components/common'
import { addJobEnvironment, deleteJobEnvironment, getCIConfig } from '../../../../../../services/service'
import { ReactComponent as Help } from '../../../../../../assets/icons/ic-help.svg'
import { ReactComponent as Add } from '../../../../../../assets/icons/ic-add.svg'
import { ReactComponent as Search } from '../../../../../../assets/icons/ic-search.svg'
import { ReactComponent as More } from '../../../../../../assets/icons/ic-more-option.svg'
import { ReactComponent as DeleteIcon } from '../../../../../../assets/icons/ic-delete-interactive.svg'
import { ReactComponent as ProtectedIcon } from '../../../../../../assets/icons/ic-shield-protect-fill.svg'
import warn from '../../../../../../assets/icons/ic-warning.svg'
import { JobEnvOverrideRouteProps } from '../AppConfig.types'
import { groupHeading } from '../../../../../../components/CIPipelineN/Constants'
import { RESOURCE_ACTION_MENU } from '../../../../../../components/ResourceBrowser/Constants'
import { groupStyle } from '../../../../../../components/v2/common/ReactSelect.utils'
import { renderNavItem } from './Navigation.helper'
import { useAppConfigurationContext } from '../AppConfiguration.provider'

Expand Down Expand Up @@ -207,23 +204,6 @@ const JobEnvOverrideRoute = ({ envOverride, ciPipelines, reload, isEnvProtected
)
}

const ValueContainer = (props: ValueContainerProps) => {
const { selectProps, children } = props
return (
<components.ValueContainer {...props}>
{!selectProps.inputValue ? (
<>
<Search className="dc__position-abs icon-dim-18 ml-8 mw-18" />
<span className="dc__position-abs dc__left-35 cn-5 ml-2">{selectProps.placeholder}</span>
</>
) : (
<Search className="dc__position-abs icon-dim-18 ml-8 mw-18" />
)}
<span className="dc__position-abs dc__left-30 cn-5 ml-2">{React.cloneElement(children[1])}</span>
</components.ValueContainer>
)
}

const EnvironmentOverrideRouter = () => {
const { pathname } = useLocation()
const { appId } = useParams<{ appId: string }>()
Expand Down Expand Up @@ -311,43 +291,19 @@ const EnvironmentOverrideRouter = () => {
}

const renderEnvSelector = (): JSX.Element => (
<ReactSelect
<SelectPicker
inputId="job-pipeline-environment-dropdown"
autoFocus
menuIsOpen
isSearchable
menuPlacement="auto"
closeMenuOnScroll
placeholder="Select Environment"
classNamePrefix="job-pipeline-environment-dropdown"
options={environmentOptions}
value={environmentOptions.find((env) => env.id === -1)}
getOptionLabel={(option) => `${option.name}`}
getOptionValue={(option) => `${option.id}`}
isMulti={false}
value={environmentOptions.find((env) => env.value === -1)}
getOptionLabel={(option) => `${option.label}`}
getOptionValue={(option) => `${option.value}`}
onChange={selectEnvironment}
onBlur={handleAddEnvironment}
components={{
IndicatorSeparator: null,
DropdownIndicator: null,
GroupHeading: groupHeading,
ValueContainer,
}}
styles={{
...groupStyle(),
control: (base) => ({
...base,
border: '1px solid #d6dbdf',
minHeight: '20px',
height: '30px',
marginTop: '4px',
width: '100%',
}),
container: (base) => ({
...base,
paddingRight: '0px',
}),
valueContainer: (base) => ({ ...base, height: '28px', padding: '0px 8px' }),
}}
/>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
CustomNavItemsType,
EnvConfigRouteParams,
EnvConfigType,
EnvironmentOptionType,
ExtendedCollapsibleListItem,
EnvConfigObjectKey,
} from '../AppConfig.types'
Expand Down Expand Up @@ -115,7 +114,7 @@ export const getEnvConfiguration = (
envConfig: EnvConfigType,
basePath: string,
params: EnvConfigRouteParams,
{ id, isProtected }: EnvironmentOptionType,
{ value: id, isProtected },
paramToCheck: 'appId' | 'envId' = 'envId',
): {
deploymentTemplate: ExtendedCollapsibleListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,30 @@
*/

/* eslint-disable react/prop-types */
import ReactSelect from 'react-select'
import moment from 'moment'
import { InfoColourBar, multiSelectStyles } from '@devtron-labs/devtron-fe-common-lib'
import { InfoColourBar, SelectPicker } from '@devtron-labs/devtron-fe-common-lib'
import { MomentDateFormat } from '../../../../config'
import { SingleDatePickerComponent } from '../../../../components/common'
import { DropdownIndicator } from '../../../../components/security/security.util'
import { getOptions, getDateInMilliseconds } from './apiToken.utils'
import { Option } from '../../../../components/v2/common/ReactSelect.utils'
import { ReactComponent as Warn } from '../../../../assets/icons/ic-warning.svg'

const ExpirationDate = ({ selectedExpirationDate, onChangeSelectFormData, handleDatesChange, customDate }) => (
<div className="w-100">
<span className="form__label dc__required-field">Expiration</span>
<div className="flex left">
<ReactSelect
value={selectedExpirationDate}
options={getOptions(customDate)}
className="select-width w-200"
classNamePrefix="select-token-expiry-duration"
isSearchable={false}
onChange={onChangeSelectFormData}
components={{
IndicatorSeparator: null,
DropdownIndicator,
Option,
}}
styles={{
...multiSelectStyles,
control: (base) => ({
...base,
minHeight: '36px',
fontWeight: '400',
backgroundColor: 'var(--N50)',
cursor: 'pointer',
}),
dropdownIndicator: (base) => ({
...base,
padding: '0 8px',
}),
}}
/>
<div className="flex left bottom dc__gap-16">
<div className="w-200">
<SelectPicker
label="Expiration"
required
inputId="token-expiry-duration"
value={selectedExpirationDate}
options={getOptions(customDate)}
classNamePrefix="select-token-expiry-duration"
onChange={onChangeSelectFormData}
/>
</div>

{selectedExpirationDate.label !== 'Custom' && selectedExpirationDate.label !== 'No expiration' && (
<span className="ml-16 fs-13 fw-4 cn-9">
<span className="fs-13 fw-4 cn-9">
<span>This token will expire on</span>&nbsp;
{moment(getDateInMilliseconds(selectedExpirationDate.value)).format(MomentDateFormat)}
</span>
Expand Down
7 changes: 0 additions & 7 deletions src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,6 @@ export const ConfigMapSecretForm = React.memo(
return null
}

const trimConfigMapName = (): void => {
dispatch({
type: ConfigMapActionTypes.setConfigName,
payload: { ...state.configName, value: state.configName.value.trim() },
})
}
const renderRollARN = (): JSX.Element => {
if (isHashiOrAWS || isESO) {
return (
Expand Down Expand Up @@ -953,7 +947,6 @@ export const ConfigMapSecretForm = React.memo(
value={state.configName.value}
autoFocus
onChange={onConfigNameChange}
onBlur={trimConfigMapName}
placeholder={componentType === CMSecretComponentType.Secret ? 'secret-name' : 'configmap-name'}
isRequiredField
disabled={!!configMapSecretData?.name}
Expand Down
Loading
Loading