Skip to content

Commit e75b240

Browse files
authored
Merge pull request #460 from devtron-labs/fix/runtime-params
fix: runtime params - UAT and QA Fixes
2 parents d4d4f7c + f722886 commit e75b240

File tree

12 files changed

+74
-31
lines changed

12 files changed

+74
-31
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.2.9",
3+
"version": "1.2.9-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/CIPipeline.Types.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { DynamicDataTableCellValidationState } from '@Shared/Components'
18+
1719
export interface MaterialType {
1820
name: string
1921
type: string
@@ -289,11 +291,30 @@ export interface ErrorObj {
289291
isValid: boolean
290292
message: string | null
291293
}
294+
295+
export enum InputOutputVariablesHeaderKeys {
296+
VARIABLE = 'variable',
297+
FORMAT = 'format',
298+
VALUE = 'val',
299+
}
300+
301+
export type InputOutputVariablesErrorObj = Record<InputOutputVariablesHeaderKeys, DynamicDataTableCellValidationState>
302+
292303
export interface TaskErrorObj {
293304
isValid: boolean
294305
name: ErrorObj
295-
inlineStepDetail?: { inputVariables?: ErrorObj[]; outputVariables?: ErrorObj[]; isValid?: boolean }
296-
pluginRefStepDetail?: { inputVariables?: ErrorObj[]; outputVariables?: ErrorObj[]; isValid?: boolean }
306+
inlineStepDetail?: {
307+
inputVariables?: Record<number, InputOutputVariablesErrorObj>
308+
outputVariables?: Record<number, InputOutputVariablesErrorObj>
309+
isInputVariablesValid?: boolean
310+
isOutputVariablesValid?: boolean
311+
}
312+
pluginRefStepDetail?: {
313+
inputVariables?: Record<number, InputOutputVariablesErrorObj>
314+
outputVariables?: Record<number, InputOutputVariablesErrorObj>
315+
isInputVariablesValid?: boolean
316+
isOutputVariablesValid?: boolean
317+
}
297318
}
298319
export interface FormErrorObjectType {
299320
name: ErrorObj

src/Common/Common.service.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { MutableRefObject } from 'react'
1818
import moment from 'moment'
19-
import { RuntimeParamsAPIResponseType, RuntimeParamsListItemType } from '@Shared/types'
19+
import { RuntimeParamsAPIResponseType, RuntimePluginVariables } from '@Shared/types'
2020
import { getIsManualApprovalSpecific, sanitizeUserApprovalConfig, stringComparatorBySortOrder } from '@Shared/Helpers'
2121
import { get, getIsRequestAborted, post } from './Api'
2222
import { API_STATUS_CODES, GitProviderType, ROUTES } from './Constants'
@@ -324,10 +324,8 @@ const processCDMaterialsApprovalInfo = (enableApproval: boolean, cdMaterialsResu
324324
}
325325
}
326326

327-
export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): RuntimeParamsListItemType[] =>
328-
Object.entries(response?.envVariables || {})
329-
.map(([key, value], index) => ({ key, value, id: index }))
330-
.sort((a, b) => stringComparatorBySortOrder(a.key, b.key))
327+
export const parseRuntimeParams = (response: RuntimeParamsAPIResponseType): RuntimePluginVariables[] =>
328+
(response?.runtimePluginVariables ?? []).map((variable) => ({ ...variable, defaultValue: variable.value }))
331329

332330
const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
333331
if (!cdMaterialsResult) {
@@ -349,7 +347,7 @@ const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
349347
resourceFilters: cdMaterialsResult.resourceFilters ?? [],
350348
totalCount: cdMaterialsResult.totalCount ?? 0,
351349
requestedUserId: cdMaterialsResult.requestedUserId,
352-
runtimeParams: cdMaterialsResult.runtimeParams.runtimePluginVariables ?? [],
350+
runtimeParams: parseRuntimeParams(cdMaterialsResult.runtimeParams),
353351
}
354352
}
355353

src/Common/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ export const DOCUMENTATION = {
3232
}
3333

3434
export const PATTERNS = {
35+
NATURAL_NUMBERS: /^\d*\.?\d*$/,
3536
KUBERNETES_KEY_PREFIX: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/,
3637
KUBERNETES_KEY_NAME: /^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$/,
3738
START_END_ALPHANUMERIC: /^([Az09].*[A-Za-z0-9])$|[A-Za-z0-9]$/,
3839
ALPHANUMERIC_WITH_SPECIAL_CHAR: /^[A-Za-z0-9._-]+$/, // allow alphanumeric,(.) ,(-),(_)
3940
ESCAPED_CHARACTERS: /[.*+?^${}()|[\]\\]/g,
41+
NUMBERS_WITH_SCOPE_VARIABLES: /^(\d+(\.\d+)?|@{{[a-zA-Z0-9-]+}})$/,
4042
}
4143

