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: update the API for CustomInput #2474

Open
wants to merge 34 commits into
base: feat/info-bar
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9d43b19
refactor: typing clean up for custom input
eshankvaish Jan 29, 2025
a458472
feat: add storybook for text field
eshankvaish Jan 29, 2025
3b807cd
fix: styling issues on login page
eshankvaish Jan 29, 2025
5a27b42
refactor: code clean up
eshankvaish Jan 29, 2025
360ec02
feat: add util classes
eshankvaish Jan 30, 2025
947cfcc
Merge branch 'feat/fe-enhancements' of github.com:devtron-labs/dashbo…
eshankvaish Jan 30, 2025
00ca8f0
fix: padding in host url input
eshankvaish Jan 30, 2025
6202055
Revert "feat: add util classes"
eshankvaish Jan 30, 2025
08d1f38
fix: typing in button stories
eshankvaish Jan 31, 2025
b86660d
feat: add support for end icon
eshankvaish Jan 31, 2025
9e5b93e
refactor: remove unused styling
eshankvaish Jan 31, 2025
5ab4087
fix: styling issues
eshankvaish Jan 31, 2025
217e75e
feat: stories for password field
eshankvaish Jan 31, 2025
e79c30c
feat: update storybook with tooltip label
eshankvaish Jan 31, 2025
eaeddf6
refactor: replace Protected Input with PasswordField
eshankvaish Jan 31, 2025
3b6f722
chore: version bump
eshankvaish Jan 31, 2025
65a6277
refactor: update select in docker and label
eshankvaish Jan 31, 2025
87b0528
refactor: usage of custom input
eshankvaish Jan 31, 2025
9c7b9c0
Merge branch 'develop' of github.com:devtron-labs/dashboard into feat…
eshankvaish Feb 13, 2025
d09cbd8
Merge branch 'develop' of github.com:devtron-labs/dashboard into feat…
eshankvaish Feb 13, 2025
8986a74
fix: custom input
eshankvaish Feb 13, 2025
fdf97f8
fix: update the select in ephemeral container drawer
eshankvaish Feb 13, 2025
b0fd0ea
fix: story book issues
eshankvaish Feb 14, 2025
9364e73
feat: update select and input in custom logs modal
eshankvaish Feb 14, 2025
0cdcba6
Merge branch 'feat/info-bar' of github.com:devtron-labs/dashboard int…
eshankvaish Feb 14, 2025
363a16c
Merge branch 'feat/info-bar' of github.com:devtron-labs/dashboard int…
eshankvaish Feb 14, 2025
677c788
fix: update custom input in gitops configuration
eshankvaish Feb 14, 2025
eb15c41
fix: styling in webhook details modal
eshankvaish Feb 14, 2025
82be184
fix: missing props for custom input usage
eshankvaish Feb 14, 2025
46728d0
refactor: replace with custom input
eshankvaish Feb 14, 2025
14f0360
fix: remove label
eshankvaish Feb 14, 2025
2521c18
fix: error state in create chart group
eshankvaish Feb 14, 2025
afa6e2c
fix: alignment issue in task detail
eshankvaish Feb 14, 2025
6a4974d
feat: update readme
eshankvaish Feb 14, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const CreateAPIToken = ({
onChange={onChangeHandler}
error={formDataErrorObj.invalidName && formDataErrorObj.invalidNameMessage}
label="Name"
isRequiredField
required
/>
<Textarea
label="Description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ const EditAPIToken = ({
<div className="flexbox-col dc__gap-16">
{renderRegenerateInfoBar()}
<CustomInput
placeholder="Enter name"
label="Name"
data-testid="api-token-name-textbox"
value={editData.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const PermissionGroupForm = ({ isAddMode }: { isAddMode: boolean }) => {
value={name.value}
data-testid="permission-group-name-textbox"
onChange={handleGroupNameChange}
isRequiredField
required
error={name.error}
placeholder="Eg. Project managers"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,10 +798,10 @@ class SSOLogin extends Component<SSOLoginProps, SSOLoginState> {
<CustomInput
value={this.state.ssoConfig.url || window.__ORCHESTRATOR_ROOT__}
onChange={this.handleURLChange}
data-testid="sso-url-input"
name="sso-url"
label="URL"
isRequiredField
placeholder="Enter URL"
required
error={this.state.isError.url}
/>
<div className="flex left fw-4 pt-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
ButtonVariantType,
ButtonStyleType,
ResourceListPayloadType,
SelectPickerOptionType,
} from '@devtron-labs/devtron-fe-common-lib'
import { K8S_EMPTY_GROUP } from '@Components/ResourceBrowser/Constants'
import {
Expand Down Expand Up @@ -79,7 +80,7 @@ const K8sListItemCard = ({
}: K8sListItemCardType) => {
const { customRoles } = useAuthorizationContext()
const { showStatus, userStatus } = usePermissionConfiguration()
const [clusterOptions, setClusterOptions] = useState<OptionType[]>([])
const [clusterOptions, setClusterOptions] = useState<SelectPickerOptionType<string>[]>([])
const [processedData, setProcessedData] = useState<Map<string, K8SObjectType>>()
const [allInKindMapping, setAllInKindMapping] = useState<OptionType[]>([])
const [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,29 +258,26 @@
<div className="dc__overflow-auto p-20 flex-grow-1">
<div className="mb-16">
<CustomInput
dataTestid="environment-name"
labelClassName="dc__required-field"
disabled={!!environmentName}
placeholder={id ? 'sample-env-name' : 'Eg. production'}
value={data.environmentName}
error={errors.environmentName}
{...register('environmentName')}
label="Environment Name"
autoFocus={!id}
noTrim
shouldTrim={false}

Check failure on line 268 in src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/ClusterEnvironmentDrawer.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ label: string; autoFocus: boolean; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ClusterEnvironmentDrawerFormProps; disabled: boolean; placeholder: string; value: string; error: string[]; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
</div>
<div className="mb-16">
<CustomInput
dataTestid="enter-namespace"
labelClassName={isVirtual ? '' : 'dc__required-field'}
disabled={!!namespace}
placeholder={id ? 'sample-namespace' : 'Eg. prod'}
value={data.namespace}
error={errors.namespace}
{...register('namespace')}
label="Namespace"
noTrim
shouldTrim={false}

Check failure on line 279 in src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/ClusterEnvironmentDrawer.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ label: string; shouldTrim: boolean; required: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ClusterEnvironmentDrawerFormProps; disabled: boolean; placeholder: string; value: string; error: string[]; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
required={isVirtual}
eshankvaish marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
{!isVirtual && (
Expand Down Expand Up @@ -317,7 +314,7 @@
{...register('description')}
label="Description (Maximum 40 characters allowed)"
autoFocus={!!id}
noTrim
shouldTrim={false}

Check failure on line 317 in src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/ClusterEnvironmentDrawer.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ label: string; autoFocus: boolean; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ClusterEnvironmentDrawerFormProps; placeholder: string; value: string; error: string[]; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
</div>
{EnvironmentLabels && !isVirtual && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,16 @@
</div>
)}
<div>
<div>
<CustomInput
label="Chart Name"
name="chartName"
onChange={noop}
rootClassName="w-100 br-4 en-2 bw-1 mt-6 form__input"
disabled
value={chartDetail.chartName}
isRequiredField
/>
</div>
<CustomInput
placeholder="Enter chart name"
label="Chart Name"
name="chartName"
onChange={noop}
fullWidth

Check failure on line 158 in src/Pages/GlobalConfigurations/DeploymentCharts/List/UploadChartModal.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ placeholder: string; label: string; name: string; onChange: (...args: any[]) => any; fullWidth: true; disabled: true; value: string; required: true; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
disabled
value={chartDetail.chartName}
required
/>
<div className="mt-16">
<Textarea
placeholder="Enter description"
Expand Down
20 changes: 7 additions & 13 deletions src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@
label="Name"
placeholder={`Eg. ${!data.isSecret ? 'sample-configmap' : 'sample-secret'}`}
disabled={!isCreateView || isFormDisabled}
isRequiredField
required
error={errors.name}
noTrim
shouldTrim={false}

Check failure on line 172 in src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ autoFocus: true; value: string; "data-testid": string; label: string; placeholder: string; disabled: boolean; required: true; error: string[]; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ConfigMapSecretUseFormProps; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
)

Expand Down Expand Up @@ -245,11 +245,10 @@
<CustomInput
{...register('externalSubpathValues')}
value={data.externalSubpathValues}
tabIndex={0}
placeholder="Enter keys (Eg. username,configs.json)"
disabled={isFormDisabled}
error={errors.externalSubpathValues}
noTrim
shouldTrim={false}

Check failure on line 251 in src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ value: string; placeholder: string; disabled: boolean; error: string[]; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ConfigMapSecretUseFormProps; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
</div>
)}
Expand Down Expand Up @@ -287,13 +286,10 @@
<CustomInput
value={data.filePermission}
{...register('filePermission')}
autoComplete="off"
tabIndex={0}
dataTestid="configmap-file-permission-textbox"
placeholder="eg. 0400 or 400"
disabled={isFormDisabled || isChartVersion309OrBelow}
error={errors.filePermission}
noTrim
shouldTrim={false}

Check failure on line 292 in src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ placeholder: string; disabled: boolean; error: string[]; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ConfigMapSecretUseFormProps; value: string; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
</div>
)}
Expand All @@ -311,8 +307,8 @@
helperText="Keys are mounted as files to volume"
disabled={isFormDisabled}
error={errors.volumeMountPath}
isRequiredField
noTrim
required
shouldTrim={false}

Check failure on line 311 in src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ label: string; value: string; placeholder: string; helperText: string; disabled: boolean; error: string[]; required: true; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ConfigMapSecretUseFormProps; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
{renderSubPath()}
{renderFilePermission()}
Expand All @@ -323,15 +319,13 @@
(isHashiOrAWS || isESO) && (
<div className="w-50">
<CustomInput
dataTestid="enter-role-ARN"
{...register('roleARN')}
value={data.roleARN}
autoComplete="off"
label="Role ARN"
placeholder="Enter Role ARN"
disabled={isFormDisabled}
error={errors.roleARN}
noTrim
shouldTrim={false}

Check failure on line 328 in src/Pages/Shared/ConfigMapSecret/ConfigMapSecretForm.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ value: string; label: string; placeholder: string; disabled: boolean; error: string[]; shouldTrim: boolean; onChange: (e: any) => void; onBlur: () => void; onFocus: () => void; name: keyof ConfigMapSecretUseFormProps; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
/>
</div>
)
Expand Down
3 changes: 1 addition & 2 deletions src/components/ApplicationGroup/CreateAppGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,12 @@ export default function CreateAppGroup({
<div className="form__row mb-16">
<CustomInput
label="Name"
tabIndex={1}
placeholder="Enter filter name"
value={appGroupName}
name="name"
onChange={onInputChange}
disabled={selectedAppGroup && !!selectedAppGroup.value}
isRequiredField
required
error={showErrorMsg && nameErrorMessage()}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function BulkSourceChange({
<div className="p-20">
<div className="form__row">
<CustomInput
labelClassName="dc__required-field"
required
name="branch_name"
disabled={false}
value={branchName}
Expand Down
4 changes: 1 addition & 3 deletions src/components/CIPipelineN/Build.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,12 @@ export const Build = ({
<CustomInput
name="name"
label="Pipeline Name"
data-testid="build-pipeline-name-textbox"
autoComplete="off"
disabled={!!ciPipeline?.id}
placeholder="e.g. my-first-pipeline"
type="text"
value={formData.name}
onChange={handlePipelineName}
isRequiredField
required
error={formDataErrorObj.name && !formDataErrorObj.name.isValid && formDataErrorObj.name.message}
/>
</label>
Expand Down
18 changes: 8 additions & 10 deletions src/components/CIPipelineN/ConditionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,14 @@ export const ConditionContainer = ({ type }: { type: ConditionContainerType }) =
options={operatorOptions}
isSearchable={false}
/>
<div className="fs-13">
<CustomInput
name="conditionalValue"
rootClassName="w-100 en-2 bw-1 pl-10 pr-10 pt-6 pb-6 br-4 h-32"
value={conditionDetail.conditionalValue}
onChange={(e) => {
handleConditionalValueChange(e, index)
}}
/>
</div>
<CustomInput
placeholder="Enter value"
name="conditionalValue"
value={conditionDetail.conditionalValue}
eshankvaish marked this conversation as resolved.
Show resolved Hide resolved
onChange={(e) => {
handleConditionalValueChange(e, index)
}}
/>
<Close
className="icon-dim-24 pointer mt-4"
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const CreatePluginFormContent = ({
action={CreatePluginActionType.UPDATE_PLUGIN_VERSION}
handleChange={handleChange}
helperText={
<span className="fs-11">
<span>
Using&nbsp;
<a
href={SEMANTIC_VERSION_DOCUMENTATION_LINK}
Expand All @@ -289,7 +289,6 @@ const CreatePluginFormContent = ({
}
placeholder="Eg. 1.0.0"
required
eshankvaish marked this conversation as resolved.
Show resolved Hide resolved
labelClassName="w-100"
/>

{/* Documentation Link */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { SyntheticEvent, useCallback } from 'react'
import { SyntheticEvent } from 'react'
import { CustomInput, Textarea } from '@devtron-labs/devtron-fe-common-lib'
import { CreatePluginFormFieldProps } from './types'

Expand All @@ -30,16 +30,7 @@ const CreatePluginFormField = ({
useTextArea,
helperText,
autoFocus,
labelClassName,
}: CreatePluginFormFieldProps) => {
const callbackRef = useCallback((inputElement) => {
if (inputElement && autoFocus) {
setTimeout(() => {
inputElement.focus()
}, 100)
}
}, [])

const handleInputChange = (e: SyntheticEvent) => {
handleChange({ action, payload: (e.target as HTMLInputElement).value })
}
Expand Down Expand Up @@ -68,14 +59,10 @@ const CreatePluginFormField = ({
error={error}
onChange={handleInputChange}
placeholder={placeholder}
isRequiredField={required}
required={required}
disabled={disabled}
dataTestid={action}
autoFocus={autoFocus}
helperText={helperText}
rootClassName="h-36"
labelClassName={labelClassName}
inputProps={{ ref: callbackRef } as React.InputHTMLAttributes<HTMLInputElement>}
/>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CIPipelineN/CreatePluginModal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ type PluginTextFieldFieldType =
} & Pick<CustomInputProps, 'helperText' | 'autoFocus'>)

export type CreatePluginFormFieldProps = Pick<CreatePluginFormContentProps, 'handleChange'> &
Pick<CustomInputProps, 'placeholder' | 'label' | 'value' | 'error' | 'required' | 'disabled' | 'labelClassName'> & {
Pick<CustomInputProps, 'placeholder' | 'label' | 'value' | 'error' | 'required' | 'disabled'> & {
action: CreatePluginSingleInputActionType
} & PluginTextFieldFieldType

Expand Down
4 changes: 0 additions & 4 deletions src/components/CIPipelineN/DockerArgs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ const DockerArgsItem: FunctionComponent<DockerArgsItemProps> = ({
<CustomInput
name="arg-key"
data-testid={fromBuildPack ? `build-pack-build-env-key${index}` : `docker-arg-key-${index}`}
rootClassName={`w-100 dc__top-radius-4 pl-10 pr-10 pt-6 pb-6 en-2 bw-1 ${
readOnly ? 'cursor-not-allowed' : ''
}`}
autoComplete="off"
placeholder="Key"
type="text"
value={arg.key}
Expand Down
10 changes: 6 additions & 4 deletions src/components/CIPipelineN/MountFromHost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,19 @@
<div className="mount-row mb-4 mt-4">
<div className="fw-6 fs-13 lh-32 cn-7 " />
<CustomInput
data-testid="script-mount-host-file-path-host"
rootClassName="bcn-1 en-2 bw-1 pl-10 pr-10 pt-6 pb-6 dc__left-radius-4 dc__no-right-border"
borderRadiusConfig={{

Check failure on line 72 in src/components/CIPipelineN/MountFromHost.tsx

View workflow job for this annotation

GitHub Actions / ci

Type '{ borderRadiusConfig: { right: boolean; }; placeholder: string; onChange: (e: any) => void; value: any; name: string; }' is not assignable to type 'IntrinsicAttributes & CustomInputProps'.
right: false,
}}
placeholder="File path on Host"
onChange={(e) => handleMountPath(e, index)}
value={mountPathMap[MountPathMap.FILEPATHONDISK]}
name={MountPathMap.FILEPATHONDISK}
/>
<div className="flex bw-1 en-2">:</div>
<CustomInput
data-testid="script-mount-host-file-path-container"
rootClassName="bcn-1 en-2 bw-1 pl-10 pr-10 pt-6 pb-6 dc__right-radius-4 dc__no-left-border"
borderRadiusConfig={{
left: false,
}}
placeholder="File path on container"
onChange={(e) => handleMountPath(e, index)}
value={mountPathMap[MountPathMap.FILEPATHONCONTAINER]}
Expand Down
2 changes: 0 additions & 2 deletions src/components/CIPipelineN/OutputDirectoryPath.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ const OutputDirectoryPath = () => {
return (
<div className="custom-script__output-directory pl-220 mt-8" key={`output-directory-${index}`}>
<CustomInput
data-testid="output-directory-path-add-path-textbox"
rootClassName="w-100 br-4 en-2 bw-1 pl-10 pr-10 pt-5 pb-5"
placeholder="Enter directory path"
eshankvaish marked this conversation as resolved.
Show resolved Hide resolved
value={elm}
onChange={(e) => handleStoreArtifact(e, index)}
Expand Down
8 changes: 3 additions & 5 deletions src/components/CIPipelineN/TaskDetailComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,20 @@ export const TaskDetailComponent = () => {
<div className="p-20 dc__overflow-auto">
<div>
<div className="row-container mb-12">
<div className="fw-6 fs-13 lh-32 cn-7 dc__required-field">Task name</div>
<CustomInput
rootClassName="w-100 br-4 en-2 bw-1 pl-10 pr-10 pt-5-imp pb-5-imp"
data-testid="preBuild-task-name-textbox"
type="text"
onChange={(e) => handleNameChange(e)}
value={selectedStep.name}
name="task-name"
placeholder="Enter task name"
label="Task name"
error={renderTaskNameError()}
required
/>
</div>
<div className="row-container mb-12">
<div className="fw-6 fs-13 lh-32 cn-7 ">Description</div>
<CustomInput
rootClassName="w-100 br-4 en-2 bw-1 pl-10 pr-10 pt-5-imp pb-5-imp"
data-testid="preBuild-task-description-textbox"
type="text"
onChange={(e) => handleDescriptionChange(e)}
value={selectedStep.description}
Expand Down
Loading
Loading