4244
export const URLS = {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Tippy from '@tippyjs/react'
2+
3+
import { ReactComponent as ICInfoOutline } from '@Icons/ic-info-outline.svg'
4+
import { VariableType } from '@Common/CIPipeline.Types'
5+
6+
export const FileConfigTippy = ({ fileMountDir }: Pick<VariableType, 'fileMountDir'>) => (
7+
<Tippy
8+
trigger="click"
9+
arrow={false}
10+
className="default-tt w-200"
11+
content={
12+
<div className="fs-12 lh-18 flexbox-col dc__gap-2 mw-none">
13+
<p className="m-0 fw-6 cn-0">File mount path</p>
14+
<p className="m-0 cn-50 flexbox-col flex-nowrap dc__word-break">
15+
{fileMountDir}
16+
<br />
17+
<br />
18+
Ensure the uploaded file name is unique to avoid conflicts or overrides.
19+
</p>
20+
</div>
21+
}
22+
>
23+
<div className="cursor flex dc__no-shrink">
24+
<ICInfoOutline className="icon-dim-18" />
25+
</div>
26+
</Tippy>
27+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './SystemVariableIcon'
2+
export * from './FileConfigTippy'

src/Pages/Applications/DevtronApps/Details/CIPipeline/services.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { MutableRefObject } from 'react'
2-
31
import { ROUTES } from '@Common/Constants'
42
import { getIsRequestAborted, post } from '@Common/Api'
53
import { getUrlWithSearchParams, showError } from '@Common/Helper'
6-
import { UploadFileDTO } from '@Shared/types'
4+
import { UploadFileDTO, UploadFileProps } from '@Shared/types'
5+
import { APIOptions } from '@Common/Types'
76

87
export const uploadCIPipelineFile = async ({
98
file,
@@ -14,14 +13,11 @@ export const uploadCIPipelineFile = async ({
1413
maxUploadSize,
1514
abortControllerRef,
1615
}: {
17-
file: File[]
1816
appId: number
1917
ciPipelineId: number
2018
envId?: number
21-
allowedExtensions?: string[]
22-
maxUploadSize?: number
23-
abortControllerRef?: MutableRefObject<AbortController>
24-
}): Promise<UploadFileDTO> => {
19+
} & UploadFileProps &
20+
Pick<APIOptions, 'abortControllerRef'>): Promise<UploadFileDTO> => {
2521
const formData = new FormData()
2622
formData.append('file', file[0])
2723

src/Shared/Components/DynamicDataTable/DynamicDataTableRow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
151151
}}
152152
textAreaProps={{
153153
...row.data[key].props?.textAreaProps,
154-
className: 'dynamic-data-table__cell-input placeholder-cn5 py-8 pr-8 cn-9 fs-13 lh-20',
154+
className: 'dynamic-data-table__cell-input placeholder-cn5 py-8 pr-32 cn-9 fs-13 lh-20',
155155
disableOnBlurResizeToMinHeight: true,
156156
minHeight: 20,
157157
maxHeight: 160,
@@ -178,7 +178,7 @@ export const DynamicDataTableRow = <K extends string, CustomStateType = Record<s
178178
)
179179
case DynamicDataTableRowDataType.FILE_UPLOAD:
180180
return (
181-
<div className={`w-100 h-100 flex top left px-8 ${row.data[key].value ? 'py-3' : 'py-8'}`}>
181+
<div className={`mw-none w-100 h-100 flex top left px-8 ${row.data[key].value ? 'py-3' : 'py-8'}`}>
182182
<FileUpload
183183
{...row.data[key].props}
184184
fileName={row.data[key].value}

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
207207
onCreateOption,
208208
closeMenuOnSelect = false,
209209
shouldShowNoOptionsMessage = true,
210+
formatCreateLabel,
210211
...props
211212
}: SelectPickerProps<OptionValue, IsMulti>) => {
212213
const { inputId, required, isDisabled, controlShouldRenderValue = true, value, options, getOptionValue } = props
@@ -393,6 +394,7 @@ const SelectPicker = <OptionValue, IsMulti extends boolean>({
393394
onInputChange={onInputChange}
394395
icon={icon}
395396
showSelectedOptionIcon={shouldShowSelectedOptionIcon}
397+
formatCreateLabel={formatCreateLabel}
396398
/>
397399
</div>
398400
</ConditionalWrap>

0 commit comments

Comments
 (0)